gh-123880: Allow recursive import of single-phase-init modules (GH-123950)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
Petr Viktorin 2024-09-20 10:27:34 +02:00 committed by GitHub
parent 3e36e5aef1
commit aee219f455
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 141 additions and 25 deletions

View file

@ -0,0 +1,13 @@
"""Circular import involving a single-phase-init extension.
This module is imported from the _testsinglephase_circular module from
_testsinglephase, and imports that module again.
"""
import importlib
import _testsinglephase
from test.test_import import import_extension_from_file
name = '_testsinglephase_circular'
filename = _testsinglephase.__file__
mod = import_extension_from_file(name, filename)