Issue37953
Created on 2019-08-26 14:06 by plokmijnuhby, last changed 2020-03-03 22:30 by ned.deily. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 15400 | merged | plokmijnuhby, 2019-08-28 11:56 | |
| PR 15628 | closed | hongweipeng, 2019-08-31 05:03 | |
| PR 15650 | closed | hongweipeng, 2019-09-02 16:26 | |
| PR 16128 | merged | miss-islington, 2019-09-13 19:41 | |
| PR 16133 | merged | ZackerySpytz, 2019-09-14 06:12 | |
| PR 16138 | merged | miss-islington, 2019-09-14 07:44 | |
| PR 18751 | merged | python-dev, 2020-03-02 21:00 | |
| Messages (7) | |||
|---|---|---|---|
| msg350531 - (view) | Author: Dominic Littlewood (plokmijnuhby) * | Date: 2019-08-26 14:06 | |
Apologies for issuing a pull request without an associated issue. I'm kind of new to this. Nevermind, I'm making one now.
The typing module currently contains a bug where ForwardRefs change their hash and equality once they are evaluated. Consider the following code:
import typing
ref = typing.ForwardRef('MyClass')
ref_ = typing.ForwardRef('MyClass')
class MyClass:
def __add__(self, other: ref): ...
# We evaluate one forward reference, but not the other.
typing.get_type_hints(MyClass.__add__)
# Equality is violated
print(ref == ref_) # False
# This can cause duplication in Unions.
# The following prints:
# typing.Union[ForwardRef('MyClass'), ForwardRef('MyClass')]
# when it should be: typing.Union[ForwardRef('MyClass')]
wrong = typing.Union[ref, ref_]
print(wrong)
# The union also does not compare equality properly
should_be_equal = typing.Union[ref]
print(should_be_equal == wrong) # False
# In fact this applies to any generic
print(typing.Callable[[ref],None] == typing.Callable[[ref_],None]) # False
|
|||
| msg352389 - (view) | Author: Ivan Levkivskyi (levkivskyi) * | Date: 2019-09-13 19:41 | |
New changeset e082e7cbe4a934b86f7a07354d97d4e14a9dd46a by Ivan Levkivskyi (plokmijnuhby) in branch 'master': bpo-37953: Fix ForwardRef hash and equality checks (GH-15400) https://github.com/python/cpython/commit/e082e7cbe4a934b86f7a07354d97d4e14a9dd46a |
|||
| msg352391 - (view) | Author: miss-islington (miss-islington) | Date: 2019-09-13 20:00 | |
New changeset e91edfed4214dbae17b8906b5dc7778769aac620 by Miss Islington (bot) in branch '3.8': bpo-37953: Fix ForwardRef hash and equality checks (GH-15400) https://github.com/python/cpython/commit/e91edfed4214dbae17b8906b5dc7778769aac620 |
|||
| msg352413 - (view) | Author: Zackery Spytz (ZackerySpytz) * | Date: 2019-09-14 06:18 | |
There are deprecation warnings in test_typing. ./python -m test test_typing Run tests sequentially 0:00:00 load avg: 0.16 [1/1] test_typing /home/lubuntu2/cpython/Lib/test/test_typing.py:2382: DeprecationWarning: Please use assertEqual instead. self.assertEquals(Union[c1, c1_gth], Union[c1]) /home/lubuntu2/cpython/Lib/test/test_typing.py:2383: DeprecationWarning: Please use assertEqual instead. self.assertEquals(Union[c1, c1_gth, int], Union[c1, int]) == Tests result: SUCCESS == 1 test OK. Total duration: 215 ms Tests result: SUCCESS I've created PR 16133 to fix them. |
|||
| msg352419 - (view) | Author: miss-islington (miss-islington) | Date: 2019-09-14 07:43 | |
New changeset d057b896f97e6d7447b9bf9246770c41cf205299 by Miss Islington (bot) (Zackery Spytz) in branch 'master': bpo-37953: Fix deprecation warnings in test_typing (GH-16133) https://github.com/python/cpython/commit/d057b896f97e6d7447b9bf9246770c41cf205299 |
|||
| msg352421 - (view) | Author: miss-islington (miss-islington) | Date: 2019-09-14 08:02 | |
New changeset 66da347ef0034ad9bddc7fad112025c886249f0d by Miss Islington (bot) in branch '3.8': bpo-37953: Fix deprecation warnings in test_typing (GH-16133) https://github.com/python/cpython/commit/66da347ef0034ad9bddc7fad112025c886249f0d |
|||
| msg363313 - (view) | Author: Ned Deily (ned.deily) * | Date: 2020-03-03 22:29 | |
New changeset 3eff46fc7d2e3c80c4dedba4177782f1fc8ad89b by Ryan Rowe in branch '3.7': bpo-37953: Fix ForwardRef hash and equality checks (GH-15400) (GH-18751) https://github.com/python/cpython/commit/3eff46fc7d2e3c80c4dedba4177782f1fc8ad89b |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-03-03 22:30:18 | ned.deily | set | versions: + Python 3.7, Python 3.8 |
| 2020-03-03 22:29:44 | ned.deily | set | nosy:
+ ned.deily messages: + msg363313 |
| 2020-03-02 21:00:30 | python-dev | set | nosy:
+ python-dev pull_requests: + pull_request18106 |
| 2019-09-14 08:02:23 | miss-islington | set | messages: + msg352421 |
| 2019-09-14 07:44:27 | miss-islington | set | pull_requests: + pull_request15748 |
| 2019-09-14 07:43:02 | miss-islington | set | messages: + msg352419 |
| 2019-09-14 06:18:26 | ZackerySpytz | set | nosy:
+ ZackerySpytz messages: + msg352413 |
| 2019-09-14 06:12:05 | ZackerySpytz | set | pull_requests: + pull_request15745 |
| 2019-09-13 20:05:54 | levkivskyi | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-09-13 20:00:42 | miss-islington | set | nosy:
+ miss-islington messages: + msg352391 |
| 2019-09-13 19:41:05 | miss-islington | set | pull_requests: + pull_request15739 |
| 2019-09-13 19:41:01 | levkivskyi | set | messages: + msg352389 |
| 2019-09-02 16:26:18 | hongweipeng | set | pull_requests: + pull_request15317 |
| 2019-08-31 14:38:17 | gvanrossum | set | nosy:
- gvanrossum |
| 2019-08-31 05:03:02 | hongweipeng | set | pull_requests: + pull_request15296 |
| 2019-08-28 11:56:01 | plokmijnuhby | set | keywords:
+ patch stage: patch review pull_requests: + pull_request15235 |
| 2019-08-26 14:19:53 | SilentGhost | set | nosy:
+ gvanrossum, levkivskyi |
| 2019-08-26 14:06:04 | plokmijnuhby | create | |