Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-103763: Implement PEP 695#103764
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
Uh oh!
There was an error while loading. Please reload this page.
gh-103763: Implement PEP 695 #103764
Changes from all commits
9c8cd71609ac0d7a5e4571e0b74c2a5023a1bc8574ed42796d06f43d830b36ab6bf2bc6bb4795c7c1618772920f6ff6f5a9fdf373f7c513d1d7b03585a440955d0fd9618e173bef978f3cd026ab12663dbb9c43c037ddfaa62f0c29c7a153aa8ea68ab6b718dba4293e36c5f521e1b1a8505134338b97804bc911521bd81f2d91b0ccf68d96159d75d9c0d90d26b82a423d2defdd88772461ed5e9a196f536cf13c0b04e359e6fa05521c7db9d8fbbf3340c2b5de372fa81c017aeee08a7e6bcbfe8445834c024dd9ec56e6ab8b1ed916974b38dea48991bb1c3f520ae668ed82b844f447d24d98ad0b5b6312d7b48e23b0dec31ae062999c9147a4a1b043c816cb6a51bdfb75308c7c1ff22d22c4ce394f02199f3fe019b737d96a6fe947680a9efb21b3aec30487a51575c66a6045f02c8b4f166851e6be059c1ac7f7220f70925e17c3b045696ae02e0a8a7a8fc1471951625fbd4d5f86be9c77b3807f448248d32bc6127a8a4c44b9222445a39b7fa37b4880f0663d8e24e74c1a0dd5b86c53b6098d9632c028a0ecb70bb175a5e4ec0e12d30046c3f65a84a00cee0acb87d77c4fbea66c7cb314a3f2e913ca394d128bd49622bf45a8ece7fe9ce5a6c2196324a5fd0f7b4e784da172fc40c4b6a81593a4552b36b7afa85fb6c645402621667d9e65d668e0a0b04d5c44f5ce6a9902fc9cc73f719110891a6178a9ba2c0b45e116a037fc5d93780399ed4782fc35a0928960241da55b3a20478f3f4b9d3177bc52179cd0fa718f0936de5259096c3d6464f58058317c8060f4ea50043bcd02827b9e571cef7880ffbf3e7863822a8f0ef967f1004cbbd248dfb93d43f02700b35c6ca2f3c75c51b9fc047abba51a46555e68cd83b63b76281f575a3cd2e7a4f607688ac5dc32fc89c02f1fca249ca43645b08b17c30f60067e0039ace71a1c59f7f7e62198f54b02bb2df61fdf65ad4fecf7df8406cefd4fe5c0b94580e952d61785dd45be70e3c92c29e7529c74d531fcf7497e22abfb5ac0a1be61d1e9273cbc375793817ab4f2a93934f1223ed49025133f4c12b9f4540a64922f8a783b39e6658a0aad1f4a22a08f1328c757d6016e1401209e049f5ac4d9ec4b93f85ef412f49d4e72a508d931cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Why are all these classes stored on the interpreter?
Can't they be made static and shareable?
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.
Generic needs to be used with multiple inheritance; when I used it with static types that didn't work. If you feel strongly that we need static types I can try again.
Also, thanks for the review! I'll probably not have time to push code changes until tonight, but will post some replies.
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.
That is unfortunate. I do think they should be static classes.
However, if we need to fix how inheritance is implemented first, then no need to do it in this PR.
Can you remember and summarize what the problem was?
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.
As I recall, it just didn't work; I got errors from fairly normal usage like
class X[T](Base):(which needs to double-inherit from Base and Generic).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.
Any recollection as to what the error messages were?
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.
No, sorry. I can try it out tonight.
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.
I actually misremembered; the failures were a bit less basic: they had to do with the inheritance of
__new__. I went back to commit b38dea4, before I made Generic a heap type. There were several test failures intest_typing:test_new_calledcpython/Lib/test/test_typing.py
Line 3175 in 7d2deaf
test_no_instantiationcpython/Lib/test/test_typing.py
Line 2463 in 7d2deaf
A heap type allowed me to simply omit
__new__and have it be inherited like a normal Python class. With a static type withouttp_new, the class would not be instantiable, and if I had it set toPyType_GenericNew,super().__new__wouldn't be called correctly.There were also some issues with pickling, but those should have been fixable.