Skip to content

Fix crashing source code loader example#11

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-correctness-bugs-4ce6
Draft

Fix crashing source code loader example#11
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-correctness-bugs-4ce6

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented May 21, 2026

Bug and impact

The recently added source/load_mod_from_source_code.py example crashed on every execution because the dynamically executed snippet referenced an undefined name. Any user running the example hit a NameError instead of seeing the intended loaded value.

Root cause

The script executed a=b inside an otherwise empty namespace, so b was unresolved during exec.

Fix

Changed the snippet to assign the literal string value (a='b') and added a standard-library unittest regression test that executes the script as a subprocess.

Validation

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

cursoragent and others added 3 commits May 21, 2026 11:08
Co-authored-by: 0-coding <0-coding@users.noreply.github.com>
Co-authored-by: 0-coding <0-coding@users.noreply.github.com>
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