-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update documentation to clearly state that Fernet is thread safe #12488
Comments
Every immutable object in cryptography is safe to share between multiple threads. (Mutable objects, like hash contexts, can also safely be shared, but concurrent mutation will produce indefinite results or raise an exception). This is by way of saying: this isn't specific to fernet, so I think if we want to add something to the docs, we probably want to make it more general purpose. Are you interested in submitting a PR? |
I'll submit a PR for the documentation.
…On Thu, Feb 20, 2025 at 9:42 AM Alex Gaynor ***@***.***> wrote:
Every immutable object in cryptography is safe to share between multiple
threads. (Mutable objects, like hash contexts, can also safely be shared,
but concurrent mutation will produce indefinite results or raise an
exception).
This is by way of saying: this isn't specific to fernet, so I think if we
want to add something to the docs, we probably want to make it more general
purpose.
Are you interested in submitting a PR?
—
Reply to this email directly, view it on GitHub
<#12488 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZLLBUNSUMPB4MC7IW5WHD2QTUBTAVCNFSM6AAAAABXPC75RSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZG4YTIOJZGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
[image: alex]*alex* left a comment (pyca/cryptography#12488)
<#12488 (comment)>
Every immutable object in cryptography is safe to share between multiple
threads. (Mutable objects, like hash contexts, can also safely be shared,
but concurrent mutation will produce indefinite results or raise an
exception).
This is by way of saying: this isn't specific to fernet, so I think if we
want to add something to the docs, we probably want to make it more general
purpose.
Are you interested in submitting a PR?
—
Reply to this email directly, view it on GitHub
<#12488 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZLLBUNSUMPB4MC7IW5WHD2QTUBTAVCNFSM6AAAAABXPC75RSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZG4YTIOJZGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Great, thanks. |
I'm also happy to help out with this in the context of free-threaded Python. |
I recently used Fernet in a multithreaded environment and struggled to determine from the documentation whether it is thread-safe.
After reviewing the implementation, it appears that Fernet is indeed thread-safe:
Source Code
Would it be appropriate to update the documentation to clarify this?
The text was updated successfully, but these errors were encountered: