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

loader: move ctypes hooks into a module #5850

Merged
merged 3 commits into from May 22, 2021

Conversation

rokm
Copy link
Member

@rokm rokm commented May 20, 2021

Move the ctypes hooks from bootstrap script into separate module (pymod04_ctypes). The main motivation for this is to prevent the modifications to global namespace from affecting the ctypes hooks code; specifically, if user decides to use sys or os as variables in the global namespace, that should not effect the ctypes hook function _frozen_name(), which treats sys and os as names of modules (which were bound to those names when the bootstrap script was executed).

Fixes #5797.

This commit is a cleaned-up and modernized version of selected commits from #3038, plus additional test that re-creates situation from #5797.

htgoebel and others added 3 commits May 20, 2021 18:36
The test attempts to trigger an error in PyInstaller's ctypes.CDLL()
wrapper, by using sys and os as string variables in the global
namespace.
Move the ctypes hooks from bootstrap script into separate module
(pymod04_ctypes). The main motivation for this is to prevent the
modifications to global namespace from affecting the ctypes hooks
code. Specifically, if user decides to use `sys` or `os` as
variables in the global namespace, that should not effect the
ctypes hook function _frozen_name(), which treats `sys` and `os`
as names of modules (which were bound to those names when the
bootstrap script was executed).

Fixes pyinstaller#5797.

This commit is a cleaned-up and modernized version of corresponding
commit from pyinstaller#3038 (daf60a6).

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
@rokm rokm force-pushed the bootstrap-ctypes-as-module branch from 5a7dff9 to be75a73 Compare May 20, 2021 18:23
@rokm rokm marked this pull request as ready for review May 20, 2021 20:32
@bwoodsend bwoodsend merged commit ed615bb into pyinstaller:develop May 22, 2021
@rokm rokm deleted the bootstrap-ctypes-as-module branch June 24, 2021 22:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError: 'str' object has no attribute '_MEIPASS'
3 participants