mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
gh-119180: Disallow instantiation of ConstEvaluator objects (#124561)
This commit is contained in:
parent
ffdc80e93d
commit
0268b072d8
2 changed files with 14 additions and 2 deletions
|
@ -151,7 +151,7 @@ constevaluator_clear(PyObject *self)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
constevaluator_repr(PyObject *self, PyObject *repr)
|
||||
constevaluator_repr(PyObject *self)
|
||||
{
|
||||
PyObject *value = ((constevaluatorobject *)self)->value;
|
||||
return PyUnicode_FromFormat("<constevaluator %R>", value);
|
||||
|
@ -242,7 +242,8 @@ static PyType_Slot constevaluator_slots[] = {
|
|||
PyType_Spec constevaluator_spec = {
|
||||
.name = "_typing._ConstEvaluator",
|
||||
.basicsize = sizeof(constevaluatorobject),
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE,
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
|
||||
| Py_TPFLAGS_DISALLOW_INSTANTIATION,
|
||||
.slots = constevaluator_slots,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue