-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
bpo-39323: Fix directory separator of imghdr cli output #17993
Conversation
* Use os.sep to display path directories for better compatibility * Add tests for imghdr cli
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.
LGTM for test code :) and I left a comment on Lib/imghdr.py
@@ -148,7 +148,7 @@ def testall(list, recursive, toplevel): | |||
import os | |||
for filename in list: | |||
if os.path.isdir(filename): | |||
print(filename + '/:', end=' ') | |||
print(filename + os.sep +':', end=' ') |
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.
I don't know this kind of code churn is proper,
But if this is needed, what about this?
print(f'{filename}{os.sep}:', end=' ')
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.
As a personal opinion, I don't see much improvement here in changing. It's just concatenating two separate variables and there are no other strings also as part of string like a + " equals " + b
to f"{a} equals {b}"
.
Note the imghdr modules is deprecated in 3.11 and set for removal in 3.13. See PEP 594 – Removing dead batteries from the standard library and #91217. @corona10 If you're happy to merge this, I suggest going ahead anyway, otherwise it could be closed. :) |
Thanks @hugovk , I am okay with closing this. |
os.sep
to indicate directory separator in imghdr cli output.https://bugs.python.org/issue39323