Skip to content

Fire 'line' event for first statement of module code - #2127

Merged
slozier merged 1 commit into
IronLanguages:mainfrom
BCSharp:first-line
Nov 1, 2026
Merged

slozier merged 1 commit into
IronLanguages:mainfrom
BCSharp:first-line

Conversation

@BCSharp

@BCSharp BCSharp commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

The DLR treats the first sequence point of a lambda as the location of the 'call' trace event and fires no 'line' event for it. Function bodies emit a dedicated entry sequence point, but module, exec and eval code did not, so their first statement never got a 'line' event.

This PR adds the entry sequence point to PythonAst, at the line of the first statement, matching CPython up to 3.9 (3.10 implements PEP 626).

It also updates test_cp24381 to ignore events from the Python-implemented import machinery, which CPython traces as well, and removes its expected-failure decorator.

Fixes IronLanguages/main#740 (archived repo)

@slozier slozier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me!

@slozier
slozier merged commit 33ab66a into IronLanguages:main Nov 1, 2026
35 checks passed
@BCSharp
BCSharp deleted the first-line branch November 1, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sys.settrace doesn't trace through modules

2 participants