Skip to content
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

Different behaviour with zipfile #90182

Open
flvndev mannequin opened this issue Dec 9, 2021 · 5 comments
Open

Different behaviour with zipfile #90182

flvndev mannequin opened this issue Dec 9, 2021 · 5 comments
Labels
3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@flvndev
Copy link
Mannequin

flvndev mannequin commented Dec 9, 2021

BPO 46024
Nosy @jaraco, @ericvsmith

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-12-09.10:19:15.526>
labels = ['type-bug', '3.9', '3.10']
title = 'Different behaviour with zipfile'
updated_at = <Date 2021-12-20.19:56:17.771>
user = 'https://bugs.python.org/flvndev'

bugs.python.org fields:

activity = <Date 2021-12-20.19:56:17.771>
actor = 'eric.smith'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2021-12-09.10:19:15.526>
creator = 'flvn.dev'
dependencies = []
files = []
hgrepos = []
issue_num = 46024
keywords = []
message_count = 5.0
messages = ['408104', '408138', '408338', '408956', '408971']
nosy_count = 3.0
nosy_names = ['jaraco', 'eric.smith', 'flvn.dev']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue46024'
versions = ['Python 3.9', 'Python 3.10']

@flvndev
Copy link
Mannequin Author

flvndev mannequin commented Dec 9, 2021

Given the this directory structure:

logs
├── 2020
│  ├── 2020101.zip
|  ├── ...
├── 2021
│  ├── 2021101.zip
|  ├── ...

The following piece of code:

from pathlib import Path
from zipfile import Path as ZipPath

for item in Path("logs").iterdir():
    if item.is_dir():
        path = next(item.iterdir())
        print(ZipPath(path).name)

gives different results between Python 3.9.7 (empty strings) and 3.10.0 (the zip files name)

@flvndev flvndev mannequin added 3.9 only security fixes 3.10 only security fixes type-bug An unexpected behavior, bug, or error labels Dec 9, 2021
@ericvsmith
Copy link
Member

What does "path" (the input to ZipPath) look like?

Please change your print statement to:
print(repr(path), ZipPath(path).name)

Then send us the output from each version of python.

@ericvsmith
Copy link
Member

Actually, printing out:
print(repr(path), repr(ZipPath(path)))
would be more useful.

If I don't hear back in a few days, I'm going to close this issue.

@flvndev
Copy link
Mannequin Author

flvndev mannequin commented Dec 20, 2021

The output of:

print(repr(path), repr(ZipPath(path)))

gives this in both versions:

PosixPath('logs/2020/2020101.zip') Path('logs/2020/2020101.zip', '')
PosixPath('logs/2021/2021101.zip') Path('logs/2021/2021101.zip', '')

@ericvsmith
Copy link
Member

It looks like this was changed in https://bugs.python.org/issue42043

@jaraco might have some insights.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@iritkatriel iritkatriel added the stdlib Python modules in the Lib dir label Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
Status: No status
Development

No branches or pull requests

2 participants