Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Lib/test/test_cmd_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# See test_cmd_line_script.py for testing of script execution

import os
import re
import subprocess
import sys
import tempfile
Expand Down Expand Up @@ -125,6 +126,9 @@ def run_python(*args):
# because of bugs in C extensions. This test is only about checking
# the showrefcount feature.
self.assertRegex(err, br'^\[-?\d+ refs, \d+ blocks\]')
refs, blocks = map(int, re.findall(r'-?\d+', str(err)))
self.assertLessEqual(refs, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refs should be 0 not negative.

Copy link
Member Author

@corona10 corona10 Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kumaraditya303 Please read the comment why I check the negotive value


            # bpo-46417: Tolerate negative reference count which can occur
            # because of bugs in C extensions. This test is only about checking
            # the showrefcount feature.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I am closing this PR since the #31555 looks better approach.

self.assertEqual(blocks, 0)
else:
self.assertEqual(err, b'')

Expand Down