-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Update _dill.py
to use co_linetable
for Python 3.10+ in place of co_lnotab
#7609
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
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Pull Request Overview
This PR updates the handling of code object line information to address the deprecation of co_lnotab in Python 3.10+ by conditionally using an alternative attribute.
- Replace co_lnotab with co_linetable in multiple functions.
- Remove deprecation warnings in Python 3.12 by conditionally checking sys.version_info.
Comments suppressed due to low confidence (1)
src/datasets/utils/_dill.py:272
- The PR title mentions using 'co_lines' instead of 'co_lnotab', but the changes use 'co_linetable'. Please verify that 'co_linetable' is the intended attribute for Python 3.10+ to ensure consistency with the proposed update.
obj.co_linetable if sys.version_info >= (3, 10) else obj.co_lnotab,
not 100% sure either, I tried removing unnecessary checks - let me know if they sound good to you otherwise I'll revert |
_dill.py
to use co_lines
for Python 3.10+ in place of co_lnotab
_dill.py
to use co_linetable
for Python 3.10+ in place of co_lnotab
I can't reproduce the warning anymore... 🤦🏻♂️ |
Ah now I can reproduce!, and I can confirm that the warning is gone when you apply the change in this PR |
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 !
Not 100% about this one, but it seems to be recommended.
Tests pass locally. And the warning is gone with this change.
https://peps.python.org/pep-0626/#backwards-compatibility