mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-35504: Fix a SystemError when delete the characters_written attribute of an OSError. (GH-11172)
This commit is contained in:
parent
fae95874b7
commit
e2af34fcf8
3 changed files with 14 additions and 0 deletions
|
@ -1196,6 +1196,14 @@ OSError_written_get(PyOSErrorObject *self, void *context)
|
|||
static int
|
||||
OSError_written_set(PyOSErrorObject *self, PyObject *arg, void *context)
|
||||
{
|
||||
if (arg == NULL) {
|
||||
if (self->written == -1) {
|
||||
PyErr_SetString(PyExc_AttributeError, "characters_written");
|
||||
return -1;
|
||||
}
|
||||
self->written = -1;
|
||||
return 0;
|
||||
}
|
||||
Py_ssize_t n;
|
||||
n = PyNumber_AsSsize_t(arg, PyExc_ValueError);
|
||||
if (n == -1 && PyErr_Occurred())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue