Skip to content

Commit

Permalink
Fix(ImportHooks): Fix another RecursionError under PyPy3
Browse files Browse the repository at this point in the history
  • Loading branch information
phdru committed Jul 29, 2024
1 parent b75f651 commit 86908f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Cheetah/ImportManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ def importHook(self, name, globals=None, locals=None,

def doimport(self, nm, parentnm, fqname):
# Not that nm is NEVER a dotted name at this point
mod = None
if parentnm:
parent = sys.modules[parentnm]
if hasattr(parent, '__path__'):
Expand All @@ -525,7 +526,10 @@ def doimport(self, nm, parentnm, fqname):
try:
mod = director.getmod(nm)
except RecursionError:
mod = __oldimport__(nm) # noqa: F821 undefined name
try:
mod = __oldimport__(nm) # noqa: F821 undefined name
except RecursionError:
pass
if mod:
break
if mod:
Expand Down
2 changes: 2 additions & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Bug fixes:
- Fixed mapping test in ``NameMapper.py``:
Python 3.13 brough a new mapping type ``FrameLocalsProxy``.

- Fixed another ``RecursionError`` in ``ImportHooks`` under PyPy3.

Tests:

- tox: Run tests under Python 3.13.
Expand Down

0 comments on commit 86908f1

Please sign in to comment.