-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
C-bugSomething isn't workingSomething isn't working
Description
Summary
inspect.getsource does not return full source for some(?) functions
Verified on commit 3dae07c built in release mode with rustc 1.93.0.
Expected
"""
import inspect
def a(
a=0,
):
0
a = inspect.getsource(a)
print(a)
# getsource should return the full source including "def a(",
# but RustPython returns only "a=0,\n): 0\n" (the last lines)
assert "def" in a, f"Expected full source, got: {a!r}"This should (and does on cpython) print the following:
def a(
a=0,
):
0
a=0,
Traceback (most recent call last):
File "/Users/drmaciver/Projects/hypothesis/rustpython-bugs/bug1_getsource_truncated.py", line 26, in <module>
assert "def" in a, f"Expected full source, got: {a!r}"
^
AssertionError: Expected full source, got: ' a=0,\n'
Python Documentation
(https://docs.python.org/3/library/inspect.html#inspect.getsource)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugSomething isn't workingSomething isn't working