Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d60b8e88a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if self.local_rename_scopes and not self._is_node_global(node): | ||
| node.name = self._rename_local_identifier(node.name) | ||
| elif node.name not in self.mapping_values: |
There was a problem hiding this comment.
Keep nested function names unique across module
Using _rename_local_identifier for non-global FunctionDefs allows a nested function to reuse a top-level renamed name (for example both becoming a). Because call-signature metadata is stored in self.callable_argument_infos by identifier, the later nested definition overwrites the top-level entry, so subsequent keyword calls to the top-level function are no longer rewritten correctly and can fail at runtime with TypeError when rename_arguments=True.
Useful? React with 👍 / 👎.
| if self.local_rename_scopes and not self._is_node_global(node): | ||
| node.name = self._rename_local_identifier(node.name) | ||
| elif node.name not in self.mapping_values: |
There was a problem hiding this comment.
Prevent nested class renames from shadowing global class metadata
Renaming non-global ClassDefs via _rename_local_identifier can reuse a renamed top-level class name, but class method/attribute metadata is keyed only by class identifier (class_method_argument_infos / class_member_mappings). When a nested class later overwrites that key, method-call rewriting for the top-level class can use the wrong signature and emit invalid calls (e.g., unconverted keywords), causing runtime errors under rename_arguments=True.
Useful? React with 👍 / 👎.
Summary
globalandnonlocaldeclarations stay aligned with renamed bindingsfrom __future__imports and stop whitespace compaction from corrupting f-strings ormatch/case...bodies valid after docstring stripping and add regression tests for the new compatibility casesValidation
.venv/bin/python -m pytest -q.bench-repos/{attrs,click,flask,jinja,pyminifier-tool,pytest,requests}with--rename-modules --rename-global-variables --rename-arguments