Skip to content

Commit 8da2f02

Browse files
committed
Revert mistaken change.
1 parent cb462a0 commit 8da2f02

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

Objects/funcobject.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ PyFunction_SetAnnotations(PyObject *op, PyObject *annotations)
246246
#define OFF(x) offsetof(PyFunctionObject, x)
247247

248248
static PyMemberDef func_memberlist[] = {
249+
{"__closure__", T_OBJECT, OFF(func_descr.closure), READONLY},
249250
{"__doc__", T_OBJECT, OFF(func_doc), 0},
250251
{"__globals__", T_OBJECT, OFF(func_descr.globals), READONLY},
251252
{"__module__", T_OBJECT, OFF(func_module), 0},
@@ -263,19 +264,6 @@ func_get_code(PyFunctionObject *op, void *Py_UNUSED(ignored))
263264
return op->func_descr.code;
264265
}
265266

266-
static PyObject *
267-
func_get_closure(PyFunctionObject *op, void *Py_UNUSED(ignored))
268-
{
269-
if (PySys_Audit("object.__getattr__", "Os", op, "__closure__") < 0) {
270-
return NULL;
271-
}
272-
if (op->func_descr.closure == NULL) {
273-
Py_RETURN_NONE;
274-
}
275-
Py_INCREF(op->func_descr.closure);
276-
return op->func_descr.closure;
277-
}
278-
279267
static int
280268
func_set_code(PyFunctionObject *op, PyObject *value, void *Py_UNUSED(ignored))
281269
{
@@ -485,7 +473,6 @@ func_set_annotations(PyFunctionObject *op, PyObject *value, void *Py_UNUSED(igno
485473
}
486474

487475
static PyGetSetDef func_getsetlist[] = {
488-
{"__closure__", (getter)func_get_closure, NULL},
489476
{"__code__", (getter)func_get_code, (setter)func_set_code},
490477
{"__defaults__", (getter)func_get_defaults,
491478
(setter)func_set_defaults},

0 commit comments

Comments
 (0)