Skip to content

fix: reject Python keywords as field names - #19

Open
ANO3457 wants to merge 3 commits into
SuperagenticAI:mainfrom
ANO3457:fix/reject-keyword-field-names
Open

ANO3457 wants to merge 3 commits into
SuperagenticAI:mainfrom
ANO3457:fix/reject-keyword-field-names

Conversation

@ANO3457

@ANO3457 ANO3457 commented Oct 27, 2026

Copy link
Copy Markdown

validate_field_name() accepts names such as class, return and None because str.isidentifier() also accepts reserved Python keywords. Those names cannot be used as fields in generated Python signatures. Reject them with keyword.iskeyword() while preserving valid Unicode identifiers, trailing underscores and soft keywords.

Added coverage for every Python keyword and valid-name controls, plus an Unreleased changelog entry. On Python 3.12, the new tests produce 35 failures and 6 passes on the unchanged base; the full test suite and scoped Ruff lint/format checks pass on head 18e9505c9a3ca4e7d00f978c0f9f241134205946 in an isolated GitHub Actions runner: https://github.com/ANO3457/practical-ai-systems/actions/runs/40451449756 . No model API was called.

AI disclosure: Codex prepared the implementation, regression tests and description, inspected the final diff, and ran/read the checks above. The human operator is ANO3457; no separate personal human code review is claimed.

@ANO3457
ANO3457 requested a review from Shashikant86 as a code owner October 27, 2026 10:45

This branch has not been deployed

No deployments
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