| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
also validate in the tests that ListProxy has all MutableSequence methods and DictProxy has all MutableMapping methods.
|
I think it's fine that ListProxy doesn't have __iter__ when it comes to the ABC registration. The important thing is really that ListProxy is iterable, and it is; it's not really any less of a MutableSequence because of the fact that it uses the old-style iteration protocol rather than the new one. |
Sorry, something went wrong.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
Yeah, I agree. I had thought it would be free to add it, at which point we might as well. But it's not bad to not have it. |
Sorry, something went wrong.
There was a problem hiding this comment.
This seems fine to me. It's not ideal to hardcode the method names in the test -- but it also is probably more trouble than it's worth to try to figure them out dynamically in the test; it's obviously good to keep tests as simple as possible. And it seems pretty unlikely that methods will be added or removed from these ABCs anytime soon, so it's not a massive problem to just hardcode the names.
Sorry, something went wrong.
…ythonGH-126454) Checks that appropriate dunder __ methods exist on the dict and list proxy types. (cherry picked from commit 6ee542d) Co-authored-by: Stephen Morton <git@tungol.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
GH-126674 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
…ythonGH-126454) Checks that appropriate dunder __ methods exist on the dict and list proxy types. (cherry picked from commit 6ee542d) Co-authored-by: Stephen Morton <git@tungol.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
GH-126675 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
…ython#126454) Checks that appropriate dunder __ methods exist on the dict and list proxy types. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
…ython#126454) Checks that appropriate dunder __ methods exist on the dict and list proxy types. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
| Back | FazBrowse Home | New Git URL |
In a similar situation, @JelleZijlstra asked about making sure all the relevant methods existed for contextvars.Context being registered to Mapping: #126451 (comment)
After that, I circled back to do the same for ListProxy and DictProxy. DictProxy already had everything it needed, but ListProxy is missing __iter__. In the original version of this MR I added it, but that caused a test failure in test_list_iter.
When __iter__ is proxied, iter(mylist) returns a list_iterator object. That behaves differently in some situations than the iterator object currently returned; Seems like it doesn't pick up the modification during iteration that test_list_iter checks for. Because of that, I changed this MR to just the test improvement. I think some custom methods would be needed to add __iter__ to ListProxy without changing the behavior.