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

Should raise TypeError if unicode string is used as SHA index #144

Closed
jonashaag opened this issue Mar 5, 2014 · 1 comment · Fixed by #145
Closed

Should raise TypeError if unicode string is used as SHA index #144

jonashaag opened this issue Mar 5, 2014 · 1 comment · Fixed by #145

Comments

@jonashaag
Copy link
Contributor

repo[some_unicode_commit_sha] throws a KeyError when it should raise a TypeError (because unicode is now allowed).

    def __getitem__(self, name):
        ### Skipped because isinstance check does not hold
        if len(name) in (20, 40) and isinstance(name, str):
            try:
                return self.object_store[name]
            except (KeyError, ValueError):
                pass
        ### Fails because sha is no ref
        try:
            return self.object_store[self.refs[name]]
        except RefFormatError:
            raise KeyError(name)
jonashaag added a commit to jonashaag/klaus that referenced this issue Mar 5, 2014
See jelmer/dulwich#144

Thanks to Klaus Alexander Seistrup. Fixes #89.
@jelmer
Copy link
Owner

jelmer commented Mar 6, 2014

Agreed, Dulwich should raise TypeError in this case. Patches welcome :)

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 a pull request may close this issue.

2 participants