8000 gh-104621: Check for Incompatible Extensions in import_find_extension() by ericsnowcurrently · Pull Request #107184 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-104621: Check for Incompatible Extensions in import_find_extension() #107184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add a test.
  • Loading branch information
ericsnowcurrently committed Jul 21, 2023
commit a6258c4a0dffc1686c64feef4de152f6f0f3e8ef
14 changes: 14 additions & 0 deletions Lib/test/test_import/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1962,6 +1962,20 @@ def test_isolated_config(self):
with self.subTest(f'{module}: strict, fresh'):
self.check_compatible_fresh(module, strict=True, isolated=True)

@requires_subinterpreters
@requires_singlephase_init
def test_disallowed_reimport(self):
# See https://github.com/python/cpython/issues/104621.
script = textwrap.dedent('''
import _testsinglephase
print(_testsinglephase)
''')
interpid = _interpreters.create()
with self.assertRaises(_interpreters.RunFailedError):
_interpreters.run_string(interpid, script)
with self.assertRaises(_interpreters.RunFailedError):
_interpreters.run_string(interpid, script)


class TestSinglePhaseSnapshot(ModuleSnapshot):

Expand Down
0