File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -203,14 +203,17 @@ def get_params(self, deep=True):
203203 # We need deprecation warnings to always be on for this to work.
204204 # This is set in utils/__init__.py but it gets overwritten
205205 # when running under python3 somehow.
206- warnings .simplefilter ("always" , DeprecationWarning )
207206 for key in self ._get_param_names ():
208207 # catch deprecation warnings
209- with warnings .catch_warnings (record = True ) as w :
210- value = getattr (self , key , None )
211- if len (w ) and w [0 ].category == DeprecationWarning :
208+ warnings .simplefilter ("always" , DeprecationWarning )
209+ try :
210+ with warnings .catch_warnings (record = True ) as w :
211+ value = getattr (self , key , None )
212+ if len (w ) and w [0 ].category == DeprecationWarning :
212213 # if the parameter is deprecated, don't show it
213- continue
214+ continue
215+ finally :
216+ warnings .filters .pop (0 )
214217
215218 # XXX: should we rather test if instance of estimator?
216219 if deep and hasattr (value , 'get_params' ):
You can’t perform that action at this time.
0 commit comments