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

Zipfile cannot be used in "with" Statement #54510

Closed
tsteinruecken mannequin opened this issue Nov 3, 2010 · 2 comments
Closed

Zipfile cannot be used in "with" Statement #54510

tsteinruecken mannequin opened this issue Nov 3, 2010 · 2 comments
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@tsteinruecken
Copy link
Mannequin

tsteinruecken mannequin commented Nov 3, 2010

BPO 10301
Nosy @ezio-melotti, @alex

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 = <Date 2010-11-03.21:42:28.791>
created_at = <Date 2010-11-03.21:28:56.442>
labels = ['extension-modules', 'type-bug']
title = 'Zipfile cannot be used in "with" Statement'
updated_at = <Date 2010-11-03.22:40:26.573>
user = 'https://bugs.python.org/tsteinruecken'

bugs.python.org fields:

activity = <Date 2010-11-03.22:40:26.573>
actor = 'ezio.melotti'
assignee = 'none'
closed = True
closed_date = <Date 2010-11-03.21:42:28.791>
closer = 'benjamin.peterson'
components = ['Extension Modules']
creation = <Date 2010-11-03.21:28:56.442>
creator = 't.steinruecken'
dependencies = []
files = []
hgrepos = []
issue_num = 10301
keywords = []
message_count = 2.0
messages = ['120346', '120348']
nosy_count = 3.0
nosy_names = ['ezio.melotti', 'alex', 't.steinruecken']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue10301'
versions = ['Python 3.1']

@tsteinruecken
Copy link
Mannequin Author

tsteinruecken mannequin commented Nov 3, 2010

Using a ZipFile as a "with"-context dosnt work
(Im using the standard Ubuntu version of Python3.1)

Python 3.1.2 (r312:79147, Apr 15 2010, 15:35:48) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from zipfile import ZipFile
>>> with ZipFile("test.zip","w") as z:
...     z.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'ZipFile' object has no attribute '__exit__'
>>>

@tsteinruecken tsteinruecken mannequin added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Nov 3, 2010
@alex
Copy link
Member

alex commented Nov 3, 2010

Context manager support was added in 3.2

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants