Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e7c832

Browse files
author
Thomas Heller
committed
Fix SF item #876278: Unbounded recursion in modulefinder.
Already backported to release23-maint.
1 parent 112f8f4 commit 2e7c832

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/modulefinder.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ def import_module(self, partname, fqname, parent):
245245
if self.badmodules.has_key(fqname):
246246
self.msgout(3, "import_module -> None")
247247
return None
248+
if parent and parent.__path__ is None:
249+
self.msgout(3, "import_module -> None")
250+
return None
248251
try:
249252
fp, pathname, stuff = self.find_module(partname,
250253
parent and parent.__path__, parent)
@@ -392,6 +395,7 @@ def add_module(self, fqname):
392395

393396
def find_module(self, name, path, parent=None):
394397
if parent is not None:
398+
# assert path is not None
395399
fullname = parent.__name__+'.'+name
396400
else:
397401
fullname = name

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ Extension modules
306306
Library
307307
-------
308308

309+
- Bug #876278: Unbounded recursion in modulefinder
310+
309311
- Bug #780300: Swap public and system ID in LexicalHandler.startDTD.
310312
Applications relying on the wrong order need to be corrected.
311313

0 commit comments

Comments
 (0)