generated from simonw/python-lib-template-repository
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Rather than open a discussion about free threading, I thought I'd focus on one specific part.
When I asked Claude Code to investigate, it flagged these lines in placeholders.py where set them up. Its findings:
🔴 CRITICAL: Random Global State (placeholders.py:9-12)
FRAGMENT_TAG = f"t🐍f-{''.join(random.choices(string.ascii_lowercase, k=4))}-"
_PLACEHOLDER_PREFIX = f"t🐍{''.join(random.choices(string.ascii_lowercase, k=2))}-"
_PLACEHOLDER_SUFFIX = f"-{''.join(random.choices(string.ascii_lowercase, k=2))}🐍t"Problem: These are module-level constants generated with random values at import time. In free-threaded mode:
- Multiple threads importing simultaneously could cause race conditions
- The regex pattern depends on these values - if they're inconsistent, parsing breaks
- Module initialization isn't guaranteed to be atomic across threads
Impact: HIGH - Could cause parser failures or incorrect template processing
Metadata
Metadata
Assignees
Labels
No labels