| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
Looks sensible to me. |
Sorry, something went wrong.
There was a problem hiding this comment.
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.
|
@encukou: Please review my updated PR. I modified my PR to check __mro__ instead of __bases__. I also rebased the PR on the main branch to fix some merge conflicts. |
Sorry, something went wrong.
There was a problem hiding this comment.
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.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
I created capi-workgroup/decisions#40 |
Sorry, something went wrong.
|
@zooba: I added to the doc:
Is it what you expected? |
Sorry, something went wrong.
|
@encukou @serhiy-storchaka: Would you mind to review my PyType_Freeze() implementation? |
Sorry, something went wrong.
Sorry, something went wrong.
|
@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.
| 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.
How difficult to add test for this case?
Sorry, something went wrong.
There was a problem hiding this comment.
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.
|
Merged. Thanks for reviews. |
Sorry, something went wrong.
|
Thanks Victor. I'll look at using this after the next CPython release |
Sorry, something went wrong.
|
I mean technically you can use it now if you manually build the main branch. |
Sorry, something went wrong.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
| i = 1; | ||
| } | ||
| for (; i<PyTuple_GET_SIZE(bases); i++) { | ||
| PyTypeObject *b = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); |
There was a problem hiding this comment.
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 a problem hiding this comment.
I don't know, I just moved the code. The test was already there before.
Sorry, something went wrong.
There was a problem hiding this comment.
Got it, thanks!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
📚 Documentation preview 📚: https://cpython-previews--122457.org.readthedocs.build/