Bug #24940
Check that all path handling is compliant w/ pep-0519 (Path-like, str, bytes handling)
Start date:
09/09/2020
Due date:
% Done:
0%
Estimated time:
First Occurred:
Occurs In:
Stakeholders:
Description
The current code base has a mixed use of str(), .encode and .decode that seem at times inconsistent.
Paths are created at times adding strings or formatting them.
Some conversions are not needed, str() over bytes causes wrong representations, mixing types can cause errors.
Use of functions like
os.path.join(path, *paths) # (path-like, *path-like) -> str
or strings (str, unicode strings) should be encouraged
The code should be inspected (file opening, ...)
Here a specification of path-like and path handling
https://www.python.org/dev/peps/pep-0519/
These posts talk about possible errors (but are not completely useful):
https://www.btelligent.com/en/blog/best-practice-working-with-paths-in-python-part-1/
https://www.btelligent.com/en/blog/best-practice-working-with-paths-in-python-part-2/
History
#1 Updated by Marco Mambelli 7 months ago
- Assignee set to Thomas Hein
#2 Updated by Marco Mambelli 7 months ago
- Target version changed from 2122 to v3_9_1
#3 Updated by Marco Mambelli about 2 months ago
- Assignee deleted (
Thomas Hein)
#4 Updated by Marco Mambelli about 1 month ago
- Target version changed from v3_9_1 to v3_9_2