mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
give TypeError when trying to set T_STRING_INPLACE
This commit is contained in:
parent
931190b4f5
commit
1c7c11ef61
4 changed files with 27 additions and 5 deletions
|
@ -172,7 +172,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
|
|||
|
||||
addr += l->offset;
|
||||
|
||||
if ((l->flags & READONLY) || l->type == T_STRING)
|
||||
if ((l->flags & READONLY))
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "readonly attribute");
|
||||
return -1;
|
||||
|
@ -329,6 +329,10 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
|
|||
return -1;
|
||||
}
|
||||
break;
|
||||
case T_STRING:
|
||||
case T_STRING_INPLACE:
|
||||
PyErr_SetString(PyExc_TypeError, "readonly attribute");
|
||||
return -1;
|
||||
#ifdef HAVE_LONG_LONG
|
||||
case T_LONGLONG:{
|
||||
PY_LONG_LONG value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue