summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen Demeyer <jeroen.k.demeyer@gmail.com>2020-02-18 13:14:46 (GMT)
committerGitHub <noreply@github.com>2020-02-18 13:14:46 (GMT)
commit24bba8cf5b8db25c19bcd1d94e8e356874d1c723 (patch)
tree66da76634598a2a6bc47792cb38019adea634290
parent5d38517aa1836542a5417b724c093bcb245f0f47 (diff)
downloadcpython-24bba8cf5b8db25c19bcd1d94e8e356874d1c723.zip
cpython-24bba8cf5b8db25c19bcd1d94e8e356874d1c723.tar.gz
cpython-24bba8cf5b8db25c19bcd1d94e8e356874d1c723.tar.bz2
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
-rw-r--r--Objects/classobject.c6
-rw-r--r--Objects/funcobject.c10
-rw-r--r--Objects/methodobject.c2
3 files changed, 8 insertions, 10 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 97f50fa..999b91c 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -145,9 +145,9 @@ static PyMethodDef method_methods[] = {
#define MO_OFF(x) offsetof(PyMethodObject, x)
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"},
- {"__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"},
{NULL} /* Sentinel */
};
@@ -400,7 +400,7 @@ PyInstanceMethod_Function(PyObject *im)
#define IMO_OFF(x) offsetof(PyInstanceMethodObject, x)
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"},
{NULL} /* Sentinel */
};
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 419db33..3ec949d 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -239,12 +239,10 @@ PyFunction_SetAnnotations(PyObject *op, PyObject *annotations)
#define OFF(x) offsetof(PyFunctionObject, x)
static PyMemberDef func_memberlist[] = {
- {"__closure__", T_OBJECT, OFF(func_closure),
- RESTRICTED|READONLY},
- {"__doc__", T_OBJECT, OFF(func_doc), PY_WRITE_RESTRICTED},
- {"__globals__", T_OBJECT, OFF(func_globals),
- RESTRICTED|READONLY},
- {"__module__", T_OBJECT, OFF(func_module), PY_WRITE_RESTRICTED},
+ {"__closure__", T_OBJECT, OFF(func_closure), READONLY},
+ {"__doc__", T_OBJECT, OFF(func_doc), 0},
+ {"__globals__", T_OBJECT, OFF(func_globals), READONLY},
+ {"__module__", T_OBJECT, OFF(func_module), 0},
{NULL} /* Sentinel */
};
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 1d54c4c..0d45705 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -222,7 +222,7 @@ static PyGetSetDef meth_getsets [] = {
#define OFF(x) offsetof(PyCFunctionObject, x)
static PyMemberDef meth_members[] = {
- {"__module__", T_OBJECT, OFF(m_module), PY_WRITE_RESTRICTED},
+ {"__module__", T_OBJECT, OFF(m_module), 0},
{NULL}
};