# Feature or enhancement

### Proposal:

We have a `co_firstlineno` in code object which is useful in many cases. However, `co_lastlineno` is very useful as well. With the two numbers we can get the full body of the defined function, rather than doing something crazy like: https://github.com/python/cpython/blob/13a5fdc72f701c053b96abea48cd8f2775e9418e/Lib/inspect.py#L1194-L1211

Not only `inspect` will benefit from the number, `pdb` will know whether a breakpoint is set in the function easily so it can turn off the trace in irrelevant functions.

I'm not the expert in compiler but I think the data should be there already, we just need to write it down. The code object itself is not super size sensitive (it's already pretty big, an extra integer is nothing) so it really should not cost anything.

@iritkatriel could you share your thoughts on this?

### Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

### Links to previous discussion of this feature:

_No response_
Add a `co_lastlineno` in code object
This is a GitHub Issue
repo:cpython
owner:python
Title : Add a `co_lastlineno` in code object
Issue date:

--- start body ---
# Feature or enhancement

### Proposal:

We have a `co_firstlineno` in code object which is useful in many cases. However, `co_lastlineno` is very useful as well. With the two numbers we can get the full body of the defined function, rather than doing something crazy like: https://github.com/python/cpython/blob/13a5fdc72f701c053b96abea48cd8f2775e9418e/Lib/inspect.py#L1194-L1211

Not only `inspect` will benefit from the number, `pdb` will know whether a breakpoint is set in the function easily so it can turn off the trace in irrelevant functions.

I'm not the expert in compiler but I think the data should be there already, we just need to write it down. The code object itself is not super size sensitive (it's already pretty big, an extra integer is nothing) so it really should not cost anything.

@iritkatriel could you share your thoughts on this?

### Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

### Links to previous discussion of this feature:

_No response_
--- end body ---
