fix: preserve caller globals in exec() for module Init.py/InitGui.py loading #240
Reference in New Issue
Block a user
Delete Branch "fix/exec-globals-regression"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The previous fix (
e10841a6c8) passed{"__file__": ...}as the globals argument toexec(), which replaced the caller's globals dict entirely. This strippedFreeCAD,FreeCADGui,Workbench, and other names that modules expect to be available, causingNameErrorfailures across Material, Tux, Mesh, ReverseEngineering, OpenSCAD, Inspection, Robot, AddonManager, MeshPart, and others.Fix:
{**globals(), "__file__": str(init_py)}— merges__file__into the caller's globals so both__file__and all existing names remain available.