@@ -615,7 +615,8 @@ def _make_term_column_builders(terms,
615615 term_to_column_builders [term ] = column_builders
616616 return new_term_order , term_to_column_builders
617617
618- def design_matrix_builders (termlists , data_iter_maker , eval_env , NA_action = "drop" ):
618+ def design_matrix_builders (termlists , data_iter_maker , eval_env ,
619+ NA_action = "drop" ):
619620 """Construct several :class:`DesignMatrixBuilders` from termlists.
620621
621622 This is one of Patsy's fundamental functions. This function and
@@ -654,14 +655,10 @@ def design_matrix_builders(termlists, data_iter_maker, eval_env, NA_action="drop
654655 .. versionadded:: 0.4.0
655656 The ``eval_env`` argument.
656657 """
657- # Check type of eval_env to help people migrating to 0.4.0. Third
658- # argument used to be NA_action (a string). Having the check for
659- # eval_env's type gives people migrating to 0.4.0 who used NA_action
660- # not as a keyword argument a nice error message here, instead of a
661- # more obscure backtrace later on.
662- if not isinstance (eval_env , six .integer_types + (EvalEnvironment ,)):
663- raise TypeError ("Parameter 'eval_env' must be either an integer or an instance "
664- "of patsy.EvalEnvironment." )
658+ # People upgrading from versions prior to 0.4.0 could potentially have
659+ # passed NA_action as the 3rd positional argument. Fortunately
660+ # EvalEnvironment.capture only accepts int and EvalEnvironment objects,
661+ # and we improved its error messages to make this clear.
665662 eval_env = EvalEnvironment .capture (eval_env , reference = 1 )
666663 if isinstance (NA_action , str ):
667664 NA_action = NAAction (NA_action )
0 commit comments