Skip to content

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Aug 10, 2025

Description

Fix undefined names, which can raise NameError at runtime.

% ruff check --select=F821 --output-format=concise

core/tests/javascript/terminal.py:5:8: F821 Undefined name `__terminal__`
core/tests/manual/game/aliens.py:322:72: F821 Undefined name `bestdepth`
core/tests/manual/game/aliens.py:329:52: F821 Undefined name `bestdepth`
core/tests/manual/issue-2302/libthree.py:143:25: F821 Undefined name `Float32Array`
core/tests/python/tests/test_util.py:15:14: F821 Undefined name `i`
Found 5 errors.

Changes

__terminal__ change https://github.com/search?q=repo%3Apyscript%2Fpyscript+__terminal

bestdepth change is from

Float32Array change https://github.com/search?q=repo%3Apyscript%2Fpyscript+Float32Array

i change is an educated guess. I wonder how this test passes at all.

An alternative for two of these violations would be:

  [tools.ruff]
+ builtins = [ "__terminal__", "Float32Array" ]

Checklist

  • I have checked make build works locally.
  • I have created / updated documentation for this change (if applicable).

@cclauss cclauss force-pushed the fix-undefined-names-in-python-code branch from 6003f9a to c6dc352 Compare August 10, 2025 01:34
@WebReflection WebReflection merged commit 8b35304 into pyscript:main Aug 18, 2025
2 checks passed
@cclauss cclauss deleted the fix-undefined-names-in-python-code branch August 18, 2025 12:02
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