-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
gh-91389: Fix show_caches in dis module #32406
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
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.
Thanks! A few notes:
- Please sign the CLA (you've probably seen the bot's message by now).
- This needs a NEWS entry. Something simple like "
Fix an issue where passing ``show_caches=True`` to :mod:`dis` utilities could result in incorrect position information.
" should be fine. - It also needs at least one regression test in
Lib/test/test_dis.py
that fails before this change and passes after. - You can also add your name to
Misc/ACKS
, if you want. 😎
Let me know if you have any questions.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
I have made the requested changes; please review again |
Thanks for making the requested changes! @brandtbucher: please review the changes made to this pull request. |
Please don't merge. I want to improve the unit test. |
963afcc
to
3fd5c3e
Compare
I changed the unit test. What do you think @brandtbucher ? |
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.
Almost there... just a couple of naming/formatting improvements:
Lib/test/test_dis.py
Outdated
if x: | ||
c=5 | ||
|
||
def getInstructions(show_caches): |
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.
def getInstructions(show_caches): | |
def get_instructions(show_caches): |
Lib/test/test_dis.py
Outdated
if instr.opname != "CACHE" | ||
] | ||
|
||
self.assertEqual(getInstructions(True),getInstructions(False)) |
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.
self.assertEqual(getInstructions(True),getInstructions(False)) | |
self.assertEqual(get_instructions(True), get_instructions(False)) |
Lib/test/test_dis.py
Outdated
a.b.c(1*x) | ||
if x: | ||
c=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.
a.b.c(1*x) | |
if x: | |
c=5 | |
a.b.c(1 * x) | |
if x: | |
c = 5 |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
3fd5c3e
to
82e0ecb
Compare
The following commit authors need to sign the Contributor License Agreement: |
I have made the requested changes; please review again |
Thanks for making the requested changes! @brandtbucher: please review the changes made to this pull request. |
@15r10nk, can you re-sign the CLA using your polarbit.de address? If the CLA bot doesn't let you, please add this email to your Github emails in settings. If you click on the list of commits in this PR now, you will see that the author of the commit is listed as "Frank Hoffmann" and doesn't link back to your profile. |
@@ -413,6 +413,9 @@ def _get_instructions_bytes(code, varname_from_oparg=None, | |||
labels.add(target) | |||
starts_line = None | |||
for offset, op, arg in _unpack_opargs(code): | |||
# get the next position before we skip a CACHE instruction | |||
# to associate the correct position information. |
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.
Also, the CI is mad about this trailing whitespace. Didn't see it until now:
# to associate the correct position information. | |
# to associate the correct position information. |
Yes, I will do, unfortunately not before next week Wednesday. |
It seems that I was to late :-). |
https://bugs.python.org/issue47233