8000 gh-117482: Simplify the Fix For Builtin Types Slot Wrappers by ericsnowcurrently · Pull Request #122865 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117482: Simplify the Fix For Builtin Types Slot Wrappers #122865

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

Prev Previous commit
Next Next commit
Fix tp_init.
  • Loading branch information
ericsnowcurrently committed Aug 9, 2024
commit 7d635f5b35b1954645364d7d7218bd55f39c4975
35 changes: 1 addition & 34 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -11050,40 +11050,7 @@ static int
expect_manually_inherited(PyTypeObject *type, void **slot)
{
PyObject *typeobj = (PyObject *)type;
if (slot == (void *)&type->tp_init) {
/* This is a best-effort list of builtin exception types
that have their own tp_init function. */
if (typeobj != PyExc_BaseException
&& typeobj != PyExc_BaseExceptionGroup
&& typeobj != PyExc_ImportError
&& typeobj != PyExc_NameError
&& typeobj != PyExc_OSError
&& typeobj != PyExc_StopIteration
&& typeobj != PyExc_SyntaxError
&& typeobj != PyExc_UnicodeDecodeError
&& typeobj != PyExc_UnicodeEncodeError

&& type != &PyBool_Type
&& type != &PyMemoryView_Type
&& type != &PyBytes_Type
&& type != &PyComplex_Type
&& type != &PyEnum_Type
&& type != &PyFilter_Type
&& type != &PyFloat_Type
&& type != &PyFrozenSet_Type
&& type != &PyLong_Type
&& type != &PyMap_Type
&& type != &PyRange_Type
&& type != &PyReversed_Type
&& type != &PySlice_Type
&& type != &PyUnicode_Type
&& type != &PyTuple_Type
&& type != &PyZip_Type)
{
return 1;
}
}
else if (slot == (void *)&type->tp_str) {
if (slot == (void *)&type->tp_str) {
/* This is a best-effort list of builtin exception types
that have their own tp_str function. */
if (typeobj == PyExc_AttributeError || typeobj == PyExc_NameError) {
Expand Down
Loading
0