Skip to content

Python 3.15.0: test_sys.test_getallocatedblocks() fails if run after test_collections.test_odd_sizes() #134248

Open
@Fearless-Badger

Description

@Fearless-Badger

Bug report

Bug description:

test_sys fails while running the test suite of python 3.15.0 when --with-pydebug and --enable-optimizations are both enabled.

I get consistent failure of the test suite, but when I run the test individually, it passes. I do not know if this is expected or not, as I understand that enabling the debugger and optimizations is kind of contradictory. I included the test header, as well as the tests summary for additional info.

== CPython 3.15.0a0 (heads/main-dirty:9983c7d4416, May 19 2025, 09:41:00) [GCC 13.3.0]
== Linux-6.11.0-25-generic-x86_64-with-glibc2.39 little-endian
== Python build: debug PGO
== cwd: /home/badger/oss/cpython/build/test_python_worker_177894æ
== CPU count: 8
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests

Using random seed: 3038718328


...


0:32:13 load avg: 1.39 [396/491] test_sys
test test_sys failed -- Traceback (most recent call last):
  File "/home/badger/oss/cpython/Lib/test/test_sys.py", line 1156, in test_getallocatedblocks
    self.assertLess(a, sys.gettotalrefcount())
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 698068 not less than 663517

0:32:18 load avg: 1.36 [396/491/1] test_sys failed (1 failure)


...


== Tests result: FAILURE ==

22 tests skipped:
    test.test_asyncio.test_windows_events
    test.test_asyncio.test_windows_utils test.test_gdb.test_backtrace
    test.test_gdb.test_cfunction test.test_gdb.test_cfunction_full
    test.test_gdb.test_misc test.test_gdb.test_pretty_print
    test_android test_apple test_dbm_gnu test_dbm_ndbm test_devpoll
    test_free_threading test_kqueue test_launcher test_msvcrt
    test_startfile test_winapi test_winconsoleio test_winreg test_wmi
    test_zstd

11 tests skipped (resource denied):
    test_curses test_peg_generator test_pyrepl test_smtpnet
    test_socketserver test_tkinter test_ttk test_urllib2net
    test_urllibnet test_winsound test_zipfile64

1 test failed:
    test_sys

457 tests OK.

Total duration: 39 min 17 sec
Total tests: run=46,135 failures=1 skipped=2,164
Total test files: run=480/491 failed=1 skipped=22 resource_denied=11
Result: FAILURE

I don't suspect my local environment to be the problem, since the test suite passes when I remove the "--enable-optimizations" flag, and just enable the debugger. The variable "a" seems to change each time I run the suite, so I included the random seed.

Build setup:

Tested on Python 3.15.0.

Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.2 LTS
Release:	24.04
Codename:	noble

CPU: product: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz

Configuration I used

./configure --with-pydebug --enable-optimizations 

CPython versions tested on:

3.15, CPython main branch

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixes3.15new features, bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions