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-41643: always support pathlib in shutil.make_archive #21962
base: main
Are you sure you want to change the base?
bpo-41643: always support pathlib in shutil.make_archive #21962
Conversation
@@ -1030,8 +1030,10 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, | |||
uses the current owner and group. | |||
""" |
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.
not sure what the rules are re-auditing, would it be better to do:
base_name = base_name ?? os.fsdecode(base_name)
root_dir = root_dir ?? os.fsdecode(root_dir)
base_dir = base_dir ?? os.fsdecode(base_dir)
before the audit call or after?
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.
What do you mean by ??
?
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.
https://peps.python.org/pep-0505/ syntax, but it's not used should be something like
base_name = base_name if base_name is None else os.fsdecode(base_name)
root_dir = root_dir if root_dir is None else os.fsdecode(root_dir)
base_dir = base_dir if base_dir is None else os.fsdecode(base_dir)
@@ -1030,8 +1030,10 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, | |||
uses the current owner and group. | |||
""" | |||
sys.audit("shutil.make_archive", base_name, format, root_dir, base_dir) | |||
base_name = os.fsdecode(base_name) |
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.
Isn’t fsdecode about bytes-str decoding, and fspath for pathlike-to-OS-native conversion?
https://bugs.python.org/issue41643