Repository navigation
typ: define stub type aliases after the classes they reference - #433
Merged
Merged
Conversation
The input type aliases in the stubs (iarb, iacb, ifmpz, ...) were assigned above the class they name, e.g. `iarb = ... | arb` above `class arb`. ty resolves a forward reference in the value of a plain assignment to Unknown, even in a stub, so every parameter annotated with one of these aliases was Unknown under ty: `arb(2) * acb(1)` was inferred as `arb` and `iarb` accepted an `acb`. Defining each alias after the class it references fixes this. mypy and pyright output is unchanged.
This was referenced Oct 13, 2026
Contributor
Author
|
The three red jobs are not caused by this PR:
Re-running the Windows arm64 jobs should clear the last two failures. |
Collaborator
|
Please don't paste the excessively long LLM-generated explanation in the PR description. The reason for this can be explained in just a few human-written sentences. |
cython-lint 0.22.0 now reports unused cdef locals in inline functions defined in .pxd files, so the Lint job fails on main with fmpz.pxd:25:16: 'w' defined but unused. The variable has been unused since the from_bytes/to_bytes conversion rewrite (f349183).
Contributor
Author
|
Sorry about that. I've shortened the description and added the fmpz.pxd change from #434 here. |
Collaborator
|
Okay, looks good. Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The input type aliases in the stubs (
iarb,iacb,ifmpz, ...) were assigned above the classes they name, e.g.iarb = ... | arbaboveclass arb. ty resolves such a forward reference to Unknown, so under tyarb(2) * acb(1)was inferred asarb. This defines each alias after its class; mypy and pyright see no change.It also removes the unused
cdef ulong winfmpz.pxdthat cython-lint 0.22 reports, which made the Lint job fail (moved here from #434).