Skip to content

Fix annotation fn's not runing in dynamicscope for #616#619

Merged
MatthieuDartiailh merged 2 commits intonucleic:mainfrom
frmdstryr:update-compiler
Apr 21, 2026
Merged

Fix annotation fn's not runing in dynamicscope for #616#619
MatthieuDartiailh merged 2 commits intonucleic:mainfrom
frmdstryr:update-compiler

Conversation

@frmdstryr
Copy link
Copy Markdown
Contributor

@frmdstryr frmdstryr commented Apr 21, 2026

This builds on #618.

The commit 7478234 is not necessary but cleans up the code slightly (I can move it to a separate PR).

For context, I added a few statements to print the function and outer_ops in insert_decl_function and ran the code in #616 on 3.14.The output was:

FunctionDef(name='a', args=arguments(posonlyargs=[], args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), body=[Expr(value=Call(func=Name(...), args=[Constant(...)], keywords=[])), Expr(value=Call(func=Name(...), args=[Name(...)], keywords=[]))], decorator_list=[], returns=None, type_comment=None, type_params=[])
Ops:
<RESUME arg=0 location=InstrLocation(lineno=0, end_lineno=1, col_offset=0, end_col_offset=0)>
<LOAD_CONST arg=<code object a at 0x7191566f7880, file "tests/issue.enaml", line 6> location=InstrLocation(lineno=6, end_lineno=8, col_offset=4, end_col_offset=19)>
<MAKE_FUNCTION location=InstrLocation(lineno=6, end_lineno=8, col_offset=4, end_col_offset=19)>

FunctionDef(name='b', args=arguments(posonlyargs=[], args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), body=[Expr(value=Call(func=Name(...), args=[Constant(...)], keywords=[])), Expr(value=Call(func=Name(...), args=[Name(...)], keywords=[]))], decorator_list=[], returns=Constant(value=None, kind=None), type_comment=None, type_params=[])
Ops:
<RESUME arg=0 location=InstrLocation(lineno=0, end_lineno=1, col_offset=0, end_col_offset=0)>
<LOAD_CONST arg=<code object __annotate__ at 0x719156670210, file "tests/issue.enaml", line 10> location=InstrLocation(lineno=10, end_lineno=12, col_offset=4, end_col_offset=19)>
<MAKE_FUNCTION location=InstrLocation(lineno=10, end_lineno=12, col_offset=4, end_col_offset=19)>
<LOAD_CONST arg=<code object b at 0x7191566f7880, file "tests/issue.enaml", line 10> location=InstrLocation(lineno=10, end_lineno=12, col_offset=4, end_col_offset=19)>
<MAKE_FUNCTION location=InstrLocation(lineno=10, end_lineno=12, col_offset=4, end_col_offset=19)>
<SET_FUNCTION_ATTRIBUTE arg=16 location=InstrLocation(lineno=10, end_lineno=12, col_offset=4, end_col_offset=19)>

So it looks like python adds a separate function for annotations and it was selecting the code from the first function.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.99%. Comparing base (effc8b3) to head (6daebdd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #619      +/-   ##
==========================================
- Coverage   65.99%   65.99%   -0.01%     
==========================================
  Files         270      270              
  Lines       26590    26576      -14     
  Branches     3908     3899       -9     
==========================================
- Hits        17549    17538      -11     
+ Misses       7992     7990       -2     
+ Partials     1049     1048       -1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MatthieuDartiailh
Copy link
Copy Markdown
Member

Can you rebate?

@frmdstryr
Copy link
Copy Markdown
Contributor Author

Rebased

@frmdstryr

This comment was marked as resolved.

@MatthieuDartiailh MatthieuDartiailh merged commit ad30b05 into nucleic:main Apr 21, 2026
16 checks passed
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.

2 participants