Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 479ac5c

Browse filesBrowse files
authored
gh-115859: Fix test_type_inconsistency() when run multiple times (#116079)
This should fix the refleaks bots. (See #116062 (comment) .)
1 parent 3ea78fd commit 479ac5c
Copy full SHA for 479ac5c

File tree

Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Open diff view settings
Collapse file

‎Lib/test/test_capi/test_opt.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_capi/test_opt.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,13 @@ def testfunc(n):
893893
self.assertIn("_COMPARE_OP_STR", uops)
894894

895895
def test_type_inconsistency(self):
896-
def testfunc(n):
897-
for i in range(n):
898-
x = _test_global + _test_global
896+
ns = {}
897+
exec(textwrap.dedent("""
898+
def testfunc(n):
899+
for i in range(n):
900+
x = _test_global + _test_global
901+
"""), globals(), ns)
902+
testfunc = ns['testfunc']
899903
# Must be a real global else it won't be optimized to _LOAD_CONST_INLINE
900904
global _test_global
901905
_test_global = 0

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.