Skip to content

Fix: Python 3.13 optimized scope locals with exec#7

Merged
FoamyGuy merged 1 commit intoadafruit:mainfrom
michalpokusa:python-3.13-locals-fix
Feb 11, 2026
Merged

Fix: Python 3.13 optimized scope locals with exec#7
FoamyGuy merged 1 commit intoadafruit:mainfrom
michalpokusa:python-3.13-locals-fix

Conversation

@michalpokusa
Copy link
Copy Markdown
Contributor

🪛Fixes:

  • From Python 3.13 calling exec does not implicitly update locals() which always results in KeyError, regardless of the template content. To retain current behavior it is necessary to pass a manually created dict, which is also a recommended way of doing this

Related links:
https://docs.python.org/3/whatsnew/3.13.html#defined-mutation-semantics-for-locals
https://peps.python.org/pep-0667/

Copy link
Copy Markdown
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Tested successfully on CircuitPython Adafruit CircuitPython 10.1.0-beta.1-36-g020c7932d0 on 2026-02-10; Adafruit Fruit Jam with rp2350b and CPython 3.13

@FoamyGuy FoamyGuy merged commit 2beb93a into adafruit:main Feb 11, 2026
1 check passed
adafruit-adabot pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 12, 2026
Updating https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO to 6.1.0 from 6.0.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#134 from adafruit/mqtt-integration-tests-cpython

Updating https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer to 4.8.0 from 4.7.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_HTTPServer#111 from michalpokusa/feature/websocket-cont-opcode-support

Updating https://github.com/adafruit/Adafruit_CircuitPython_TemplateEngine to 2.0.7 from 2.0.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_TemplateEngine#7 from michalpokusa/python-3.13-locals-fix
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.

2 participants