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

depend: work around the potential None referer in get_co_using_ctypes #5663

Merged
merged 1 commit into from Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions PyInstaller/depend/analysis.py
Expand Up @@ -741,6 +741,11 @@ def get_co_using_ctypes(self):
if node:
referers = self.getReferers(node)
for r in referers:
# Under python 3.7 and earlier, if ctypes is added to
# hidden imports, one of referers ends up being None,
# causing #3825. Work around it.
if r is None:
continue
r_ident = r.identifier
# Ensure that modulegraph objects has attribute 'code'.
if type(r).__name__ in pure_python_module_types:
Expand Down
2 changes: 2 additions & 0 deletions news/3825.bugfix.rst
@@ -0,0 +1,2 @@
Fix the build-time error under python 3.7 and earlier when ``ctypes``
is manually added to ``hiddenimports``.