From e6d9f942d75c8022d09e67ab6360d926f33c2f61 Mon Sep 17 00:00:00 2001 From: Pavel Potapov Date: Mon, 12 Jan 2026 11:27:48 -0500 Subject: [PATCH] Fix how functions are parsed for const exprs --- interop/klr/gather.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interop/klr/gather.c b/interop/klr/gather.c index b5b7c22e..c60a6dc9 100644 --- a/interop/klr/gather.c +++ b/interop/klr/gather.c @@ -538,6 +538,13 @@ static lean_object* const_expr(struct state *st, PyObject *obj) { error(st, "numpy dtypes are not supported as arguments"); } } + else if (PyFunction_Check(obj)) { + lean_object *func_name = py_def_name(st, obj); + if (!st->ignore_refs) { + add_work(st, NULL, obj); + } + e = Python_Expr_mk(Python_Expr_name(func_name, Python_Ctx_load), pos); + } else if (PyObject_HasAttrString(obj, "__class__") && PyObject_HasAttrString(obj, "__dict__")) {