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 fbf6796

Browse filesBrowse files
vstinnerasvetlov
authored andcommitted
bpo-46857: Fix test_embed.test_no_memleak() on Windows (GH-31589)
Tolerate a leak of 1 reference and 1 memory block until it's fixed.
1 parent 3ebfc39 commit fbf6796
Copy full SHA for fbf6796

File tree

1 file changed

+10
-4
lines changed
Filter options

1 file changed

+10
-4
lines changed

‎Lib/test/test_embed.py

Copy file name to clipboardExpand all lines: Lib/test/test_embed.py
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,10 +1657,16 @@ def test_no_memleak(self):
16571657
self.fail(f"unexpected output: {out!a}")
16581658
refs = int(match.group(1))
16591659
blocks = int(match.group(2))
1660-
# bpo-46417: Tolerate negative reference count which can occur because
1661-
# of bugs in C extensions. It is only wrong if it's greater than 0.
1662-
self.assertLessEqual(refs, 0, out)
1663-
self.assertEqual(blocks, 0, out)
1660+
if not MS_WINDOWS:
1661+
# bpo-46417: Tolerate negative reference count which can occur because
1662+
# of bugs in C extensions. It is only wrong if it's greater than 0.
1663+
self.assertLessEqual(refs, 0, out)
1664+
self.assertEqual(blocks, 0, out)
1665+
else:
1666+
# bpo-46857: on Windows, Python still leaks 1 reference and 1
1667+
# memory block at exit.
1668+
self.assertLessEqual(refs, 1, out)
1669+
self.assertIn(blocks, (0, 1), out)
16641670

16651671

16661672
class StdPrinterTests(EmbeddingTestsMixin, unittest.TestCase):

0 commit comments

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