Skip to content

fix(python): read a unary plus and True/False as an __import__ level - #830

Merged
rowkav09 merged 1 commit into
mainfrom
fix-level-sign
Oct 3, 2026
Merged

rowkav09 merged 1 commit into
mainfrom
fix-level-sign

Conversation

@rowkav09

@rowkav09 rowkav09 commented Oct 3, 2026

Copy link
Copy Markdown
Member

Follow-up to #828 (the relative __import__ level fix).

level=+1 and level=True are relative in Python but were still credited as the external module, because the level parser only read unsigned numeric text. It now also strips parentheses and a unary plus, and reads exactly True (1) and False (0). No other expression is evaluated.

Still credited, as before: level=False, level=+0, level=-1 (invalid at runtime, not known to us), and any level that is not a plain literal.

Tests: new cases for +1, + 2, (+1), True as keyword and as the fifth positional argument, plus the ones that stay credited. They fail on main; adapter suite passes (259).

level=+1 and level=True are relative in Python, so they are no longer credited as external. level=False and +0 stay credited, as does level=-1. Follow-up to #828.
@rowkav09
rowkav09 merged commit f835fc2 into main Oct 3, 2026
14 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.

1 participant