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

Improve repr of pygit2.hash #1215

Open
jfine2358 opened this issue May 12, 2023 · 0 comments
Open

Improve repr of pygit2.hash #1215

jfine2358 opened this issue May 12, 2023 · 0 comments

Comments

@jfine2358
Copy link

At present hash and pygit2.hash have the same repr. We can tell them apart by looking at the __module__ attribute. But not their type.

Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygit2
>>> hash, pygit2.hash
(<built-in function hash>, <built-in function hash>)
>>> id(hash) - id(pygit2.hash)
2918112
>>> pygit2.hash.__module__
'pygit2._pygit2'
>>> hash.__module__
'builtins'
>>> type(hash), type(pygit2.hash)
(<class 'builtin_function_or_method'>, <class 'builtin_function_or_method'>)
>>> 

This will confuse anyone who relies on repr to check that they are using the correct hash function.

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

1 participant