Skip to content
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

Ensure that secretbox can accept any bytes-like object as parameter #847

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

blast-hardcheese
Copy link

start to address #707, ensuring that secretbox can accept bytearray.

The issue I ran into in this case was that both mypy and pyright think that bytearray satisfy bytes. Taking the suggestion from #707 resolved this in tests.

Thank you for the library!

@blast-hardcheese blast-hardcheese force-pushed the secretbox-bytearray branch 3 times, most recently from d39a50d to 7e60497 Compare November 12, 2024 20:20
@blast-hardcheese
Copy link
Author

Please pardon the force pushes. I'm also happy to remove mypy from optional-dependencies.tests if desired.

I was able to use uv to do most of my iteration here, but not having an explicit version of mypy specified prevented typechecking locally.

@reaperhulk
Copy link
Member

@blast-hardcheese are you interested in implementing this across the set of methods? If so, we should set up an issue to track everything and burn it down. I've been meaning to ship a new PyNaCl release for a while, so it'd be nice to get this in there 🙂

@blast-hardcheese
Copy link
Author

I'm not opposed to it, I figured I'd start with the ones that were causing me pain. Is it sufficient to apply this pattern to all public methods?

@reaperhulk
Copy link
Member

Yes, this pattern is correct for any immutable buffers being passed into the C layer.

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

Successfully merging this pull request may close these issues.

3 participants