mirror of https://github.com/python/cpython
bpo-36347: stop using RESTRICTED constants (GH-12684)
The constants `RESTRICTED` and `PY_WRITE_RESTRICTED` no longer have a meaning in Python 3. Therefore, CPython should not use them. CC @matrixise https://bugs.python.org/issue36347
This commit is contained in:
parent
5d38517aa1
commit
24bba8cf5b
|
@ -145,9 +145,9 @@ static PyMethodDef method_methods[] = {
|
||||||
#define MO_OFF(x) offsetof(PyMethodObject, x)
|
#define MO_OFF(x) offsetof(PyMethodObject, x)
|
||||||
|
|
||||||
static PyMemberDef method_memberlist[] = {
|
static PyMemberDef method_memberlist[] = {
|
||||||
{"__func__", T_OBJECT, MO_OFF(im_func), READONLY|RESTRICTED,
|
{"__func__", T_OBJECT, MO_OFF(im_func), READONLY,
|
||||||
"the function (or other callable) implementing a method"},
|
"the function (or other callable) implementing a method"},
|
||||||
{"__self__", T_OBJECT, MO_OFF(im_self), READONLY|RESTRICTED,
|
{"__self__", T_OBJECT, MO_OFF(im_self), READONLY,
|
||||||
"the instance to which a method is bound"},
|
"the instance to which a method is bound"},
|
||||||
{NULL} /* Sentinel */
|
{NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
@ -400,7 +400,7 @@ PyInstanceMethod_Function(PyObject *im)
|
||||||
#define IMO_OFF(x) offsetof(PyInstanceMethodObject, x)
|
#define IMO_OFF(x) offsetof(PyInstanceMethodObject, x)
|
||||||
|
|
||||||
static PyMemberDef instancemethod_memberlist[] = {
|
static PyMemberDef instancemethod_memberlist[] = {
|
||||||
{"__func__", T_OBJECT, IMO_OFF(func), READONLY|RESTRICTED,
|
{"__func__", T_OBJECT, IMO_OFF(func), READONLY,
|
||||||
"the function (or other callable) implementing a method"},
|
"the function (or other callable) implementing a method"},
|
||||||
{NULL} /* Sentinel */
|
{NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
|
@ -239,12 +239,10 @@ PyFunction_SetAnnotations(PyObject *op, PyObject *annotations)
|
||||||
#define OFF(x) offsetof(PyFunctionObject, x)
|
#define OFF(x) offsetof(PyFunctionObject, x)
|
||||||
|
|
||||||
static PyMemberDef func_memberlist[] = {
|
static PyMemberDef func_memberlist[] = {
|
||||||
{"__closure__", T_OBJECT, OFF(func_closure),
|
{"__closure__", T_OBJECT, OFF(func_closure), READONLY},
|
||||||
RESTRICTED|READONLY},
|
{"__doc__", T_OBJECT, OFF(func_doc), 0},
|
||||||
{"__doc__", T_OBJECT, OFF(func_doc), PY_WRITE_RESTRICTED},
|
{"__globals__", T_OBJECT, OFF(func_globals), READONLY},
|
||||||
{"__globals__", T_OBJECT, OFF(func_globals),
|
{"__module__", T_OBJECT, OFF(func_module), 0},
|
||||||
RESTRICTED|READONLY},
|
|
||||||
{"__module__", T_OBJECT, OFF(func_module), PY_WRITE_RESTRICTED},
|
|
||||||
{NULL} /* Sentinel */
|
{NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ static PyGetSetDef meth_getsets [] = {
|
||||||
#define OFF(x) offsetof(PyCFunctionObject, x)
|
#define OFF(x) offsetof(PyCFunctionObject, x)
|
||||||
|
|
||||||
static PyMemberDef meth_members[] = {
|
static PyMemberDef meth_members[] = {
|
||||||
{"__module__", T_OBJECT, OFF(m_module), PY_WRITE_RESTRICTED},
|
{"__module__", T_OBJECT, OFF(m_module), 0},
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue