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

Error in brine.py with TAG_EMPTY_STR #66

Closed
pyscripter opened this issue Feb 28, 2012 · 1 comment
Closed

Error in brine.py with TAG_EMPTY_STR #66

pyscripter opened this issue Feb 28, 2012 · 1 comment

Comments

@pyscripter
Copy link
Contributor

The following function will produce an error in python 3k.

@register(_load_registry, TAG_EMPTY_STR)
def _load_empty_str(stream):
    return ""

The reason is that it will return a unicode string and later _load_unicode will complain that an str object has no method "decode".

Solution:

if is_py3k:
    @register(_load_registry, TAG_EMPTY_STR)
    def _load_empty_str(stream):
        return b""
else:
    @register(_load_registry, TAG_EMPTY_STR)
    def _load_empty_str(stream):
        return ""
@tomerfiliba
Copy link
Collaborator

thanks

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

No branches or pull requests

2 participants