Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions interop/klr/gather.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,11 @@ static void add_work(struct state *st, char *suggested_name, PyObject *obj) {
}

// Check if this is a jit-decorated function
if (PyFunction_Check(obj)) {
// Method 1: Check for __wrapped__ attribute (if decorator sets it)
PyObject *kernel_func = PyObject_GetAttrString(obj, "__kernel_func");
if (kernel_func && !PyErr_Occurred()) {
obj = kernel_func;
} else {
PyErr_Clear();
}
PyObject *kernel_func = PyObject_GetAttrString(obj, "__wrapped__");
if (kernel_func && !PyErr_Occurred()) {
obj = kernel_func;
} else {
PyErr_Clear();
}

// Scan/Add to worklist
Expand Down Expand Up @@ -734,6 +731,14 @@ static struct ref reference(struct state *st, struct _expr *e) {
}
ref.obj = lookup(st, e->v.Name.id);
if (ref.obj) {
// Check if this is a jit-decorated function
PyObject *kernel_func = PyObject_GetAttrString(ref.obj, "__wrapped__");
if (kernel_func && !PyErr_Occurred()) {
ref.obj = kernel_func;
} else {
PyErr_Clear();
}

if (PyModule_Check(ref.obj)) {
PyObject *name = PyModule_GetNameObject(ref.obj);
ref.name = py_strdup(st, name);
Expand Down
Loading