-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Fix PyPy ClassDef.fromlino
with decorators
#1979
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
from astroid import bases | ||
from astroid import decorators as decorators_mod | ||
from astroid import util | ||
from astroid.const import IS_PYPY, PY38, PY38_PLUS, PY39_PLUS | ||
from astroid.const import IS_PYPY, PY38, PY38_PLUS, PY39_PLUS, PYPY_7_3_11_PLUS | ||
from astroid.context import ( | ||
CallContext, | ||
InferenceContext, | ||
|
@@ -2139,9 +2139,10 @@ def _newstyle_impl(self, context: InferenceContext | None = None): | |
@cached_property | ||
def fromlineno(self) -> int | None: | ||
"""The first line that this node appears on in the source code.""" | ||
if not PY38_PLUS or PY38 and IS_PYPY: | ||
if not PY38_PLUS or IS_PYPY and PY38 and not PYPY_7_3_11_PLUS: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to support multiple PyPy versions? I guess it's simple enough here, although I wouldn't add any more to CI. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feel like a lot of work but also added values. I guess on a case by case basis... ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, I was more referring to this specific case 😄 |
||
# For Python < 3.8 the lineno is the line number of the first decorator. | ||
# We want the class statement lineno. Similar to 'FunctionDef.fromlineno' | ||
# PyPy (3.8): Fixed with version v7.3.11 | ||
lineno = self.lineno | ||
if self.decorators is not None: | ||
lineno += sum( | ||
|
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 can move this to
2.14.0
if we want to skip2.13.4
.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.
Let's not skip, releasing is cheap (compared to fixing the milestones)