Skip to content

Fix Constants() to work with Python 3.14 annotations.#203

Closed
nascheme wants to merge 1 commit intocoreweave:mainfrom
nascheme:annotations-3.14-fix
Closed

Fix Constants() to work with Python 3.14 annotations.#203
nascheme wants to merge 1 commit intocoreweave:mainfrom
nascheme:annotations-3.14-fix

Conversation

@nascheme
Copy link
Copy Markdown
Contributor

In Python 3.14 (PEP 649), annotations are lazily evaluated and stored as __annotate_func__ instead of __annotations__. Add _pop_annotations() function to use in tensorizer/_crypt/_encryption.py. Without this change, you get KeyError on crypto_stream_salsa20_NONCEBYTES when running with 3.14 (i.e. the annotation on the class cannot be found).

In Python 3.14 (PEP 649), annotations are lazily evaluated and stored as
``__annotate_func__`` instead of ``__annotations__``.
@Eta0
Copy link
Copy Markdown
Collaborator

Eta0 commented Apr 21, 2026

Thank you for this contribution! I batched this in with a few other changes in #204 with you marked as a co-author. I did edit this slightly to use annotationlib to interface with the annotate function, though, as it seems accessing __annotate_func__ directly is considered spicy (astral-sh/ruff#17859).

The fixed version will be available as tensorizer release 2.12.1.

@Eta0 Eta0 closed this Apr 21, 2026
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