Skip to content

Fix source loading example crash#1

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-83ce
Draft

Fix source loading example crash#1
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-83ce

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented May 11, 2026

Bug and impact

The newly added source/load_mod_from_source_code.py example crashed every time it was run. exec("a=b", {}) raised NameError because b was not defined in the execution namespace, making the example unusable.

Root cause

The executed source code referenced a symbol that was not provided to the isolated namespace passed to exec.

Fix

Seed the execution namespace with b before executing the source code, then print the loaded value. Added a standard-library smoke test that executes the script and asserts the expected output.

Validation

  • python3 source/load_mod_from_source_code.py
  • python3 source/unittest_to_io.py
  • python3 -m unittest discover -s tests
Open in Web View Automation 

Co-authored-by: 0-coding <0-coding@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant