close
Skip to content

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

Merged
serhiy-storchaka merged 2 commits intopython:masterfrom
serhiy-storchaka:visit-constant
Aug 26, 2019
Merged

bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant().#15490
serhiy-storchaka merged 2 commits intopython:masterfrom
serhiy-storchaka:visit-constant

Conversation

@serhiy-storchaka
Copy link
Copy Markdown
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.
Co-Authored-By: Xtreak <tir.karthi@gmail.com>
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

6 participants