Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-137600: Promoteast node constructor deprecation warnings to errors#137601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@picnixz As mentioned in#121162 (comment), now that the constructors raise on missing and unknown fields, some of the checks that were added for |
Uh oh!
There was an error while loading.Please reload this page.
This takes me back as the original PR is one of my very first contributions to CPython! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'd suggest using msg = ... + re.escape() for assertRaisesRegex() where 80 chars limit is exceeded.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
@picnixz do you have any further feedback? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I do not but I actually had a pending review that I started 1 month ago. They are mainly for improving coverage and wording but they are optional.
| self.assertEqual(x.right,n3) | ||
| # Random attribute allowed too | ||
| x.foobarbaz=5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't know if we already cover this, but maybe we should instead:
- Find a way to construct all nodes "correctly" or have at least one instance of each nodes.
- For all these instances, check that we can set random attributes and delete them properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Good idea, added a test in the style of the existingtest_field_attr_existence test.
| The constructors of node types in the:mod:`ast` module now raise a | ||
| :exc:`TypeError` when a required argument is omitted or when a | ||
| keyword argument that does not map to a field on the AST node is passed. | ||
| These cases had previously raised a:exc:`DeprecationWarning` since Python | ||
| 3.13. Patch by Brian Schubert. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| The constructors of node types in the:mod:`ast` module now raise a | |
| :exc:`TypeError` when a required argument is omitted or when a | |
| keyword argument that does not map to a field on the AST node is passed. | |
| These cases had previously raised a:exc:`DeprecationWarning` since Python | |
| 3.13. Patch by Brian Schubert. | |
| :mod:`ast`: The constructors of AST nodes now raise a | |
| :exc:`TypeError` when a required argument is omitted or when a | |
| keyword argument that does not map to a field on the AST node is passed. | |
| These cases had previously raised a:exc:`DeprecationWarning` since Python | |
| 3.13. Patch by Brian Schubert. |
And you can reflow the paragraph as you deem fit (and also you can reuse that message in the NEWS).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Updated, thanks!
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
astnode constructor deprecation warnings to errors #137600📚 Documentation preview 📚:https://cpython-previews--137601.org.readthedocs.build/