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

Method 2: support python 2 and python 3 by requiring clients to pass 8-bit string parameters. #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tacitus-aedifex
Copy link
Contributor

this is an alternative way to support both python 3 and python 2. this version doesn't do any string conversion, instead the programmer is required to pass strings of 8-bit values. i added a decorator that throws a ValueError exception if the programmer passes the wrong string type to the pysodium functions. this also cleans up the test cases so that they all pass strings of 8-bit values to the pysodium functions.

@tacitus-aedifex
Copy link
Contributor Author

whoops, forgot to change python2 to just python in the test script...fixed.

@tacitus-aedifex tacitus-aedifex changed the title adding support for python 3 and python 2 Method 2: support python 2 and python 3 by requiring clients to pass 8-bit string parameters. Sep 20, 2016
Copy link
Owner

@stef stef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would reverse the checks in the decorator, instead of checking for one wrong type to be passed, i'd raise an error if not the correct type is passed. i.e. for py2

if not isinstance(arg,str): raise ValueError(...)

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