From 90d7cbb1b88a672dea9c4187a74b916453b0bae8 Mon Sep 17 00:00:00 2001 From: Jacob Bower Date: Mon, 1 Jul 2024 12:33:17 -0700 Subject: [PATCH] Recreate PyFunction_EVENT_MODIFY_QUALNAME for 3.12 Summary: Originally from D47164762. We need to upstream this (T157458951). Reviewed By: alexmalyshev Differential Revision: D59134470 fbshipit-source-id: d42644ef98fae909697347400390d50430df1f21 --- Include/cpython/funcobject.h | 3 ++- Objects/funcobject.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Include/cpython/funcobject.h b/Include/cpython/funcobject.h index 23c8009c38d..a6cec5f31cf 100644 --- a/Include/cpython/funcobject.h +++ b/Include/cpython/funcobject.h @@ -139,7 +139,8 @@ PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); V(DESTROY) \ V(MODIFY_CODE) \ V(MODIFY_DEFAULTS) \ - V(MODIFY_KWDEFAULTS) + V(MODIFY_KWDEFAULTS) \ + V(MODIFY_QUALNAME) typedef enum { #define PY_DEF_EVENT(EVENT) PyFunction_EVENT_##EVENT, diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 0efcddf4319..4c7c42eb1ce 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -541,6 +541,8 @@ func_set_qualname(PyFunctionObject *op, PyObject *value, void *Py_UNUSED(ignored "__qualname__ must be set to a string object"); return -1; } + handle_func_event(PyFunction_EVENT_MODIFY_QUALNAME, + (PyFunctionObject *)op, value); Py_XSETREF(op->func_qualname, Py_NewRef(value)); return 0; }