Skip to content
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

bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). #15490

Merged
merged 2 commits into from Aug 26, 2019

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Aug 25, 2019

It emits a deprecation message and calls corresponding method
visit_Num(), visit_Str(), etc.

https://bugs.python.org/issue36917

…nt().

It emits a deprecation message and calls corresponding method
visit_Num(), visit_Str(), etc.
@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error needs backport to 3.8 only security fixes labels Aug 25, 2019
Doc/whatsnew/3.8.rst Outdated Show resolved Hide resolved
Co-Authored-By: Xtreak <tir.karthi@gmail.com>
Copy link
Contributor

@asottile asottile left a comment

Choose a reason for hiding this comment

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

thanks!

(not sure I agree with deprecating these in the same release, but at least this fixes the code it broke)

@serhiy-storchaka
Copy link
Member Author

There are no much problems with the deprecation in the same release because visit_Constant is just ignored in older releases. It does not add any runtime cost, as well as old handlers like visit_Str will not add runtime cost in newer releases if you implemented visit_Constant.

@serhiy-storchaka serhiy-storchaka merged commit c3ea41e into python:master Aug 26, 2019
@serhiy-storchaka serhiy-storchaka deleted the visit-constant branch August 26, 2019 07:13
@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 26, 2019
…nt(). (pythonGH-15490)

It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
(cherry picked from commit c3ea41e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Aug 26, 2019
@bedevere-bot
Copy link

GH-15509 is a backport of this pull request to the 3.8 branch.

serhiy-storchaka pushed a commit that referenced this pull request Aug 26, 2019
…Constant(). (GH-15490) (GH-15509)

It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
(cherry picked from commit c3ea41e)
else:
import warnings
warnings.warn(f"{method} is deprecated; add visit_Constant",
DeprecationWarning, 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be PendingDeprecationWarning

Copy link
Member Author

Choose a reason for hiding this comment

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

It is a PendingDeprecationWarning in 3.8 and a DeprecationWarning in 3.9.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right, this is to 3.9! Silly me

lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
…nt(). (pythonGH-15490)

It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
…nt(). (pythonGH-15490)

It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
…nt(). (pythonGH-15490)

It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants