bpo-46333: Honor module parameter in ForwardRef#30536
Conversation
The `module` parameter carries semantic information about the forward ref. Forward refs are different if they refer to different module even if they have same name. This affects __eq__, __repr__ and __hash__ and methods.
This comment was marked as resolved.
This comment was marked as resolved.
AlexWaygood
left a comment
There was a problem hiding this comment.
Welcome to CPython! You can add a NEWS entry to your PR using https://blurb-it.herokuapp.com/ :)
Sorry, something went wrong.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
Since this is your first contribution, you should also feel free to add your name to https://github.com/python/cpython/blob/main/Misc/ACKS (this is entirely optional, only if you'd like to). |
Sorry, something went wrong.
@gvanrossum Sure. Leave it to me. |
Sorry, something went wrong.
Fidget-Spinner
left a comment
There was a problem hiding this comment.
Great work! We're almost ready to merge, I just have some minor concerns.
Sorry, something went wrong.
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
|
@Fidget-Spinner, do you see this one as more of a bugfix that should be backported, or more of an enhancement/behaviour change? (This is just for my clarification, @aha79 — I'm fairly new to the triage team 🙂) |
Sorry, something went wrong.
@AlexWaygood this is a grey area. On one hand, generally, anything dealing with However, this specific I'm inclined to accept the PR without the |
Sorry, something went wrong.
Thanks, that's really clarifying! It might be worth noting that @sobolevn proposes in #29158 (not yet merged) to use the |
Sorry, something went wrong.
|
Btw @aha79 — could I ask if you've signed the CLA? For legal reasons, it may be difficult for CPython to merge a PR from you if you haven't 🙂 |
Sorry, something went wrong.
Yes, sorry. I completely understand that. I clarify with my organization (This will be ok, but may take a few more days) |
Sorry, something went wrong.
Of course! No rush :) |
Sorry, something went wrong.
@AlexWaygood The CLA is now signed. Sorry that it took a while. |
Sorry, something went wrong.
Thanks, no worries!
To me it makes sense to split off the Fidget-Spinner is currently on a break from open source — @JelleZijlstra, if you've got the time, do you have any thoughts on this PR? |
Sorry, something went wrong.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
There were already tests for |
Sorry, something went wrong.
|
Sorry, I think I was unclear — my bad :) We now have two test methods for testing cpython/Lib/test/test_typing.py Line 2648 in 9dd2f8f Could you move the new tests for |
Sorry, something went wrong.
I didn't mean to imply otherwise! |
Sorry, something went wrong.
Sorry I misunderstood. I move/adapted the tests to the right place |
Sorry, something went wrong.
|
@gvanrossum could we possibly get the full test suite run on this PR, please? :) |
Sorry, something went wrong.
Looks that way to me :) |
Sorry, something went wrong.
|
Yes I think it's good. It can wait though, hopefully I can merge it myself next week :) |
Sorry, something went wrong.
|
Thanks @aha79 for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
Sorry, something went wrong.
The `module` parameter carries semantic information about the forward ref. Forward refs are different if they refer to different module even if they have the same name. This affects the `__eq__`, `__repr__` and `__hash__` methods. Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> (cherry picked from commit 6e7b813) Co-authored-by: aha79 <34090357+aha79@users.noreply.github.com>
The `module` parameter carries semantic information about the forward ref. Forward refs are different if they refer to different module even if they have the same name. This affects the `__eq__`, `__repr__` and `__hash__` methods. Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> (cherry picked from commit 6e7b813) Co-authored-by: aha79 <34090357+aha79@users.noreply.github.com>
…H-31379) The `module` parameter carries semantic information about the forward ref. Forward refs are different if they refer to different module even if they have the same name. This affects the `__eq__`, `__repr__` and `__hash__` methods. Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> (cherry picked from commit 6e7b813) Co-authored-by: aha79 <34090357+aha79@users.noreply.github.com> Automerge-Triggered-By: GH:JelleZijlstra
The `module` parameter carries semantic information about the forward ref. Forward refs are different if they refer to different module even if they have the same name. This affects the `__eq__`, `__repr__` and `__hash__` methods. Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> (cherry picked from commit 6e7b813) Co-authored-by: aha79 <34090357+aha79@users.noreply.github.com>
The `module` parameter carries semantic information about the forward ref. Forward refs are different if they refer to different module even if they have the same name. This affects the `__eq__`, `__repr__` and `__hash__` methods. Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> (cherry picked from commit 6e7b813) Co-authored-by: aha79 <34090357+aha79@users.noreply.github.com>
The
moduleparameter carries semantic information about the forward ref.Forward refs are different if they refer to different module even if they
have same name. This affects eq, repr and hash and methods,
which were previously not honoring the
moduleparameter.https://bugs.python.org/issue46333