-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
fixing narrow type-hint #266
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test please
@@ -95,11 +95,13 @@ def __init__( | |||
If this is set to ``False`` then the lock will be reentrant across threads. | |||
""" | |||
self._is_thread_local = thread_local | |||
path = os.fspath(lock_file) | |||
path_str = path.decode() if isinstance(path, bytes) else path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, with this I'm no longer sure this is something we want to support. The user can put their casting at call side if they must, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other parts of the code depend in this being a str
, like these debug logging lines (otherwise we get b'log lines'
).
So the choice for me was whether to do filename.decode() if isinstance(filename, bytes) else filename
in multiple spots, or make sure that it's str
at init time.
@gaborbernat I don't mind if you decide to not accept the PR. I was trying to help close the low hanging issues. 😄 |
Let's do that 👍 |
fixes #258