-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
C-bugCategory: This is a bugCategory: This is a bug
Description
The @kernel decorator currently cannot be used on functions defined from Python's builtin REPL. This should be allowed, even if debug source info is absent.
Example:
% uv run python
Python 3.10.18 (main, Aug 6 2025, 22:40:36) [Clang 20.1.4 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from kirin.prelude import basic
>>> @basic
... def func_defined_from_repl():
... return 1 + 2
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/.venv/lib/python3.10/site-packages/kirin/ir/group.py", line 269, in __call__
return wrapper(py_func)
File "/.venv/lib/python3.10/site-packages/kirin/ir/group.py", line 223, in wrapper
code = self.lowering.python_function(py_func, lineno_offset=lineno_offset)
File "/.venv/lib/python3.10/site-packages/kirin/lowering/python/lowering.py", line 60, in python_function
source = textwrap.dedent(inspect.getsource(func))
File "~/.local/share/uv/python/cpython-3.10.18-macos-aarch64-none/lib/python3.10/inspect.py", line 1139, in getsource
lines, lnum = getsourcelines(object)
File "~/.local/share/uv/python/cpython-3.10.18-macos-aarch64-none/lib/python3.10/inspect.py", line 1121, in getsourcelines
lines, lnum = findsource(object)
File "~/.local/share/uv/python/cpython-3.10.18-macos-aarch64-none/lib/python3.10/inspect.py", line 958, in findsource
raise OSError('could not get source code')
OSError: could not get source codeMetadata
Metadata
Assignees
Labels
C-bugCategory: This is a bugCategory: This is a bug