Skip to content

Remove deferred imports from Shadow.PointerType - #7999

Merged
scoder merged 1 commit into
cython:masterfrom
vfazio:vfazio-shadow-deferred-imports
Sep 22, 2026
Merged

scoder merged 1 commit into
cython:masterfrom
vfazio:vfazio-shadow-deferred-imports

Conversation

@vfazio

@vfazio vfazio commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Previously, Shadow.PointerType performed a deferred import of the Shadow.cast function in __init__ and __setitem__.

The cast function is defined at the module level and there are no conflicts with another cast function (like typing.cast) that would require shadowing the function.

The imports also prevented users from copying the Shadow module 0 out with a different name.

Previously, Shadow.PointerType performed a deferred import of the
`Shadow.cast` function in `__init__` and `__setitem__`.

The `cast` function is defined at the module level and there are no
conflicts with another `cast` function (like `typing.cast`) that would
require shadowing the function.

The imports also prevented users from copying the Shadow module [0] out
with a different name.

[0]: https://cython.readthedocs.io/en/latest/src/tutorial/pure.html#magic-attributes

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
@vfazio
vfazio marked this pull request as ready for review September 18, 2026 11:51
@da-woods

Copy link
Copy Markdown
Collaborator

Looks sensible to me. I suspect it's a remnant of something else, but it's clearly no longer useful.

@vfazio

vfazio commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Looks sensible to me. I suspect it's a remnant of something else, but it's clearly no longer useful.

I couldn't tease out why it was added in 6e31b41 since it wasn't in the pyi file... maybe the LLM thought it was necessary for some reason but i couldn't divine why

We do use a full copy of the shadow file for some of our projects so merging this will allow us to copy it verbatim without edits.

@vfazio

vfazio commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

lmk if there's anything else I can help with on this PR.

@scoder scoder added this to the 3.3.1 milestone Sep 22, 2026
@scoder
scoder merged commit 6b34686 into cython:master Sep 22, 2026
113 checks passed
@scoder

scoder commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants