Skip to content

Commit

Permalink
Recreate PyFunction_EVENT_MODIFY_QUALNAME for 3.12
Browse files Browse the repository at this point in the history
Summary: Originally from D47164762. We need to upstream this (T157458951).

Reviewed By: alexmalyshev

Differential Revision: D59134470

fbshipit-source-id: d42644ef98fae909697347400390d50430df1f21
  • Loading branch information
jbower-fb authored and facebook-github-bot committed Jul 1, 2024
1 parent 96342a1 commit 90d7cbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Include/cpython/funcobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions Objects/funcobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 90d7cbb

Please sign in to comment.