Skip to content

(3.8) Replace deprecated ast literals #366

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

FozzieHi
Copy link
Contributor

@FozzieHi FozzieHi commented Mar 14, 2023

Tracking issue: #365

See python/cpython#77073:

Num -- for int, float and complex
Str -- for str
Bytes -- for bytes
Ellipsis -- for Ellipsis
NameConstant -- for True, False and None

This looks a bit messy in places but I don't think a helper function would provide that much improved readability (it'd effectively just be re-implementing the deprecation's, which we don't want), and we only use this in a relatively small portion of the code base.

I've just replaced the deprecated literals with their actual meanings, I'm not too sure whether we now want to change some (for example ast.Num checks for int, float and complex but we might only want to check for int).

@FozzieHi
Copy link
Contributor Author

FozzieHi commented Mar 14, 2023

Oh right, we might want to disable the 3.7 CI run first 🤦

@cooperlees
Copy link
Collaborator

cooperlees commented Mar 14, 2023

Oh right, we might want to disable the 3.7 CI run first facepalm

Maybe we should do this in a PR we land before this turning off CI, adjusting pyproject.toml and anything else that ups our minimums for tools ... Also happy for this all to be 1 PR ... Doesn't seem it will be to large, just that if the new ast literals have bugs it's a cleaner revert ...

@FozzieHi
Copy link
Contributor Author

@cooperlees Just read my mind, submitting a PR for that now.

@cooperlees
Copy link
Collaborator

@cooperlees Just read my mind, submitting a PR for that now.

I'm around for a few hours so can merge quickly to make rebasing this easier.

Copy link
Collaborator

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests pass and we have good coverage so pretty confident here.

@cooperlees cooperlees merged commit a110333 into PyCQA:main Mar 14, 2023
@FozzieHi FozzieHi deleted the 3-8-deprecated branch March 14, 2023 22:41
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