aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index d7fcb1925d2..64fded85de1 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -638,6 +638,23 @@ framelocalsproxy_setdefault(PyObject* self, PyObject *const *args, Py_ssize_t na
}
static PyObject*
+framelocalsproxy_copy(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+ PyObject* result = PyDict_New();
+
+ if (result == NULL) {
+ return NULL;
+ }
+
+ if (PyDict_Update(result, self) < 0) {
+ Py_DECREF(result);
+ return NULL;
+ }
+
+ return result;
+}
+
+static PyObject*
framelocalsproxy_reversed(PyObject *self, void *Py_UNUSED(ignored))
{
PyObject *result = framelocalsproxy_keys(self, NULL);
@@ -677,6 +694,8 @@ static PyMethodDef framelocalsproxy_methods[] = {
NULL},
{"__reversed__", _PyCFunction_CAST(framelocalsproxy_reversed), METH_NOARGS,
NULL},
+ {"copy", _PyCFunction_CAST(framelocalsproxy_copy), METH_NOARGS,
+ NULL},
{"keys", _PyCFunction_CAST(framelocalsproxy_keys), METH_NOARGS,
NULL},
{"values", _PyCFunction_CAST(framelocalsproxy_values), METH_NOARGS,