mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
do safety checks on __qualname__ assignment
This commit is contained in:
parent
8afa7fa510
commit
2c05a2e01b
3 changed files with 13 additions and 0 deletions
|
@ -311,6 +311,8 @@ type_set_qualname(PyTypeObject *type, PyObject *value, void *context)
|
|||
{
|
||||
PyHeapTypeObject* et;
|
||||
|
||||
if (!check_set_special_type_attr(type, value, "__qualname__"))
|
||||
return -1;
|
||||
if (!PyUnicode_Check(value)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"can only assign string to %s.__qualname__, not '%s'",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue