GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-121654: Add PyType_Freeze() function by vstinner · Pull Request #122457 · python/cpython Conversation
|
|
Looks sensible to me. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It'll take me some time to review this in depth, unfortunately.
Here are some initial thoughts for what I'd want to check.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@encukou: Please review my updated PR. I modified my PR to check I also rebased the PR on the main branch to fix some merge conflicts. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
I have a few suggestions, and the C API WG should vote on new stable API, but I hope those are just formalities.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
I created capi-workgroup/decisions#40 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@zooba: I added to the doc:
Is it what you expected? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@encukou @serhiy-storchaka: Would you mind to review my PyType_Freeze() implementation? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@encukou @serhiy-storchaka @erlend-aasland @zooba: Would you mind to review this PR? The API was approved by the C API Working Group. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| if (!PyTuple_Check(mro)) { | ||
| Py_DECREF(mro); | ||
| PyErr_SetString(PyExc_TypeError, "unable to get the type MRO"); | ||
| return -1; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How difficult to add test for this case?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that it's possible to create a type with a MRO which is not a tuple. Using a metaclass, it's possible to override the MRO, but internally, Python converts mro() result into a tuple.
I added this check since type_get_mro() returns None if type->tp_mro is NULL. But I have no idea how to create a type with type->tp_mro=NULL. It's more a sanity check.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Merged. Thanks for reviews. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks Victor. I'll look at using this after the next CPython release |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I mean technically you can use it now if you manually build the main branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Petr Viktorin <[email protected]>
| i = 1; | ||
| } | ||
| for (; i<PyTuple_GET_SIZE(bases); i++) { | ||
| PyTypeObject *b = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the necro-posting.
IIUC only improperly constructed tuples can store NULL items. Is this such a case? If so, is the following check redundant?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't know, I just moved the code. The test was already there before.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.