diff options
author | chgnrdv <52372310+chgnrdv@users.noreply.github.com> | 2023-05-09 12:41:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-09 12:41:09 (GMT) |
commit | c21f82876089f3e9a7b1e706c029664b799fa659 (patch) | |
tree | 8ecc1c9f58fef7c848ff16953cacc6670649b57f /Modules/_struct.c | |
parent | 85f981880ae9591ba577e44d2945a771078a7c35 (diff) | |
download | cpython-c21f82876089f3e9a7b1e706c029664b799fa659.zip cpython-c21f82876089f3e9a7b1e706c029664b799fa659.tar.gz cpython-c21f82876089f3e9a7b1e706c029664b799fa659.tar.bz2 |
gh-104276: Make `_struct.unpack_iterator` type use type flag instead of custom constructor (#104277)
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r-- | Modules/_struct.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c index 26434f7..4f9478b 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1832,11 +1832,6 @@ unpackiter_iternext(unpackiterobject *self) return result; } -PyObject *unpackiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - PyErr_Format(PyExc_TypeError, "Cannot create '%.200s objects", _PyType_Name(type)); - return NULL; -} - static PyType_Slot unpackiter_type_slots[] = { {Py_tp_dealloc, unpackiter_dealloc}, {Py_tp_getattro, PyObject_GenericGetAttr}, @@ -1844,7 +1839,6 @@ static PyType_Slot unpackiter_type_slots[] = { {Py_tp_iter, PyObject_SelfIter}, {Py_tp_iternext, unpackiter_iternext}, {Py_tp_methods, unpackiter_methods}, - {Py_tp_new, unpackiter_new}, {0, 0}, }; @@ -1853,7 +1847,7 @@ static PyType_Spec unpackiter_type_spec = { sizeof(unpackiterobject), 0, (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_IMMUTABLETYPE), + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION), unpackiter_type_slots }; |