bpo-40169: Make dis.findlabels() accept a code object#19356
Conversation
|
Kindly ping...@serhiy-storchaka |
remilapeyre
left a comment
There was a problem hiding this comment.
Hi @laike9m, thinks for improving dis! I don't think this is the correct change thought, dis.findlabels(f.__code__.co_code) used to work but does not anymore. I think a more appropriate change would be to handle both code object and byte code, a way would be:
if hasattr(code, 'co_code'):
code = code.co_code
elif not isinstance(code, bytes):
raise TypeError(...)
A test with jumpy.__code__.co_code would be great too!
|
Thanks Remi. I know the function was intended to take a code object because the doc explicitly says that before I fixed it to match the current behavior. I can change the code as you suggested. Do I need to get @serhiy-storchaka's approve before making the change? Cause I assume he owns this part. |
Yes, but since it used to take bytes (even thought it was not documented that way) it means that users wrote code that way and they expect it to keep working. Breaking that would need a deprecation period.
As you wish, you will need his approval either way. |
|
This PR is stale because it has been open for 30 days with no activity. |
https://bugs.python.org/issue40169
Reasoning:
dishas always been "it accepts a code object".dismodule, which all accept a code object instead of raw byte code string.