-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. #17773
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
This uses the heuristic of assuming a named tuple is a subclass of tuple with a _fields attribute. This change means that contents of a named tuple wouldn't be converted - if a user wants to have ConvertingTuple functionality from a namedtuple, they will have to implement it themselves.
@tirkarthi - I would appreciate any comments you might have on this PR. Thanks for the analysis on the issue. |
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.
Just comment:
We don't have to care structseq
type in this issue?
I would say not, because it's easy and common to create a |
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.
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.
@vsajip Thanks for the explanation :)
LGTM
Thanks @vsajip for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
GH-17785 is a backport of this pull request to the 3.8 branch. |
Thanks @vsajip for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
GH-17786 is a backport of this pull request to the 3.7 branch. |
…ythonGH-17773) This uses the heuristic of assuming a named tuple is a subclass of tuple with a _fields attribute. This change means that contents of a named tuple wouldn't be converted - if a user wants to have ConvertingTuple functionality from a namedtuple, they will have to implement it themselves. (cherry picked from commit 46abfc1) Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
|
…ythonGH-17773) This uses the heuristic of assuming a named tuple is a subclass of tuple with a _fields attribute. This change means that contents of a named tuple wouldn't be converted - if a user wants to have ConvertingTuple functionality from a namedtuple, they will have to implement it themselves.
This uses the heuristic of assuming a named tuple is a subclass of
tuple with a _fields attribute. This change means that contents of
a named tuple wouldn't be converted - if a user wants to have
ConvertingTuple functionality from a namedtuple, they will have to
implement it themselves.
https://bugs.python.org/issue39142