Remove @deleter from setters which check for NULL themselves · python/cpython@b9f90ae · GitHub
Skip to content

Commit b9f90ae

Browse files
Remove @deleter from setters which check for NULL themselves
They raised AttributeError for deletion, and this is now done by the generated code.
1 parent 8d93465 commit b9f90ae

8 files changed

Lines changed: 53 additions & 46 deletions

File tree

Modules/_asynciomodule.c

Lines changed: 4 additions & 24 deletions

Modules/_ctypes/_ctypes.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,22 +1481,17 @@ class _ctypes.PyCArrayType_Type "CDataObject *" "clinic_state()->PyCArrayType_Ty
14811481
/*[clinic input]
14821482
@critical_section
14831483
@setter
1484-
@deleter
14851484
_ctypes.PyCArrayType_Type.raw
14861485
[clinic start generated code]*/
14871486

14881487
static int
14891488
_ctypes_PyCArrayType_Type_raw_set_impl(CDataObject *self, PyObject *value)
1490-
/*[clinic end generated code: output=cf9b2a9fd92e9ecb input=13881e1662127207]*/
1489+
/*[clinic end generated code: output=cf9b2a9fd92e9ecb input=a3717561efc45efd]*/
14911490
{
14921491
char *ptr;
14931492
Py_ssize_t size;
14941493
Py_buffer view;
14951494

1496-
if (value == NULL) {
1497-
PyErr_SetString(PyExc_AttributeError, "cannot delete attribute");
1498-
return -1;
1499-
}
15001495
if (PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) < 0)
15011496
return -1;
15021497
size = view.len;

Modules/_ctypes/clinic/_ctypes.c.h

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/textio.c.h

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/textio.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,20 +3399,15 @@ _io_TextIOWrapper__CHUNK_SIZE_get_impl(textio *self)
33993399
/*[clinic input]
34003400
@critical_section
34013401
@setter
3402-
@deleter
34033402
_io.TextIOWrapper._CHUNK_SIZE
34043403
[clinic start generated code]*/
34053404

34063405
static int
34073406
_io_TextIOWrapper__CHUNK_SIZE_set_impl(textio *self, PyObject *value)
3408-
/*[clinic end generated code: output=edb86d2db660a5ab input=e7c44a734efeddc3]*/
3407+
/*[clinic end generated code: output=edb86d2db660a5ab input=32fc99861db02a0a]*/
34093408
{
34103409
Py_ssize_t n;
34113410
CHECK_ATTACHED_INT(self);
3412-
if (value == NULL) {
3413-
PyErr_SetString(PyExc_AttributeError, "cannot delete attribute");
3414-
return -1;
3415-
}
34163411
n = PyNumber_AsSsize_t(value, PyExc_ValueError);
34173412
if (n == -1 && PyErr_Occurred())
34183413
return -1;

Modules/clinic/_asynciomodule.c.h

Lines changed: 25 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/clinic/frameobject.c.h

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/frameobject.c

Lines changed: 1 addition & 6 deletions

0 commit comments

Comments
 (0)