Skip to content

test_pyinit_function_raises_exception doesn't work without _testsinglephase #156676

Description

@saioffl

Bug report

Bug description:

#Lib/test/test_import/__init__.py, it needs to be decorated with: 

@unittest.skipIf(_testsinglephase is None, "test requires _testsinglephase module")
# and the import needs to be removed 

#Throws an error : 
```Lib/test/test_import/__init__.py lines 2547 to 2551
@requires_subinterpreters
def test_pyinit_function_raises_exception(self):
    # gh-144601: PyInit functions that raised exceptions would cause a
    # crash when imported from a subinterpreter.
    import _testsinglephase```

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs

Activity

  1. saioffl commented on Aug 30, 2026

    @saioffl
    ContributorAuthor

    Lib/test/test_import/init.py lines 2547 to 2551
    @requires_subinterpreters
    def test_pyinit_function_raises_exception(self):
    # gh-144601: PyInit functions that raised exceptions would cause a
    # crash when imported from a subinterpreter.
    import _testsinglephase

    The exact error message

  2. StanFromIreland commented on Aug 30, 2026

    @StanFromIreland
    Member

    Do you want to open a PR for this?

  3. saioffl commented on Aug 30, 2026

    @saioffl
    ContributorAuthor

    Yes, I’d be happy to work on this and open a PR.

  4. changed the title [-]A small Improvement[/-] [+]`test_pyinit_function_raises_exception` doesn't work without `_testsinglephase`[/+] on Aug 30, 2026
  5. added a commit that references this issue on Aug 30, 2026
  6. ZeroIntensity commented on Aug 30, 2026

    @ZeroIntensity
    Member

    Backports are on auto-merge and the 3.15 PR is waiting on Hugo -- thanks for the fix!

  7. added 2 commits that reference this issue on Aug 30, 2026
  8. added a commit that references this issue on Aug 31, 2026
  9. added a commit that references this issue on Sep 12, 2026
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

    testsTests 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