Skip to content

Commit 9d3496f

Browse files
committed
Dispatch events when {kw}defaults are modified via the C-API
1 parent c189528 commit 9d3496f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Objects/funcobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ PyFunction_SetDefaults(PyObject *op, PyObject *defaults)
255255
PyErr_SetString(PyExc_SystemError, "non-tuple default args");
256256
return -1;
257257
}
258+
handle_func_event(PyFunction_EVENT_MODIFY_DEFAULTS, op, NULL);
258259
((PyFunctionObject *)op)->func_version = 0;
259260
Py_XSETREF(((PyFunctionObject *)op)->func_defaults, defaults);
260261
return 0;
@@ -295,6 +296,7 @@ PyFunction_SetKwDefaults(PyObject *op, PyObject *defaults)
295296
"non-dict keyword only default args");
296297
return -1;
297298
}
299+
handle_func_event(PyFunction_EVENT_MODIFY_KWDEFAULTS, op, NULL);
298300
((PyFunctionObject *)op)->func_version = 0;
299301
Py_XSETREF(((PyFunctionObject *)op)->func_kwdefaults, defaults);
300302
return 0;

0 commit comments

Comments
 (0)