GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_interpreters: when TestInterpreterAttrs.test_id_type() is run alone, it fails with an assertion error · Issue #88128 · python/cpython

test_interpreters: when TestInterpreterAttrs.test_id_type() is run alone, it fails with an assertion error #88128

New issue
Copy link
New issue
Copy link
Closed
Closed
test_interpreters: when TestInterpreterAttrs.test_id_type() is run alone, it fails with an assertion error#88128
Copy link
Labels
3.10 (EOL)end of lifeend of lifetestsTests in the Lib/test dirTests in the Lib/test dir

Description

@vstinner
vstinner
opened on Apr 27, 2021
Issue body actions
BPO 43962
Nosy @vstinner, @ericsnowcurrently, @miss-islington, @nanjekyejoannah
PRs
  • bpo-43962: Fix _PyInterpreterState_IDIncref() #25683
  • [3.9] bpo-43962: Fix _PyInterpreterState_IDIncref() (GH-25683) #25685
  • [3.8] bpo-43962: Fix _PyInterpreterState_IDIncref() (GH-25683) #25686
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-04-27.22:55:01.625>
    labels = ['tests', '3.10']
    title = 'test_interpreters: when TestInterpreterAttrs.test_id_type() is run alone, it fails with an assertion error'
    updated_at = <Date 2021-04-28.13:47:01.117>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2021-04-28.13:47:01.117>
    actor = 'vstinner'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests']
    creation = <Date 2021-04-27.22:55:01.625>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43962
    keywords = ['patch']
    message_count = 4.0
    messages = ['392145', '392183', '392187', '392197']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'eric.snow', 'miss-islington', 'nanjekyejoannah']
    pr_nums = ['25683', '25685', '25686']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43962'
    versions = ['Python 3.10']

    Activity

    1. vstinner commented on Apr 27, 2021

      @vstinner
      vstinner
      on Apr 27, 2021
      MemberAuthor
      More actions

      Example on Linux.

      $ ./python -m test test_interpreters -m test.test_interpreters.TestInterpreterAttrs.test_id_type
      0:00:00 load avg: 1.20 Run tests sequentially
      0:00:00 load avg: 1.20 [1/1] test_interpreters
      python: Python/pystate.c:561: _PyInterpreterState_IDDecref: Assertion `interp->id_refcount != 0' failed.
      Fatal Python error: Aborted

      Current thread 0x00007f05eab42740 (most recent call first):
      File "/home/vstinner/python/master/Lib/unittest/case.py", line 549 in _callTestMethod
      File "/home/vstinner/python/master/Lib/unittest/case.py", line 592 in run
      File "/home/vstinner/python/master/Lib/unittest/case.py", line 652 in __call__
      File "/home/vstinner/python/master/Lib/unittest/suite.py", line 122 in run
      File "/home/vstinner/python/master/Lib/unittest/suite.py", line 84 in __call__
      File "/home/vstinner/python/master/Lib/unittest/suite.py", line 122 in run
      File "/home/vstinner/python/master/Lib/unittest/suite.py", line 84 in __call__
      File "/home/vstinner/python/master/Lib/unittest/suite.py", line 122 in run
      File "/home/vstinner/python/master/Lib/unittest/suite.py", line 84 in __call__
      File "/home/vstinner/python/master/Lib/test/support/testresult.py", line 169 in run
      File "/home/vstinner/python/master/Lib/test/support/init.py", line 959 in _run_suite
      File "/home/vstinner/python/master/Lib/test/support/init.py", line 1082 in run_unittest
      File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 210 in _test_module
      File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 246 in _runtest_inner2
      File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 282 in _runtest_inner
      File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 154 in _runtest
      File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 194 in runtest
      File "/home/vstinner/python/master/Lib/test/libregrtest/main.py", line 423 in run_tests_sequential
      File "/home/vstinner/python/master/Lib/test/libregrtest/main.py", line 521 in run_tests
      File "/home/vstinner/python/master/Lib/test/libregrtest/main.py", line 694 in _main
      File "/home/vstinner/python/master/Lib/test/libregrtest/main.py", line 641 in main
      File "/home/vstinner/python/master/Lib/test/libregrtest/main.py", line 719 in main
      File "/home/vstinner/python/master/Lib/test/main.py", line 2 in <module>
      File "/home/vstinner/python/master/Lib/runpy.py", line 86 in _run_code
      File "/home/vstinner/python/master/Lib/runpy.py", line 196 in _run_module_as_main

      Extension modules: _testcapi, _xxsubinterpreters (total: 2)
      Abandon (core dumped)

      When the whole test case is run, it's fine:

      $ ./python -m test test_interpreters -m TestInterpreterAttrs -v
      == CPython 3.10.0a7+ (heads/master:6bd9288b80, Apr 27 2021, 22:16:25) [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
      == Linux-5.11.15-300.fc34.x86_64-x86_64-with-glibc2.33 little-endian
      == cwd: /home/vstinner/python/master/build/test_python_16394æ
      == CPU count: 8
      == encodings: locale=UTF-8, FS=utf-8
      0:00:00 load avg: 1.39 Run tests sequentially
      0:00:00 load avg: 1.39 [1/1] test_interpreters
      test_custom_id (test.test_interpreters.TestInterpreterAttrs) ... ok
      test_custom_isolated_default (test.test_interpreters.TestInterpreterAttrs) ... skipped 'not ready yet (see bpo-32604)'
      test_custom_isolated_explicit (test.test_interpreters.TestInterpreterAttrs) ... ok
      test_equality (test.test_interpreters.TestInterpreterAttrs) ... ok
      test_id_readonly (test.test_interpreters.TestInterpreterAttrs) ... ok
      test_id_type (test.test_interpreters.TestInterpreterAttrs) ... ok
      test_isolated_readonly (test.test_interpreters.TestInterpreterAttrs) ... ok
      test_main_id (test.test_interpreters.TestInterpreterAttrs) ... ok
      test_main_isolated (test.test_interpreters.TestInterpreterAttrs) ... skipped 'not ready yet (see bpo-32604)'
      test_subinterpreter_isolated_default (test.test_interpreters.TestInterpreterAttrs) ... skipped 'not ready yet (see bpo-32604)'
      test_subinterpreter_isolated_explicit (test.test_interpreters.TestInterpreterAttrs) ... ok

      Ran 11 tests in 0.159s

      OK (skipped=3)

      == Tests result: SUCCESS ==

      1 test OK.

      Total duration: 285 ms
      Tests result: SUCCESS

    2. vstinner
      added
      3.10 (EOL)end of lifeend of life
      testsTests in the Lib/test dirTests in the Lib/test dir
      on Apr 27, 2021
    3. vstinner
      changed the title [-]test_interpreters: when test_id_type() is run alone, it fails with an assertion error[/-] [+]test_interpreters: when TestInterpreterAttrs.test_id_type() is run alone, it fails with an assertion error[/+] on Apr 27, 2021
    4. vstinner
      changed the title [-]test_interpreters: when test_id_type() is run alone, it fails with an assertion error[/-] [+]test_interpreters: when TestInterpreterAttrs.test_id_type() is run alone, it fails with an assertion error[/+] on Apr 27, 2021
    5. vstinner commented on Apr 28, 2021

      @vstinner
      vstinner
      on Apr 28, 2021
      MemberAuthor
      More actions

      Creating an _interpreters.InterpreterID object calls newinterpid() which calls _PyInterpreterState_IDIncref(interp).

      _PyInterpreterState_IDIncref(interp) does nothing if interp->id_mutex is NULL.

      Calling _interpreters.get_current() calls interp_get_current() which calls _PyInterpreterState_IDInitref().

      _PyInterpreterState_IDInitref() creates the id_mutex and initializes id_refcount to 0.

      Later, when the _interpreters.InterpreterID object is deallocated, interpid_dealloc() calls _PyInterpreterState_IDDecref(). Since id_mutex was created in the meanwhile, _PyInterpreterState_IDDecref() now decrements id_refcnt.

      ... It doesn't work: _PyInterpreterState_IDIncref() should always increase the reference count.

    6. vstinner commented on Apr 28, 2021

      @vstinner
      vstinner
      on Apr 28, 2021
      MemberAuthor
      More actions

      New changeset 32c5a17 by Victor Stinner in branch 'master':
      bpo-43962: Fix _PyInterpreterState_IDIncref() (GH-25683)
      32c5a17

    7. vstinner commented on Apr 28, 2021

      @vstinner
      vstinner
      on Apr 28, 2021
      MemberAuthor
      More actions

      New changeset 77db337 by Victor Stinner in branch '3.8':
      bpo-43962: Fix _PyInterpreterState_IDIncref() (GH-25683) (GH-25686)
      77db337

    8. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    9. kumaraditya303 commented on May 22, 2022

      @kumaraditya303
      kumaraditya303
      on May 22, 2022
      Contributor
      More actions

      Closing as it seems fixed.

    10. kumaraditya303
      closed this as completedon May 22, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of lifeend of lifetestsTests in the Lib/test dirTests in the Lib/test dir

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.