Project

General

Profile

Bug #24940

Check that all path handling is compliant w/ pep-0519 (Path-like, str, bytes handling)

Added by Marco Mambelli about 2 months ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
09/09/2020
Due date:
% Done:

0%

Estimated time:
First Occurred:
Occurs In:
Stakeholders:
Duration:

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 about 1 month ago

  • Assignee set to Thomas Hein

#2 Updated by Marco Mambelli about 1 month ago

  • Target version changed from v3_9_0 to v3_9_1


Also available in: Atom PDF