Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6c7fb55

Browse files
committed
Issue #28688: Remove warnings.filters check from regrtest
Reloading the warnings module duplicates filters in warnings.filters. Fixing the issue is tricky. It was decided to simply remove the check from Python 3.5, since the bug only impacts Python unit tests, not real applications. The check is kept in Python 3.6 and newer.
1 parent 6a4d762 commit 6c7fb55

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

Lib/test/regrtest.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ def __init__(self, testname, verbose=0, quiet=False, *, pgo=False):
10521052

10531053
resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr',
10541054
'os.environ', 'sys.path', 'sys.path_hooks', '__import__',
1055-
'warnings.filters', 'asyncore.socket_map',
1055+
'asyncore.socket_map',
10561056
'logging._handlers', 'logging._handlerList', 'sys.gettrace',
10571057
'sys.warnoptions',
10581058
# multiprocessing.process._cleanup() may release ref
@@ -1118,12 +1118,6 @@ def get___import__(self):
11181118
def restore___import__(self, import_):
11191119
builtins.__import__ = import_
11201120

1121-
def get_warnings_filters(self):
1122-
return id(warnings.filters), warnings.filters, warnings.filters[:]
1123-
def restore_warnings_filters(self, saved_filters):
1124-
warnings.filters = saved_filters[1]
1125-
warnings.filters[:] = saved_filters[2]
1126-
11271121
def get_asyncore_socket_map(self):
11281122
asyncore = sys.modules.get('asyncore')
11291123
# XXX Making a copy keeps objects alive until __exit__ gets called.

0 commit comments

Comments
 (0)