Skip to content
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

Update finder.py to fix RecursionError: maximum recursion depth exceeded #2272

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
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
17 changes: 15 additions & 2 deletions cx_Freeze/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,18 +462,31 @@ def _load_module_code(
if module.hook:
module.hook(self)

import threading

if module.code is not None:
if self.replace_paths:
module.code = self._replace_paths_in_code(module)

# Scan the module code for import statements
self._scan_code(module, deferred_imports)
# self._scan_code(module, deferred_imports)
thr = threading.Thread(
target=self._scan_code, args=(module, deferred_imports)
)
thr.start()
thr.join()

# Verify __package__ in use
module.code = self._replace_package_in_code(module)

elif module.stub_code is not None:
self._scan_code(module, deferred_imports, module.stub_code)
# self._scan_code(module, deferred_imports, module.stub_code)
thr = threading.Thread(
target=self._scan_code,
args=(module, deferred_imports, module.stub_code),
)
thr.start()
thr.join()

module.in_import = False
return module
Expand Down
Loading