Skip to content

Commit 60b18aa

Browse files
committed
better fix
1 parent e52cce6 commit 60b18aa

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Lib/test/libregrtest/utils.py

+7
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ def clear_caches():
210210
else:
211211
fractions._hash_algorithm.cache_clear()
212212

213+
try:
214+
inspect = sys.modules['inspect']
215+
except KeyError:
216+
pass
217+
else:
218+
inspect._shadowed_dict_from_mro_tuple.cache_clear()
219+
213220

214221
def get_build_info():
215222
# Get most important configure and build options as a list of strings.

Lib/test/test_inspect.py

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def revise(filename, *args):
6969
def tearDownModule():
7070
if support.has_socket_support:
7171
asyncio.set_event_loop_policy(None)
72-
inspect._shadowed_dict_from_mro_tuple.cache_clear()
7372

7473

7574
def signatures_with_lexicographic_keyword_only_parameters():

Lib/test/test_typing.py

-4
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@
5656
CANNOT_SUBCLASS_INSTANCE = 'Cannot subclass an instance of %s'
5757

5858

59-
def tearDownModule():
60-
inspect._shadowed_dict_from_mro_tuple.cache_clear()
61-
62-
6359
class BaseTestCase(TestCase):
6460

6561
def assertIsSubclass(self, cls, class_or_tuple, msg=None):

0 commit comments

Comments
 (0)