File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -732,13 +732,18 @@ def run_command(code):
732732 self .assertIn (b"ResourceWarning: gc: 2 uncollectable objects at "
733733 b"shutdown; use" , stderr )
734734 self .assertNotIn (b"<X 'first'>" , stderr )
735+ one_line_re = b"gc: uncollectable <X 0x[0-9A-F]+>"
736+ expected_re = one_line_re + b"\\ r?\\ n" + one_line_re
737+ self .assertNotRegex (stderr , expected_re )
735738 # With DEBUG_UNCOLLECTABLE, the garbage list gets printed
736739 stderr = run_command (code % "gc.DEBUG_UNCOLLECTABLE" )
737740 self .assertIn (b"ResourceWarning: gc: 2 uncollectable objects at "
738741 b"shutdown" , stderr )
739742 self .assertTrue (
740743 (b"[<X 'first'>, <X 'second'>]" in stderr ) or
741744 (b"[<X 'second'>, <X 'first'>]" in stderr ), stderr )
745+ # we expect two lines with uncollectable objects
746+ self .assertRegex (stderr , expected_re )
742747 # With DEBUG_SAVEALL, no additional message should get printed
743748 # (because gc.garbage also contains normally reclaimable cyclic
744749 # references, and its elements get printed at runtime anyway).
Original file line number Diff line number Diff line change @@ -1782,7 +1782,7 @@ gc_collect_region(PyThreadState *tstate,
17821782 Py_ssize_t n = 0 ;
17831783 for (gc = GC_NEXT (& finalizers ); gc != & finalizers ; gc = GC_NEXT (gc )) {
17841784 n ++ ;
1785- if (gcstate -> debug & _PyGC_DEBUG_COLLECTABLE )
1785+ if (gcstate -> debug & _PyGC_DEBUG_UNCOLLECTABLE )
17861786 debug_cycle ("uncollectable" , FROM_GC (gc ));
17871787 }
17881788 stats -> uncollectable = n ;
You can’t perform that action at this time.
0 commit comments