Skip to content

ZipExtFile object close without file handle closed #60387

Closed

Description

@VEO
mannequin
BPO 16183
Nosy @loewis, @jcea

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 2012-11-04.01:33:45.654>
created_at = <Date 2012-10-10.08:59:12.188>
labels = ['type-bug', 'library']
title = 'ZipExtFile object close without file handle closed'
updated_at = <Date 2012-11-04.11:11:56.717>
user = 'https://bugs.python.org/VEO'

bugs.python.org fields:

activity = <Date 2012-11-04.11:11:56.717>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = True
closed_date = <Date 2012-11-04.01:33:45.654>
closer = 'python-dev'
components = ['Library (Lib)']
creation = <Date 2012-10-10.08:59:12.188>
creator = 'V.E.O'
dependencies = []
files = []
hgrepos = []
issue_num = 16183
keywords = []
message_count = 3.0
messages = ['172555', '174732', '174737']
nosy_count = 5.0
nosy_names = ['loewis', 'jcea', 'alanmcintyre', 'python-dev', 'V.E.O']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue16183'
versions = ['Python 2.7']

Activity

  1. VEO commented on Oct 10, 2012

    VEOmannequin
    MannequinAuthor

    Hi, I tried to open file-like object ZipExtFile in one zip file, after operations, I close it and after all, close ZipFile.
    But I still can not remove the zip file immediately.

    This problem happens on Windows, error msg:
    WindowsError: [Error 32] The process cannot access the file because it is being used by another process: ......

    Sample code as below:

    z = ZipFile('D:\\1', 'r')
    zlist = z.infolist()
    for zi in zlist:
        zf = z.open(zi)
        zf.close()
    
    z.close()
    os.remove(attach)
  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    type-bugAn unexpected behavior, bug, or error
    on Oct 10, 2012
  3. jcea commented on Nov 4, 2012

    @jcea
    Member

    This bug was solved in python 3.2. Pyhton 3.1 is affected.

    This is not a windows issue: the file reference is kept in all platforms.

    This seems to be solved in 2c370065c1b4 and 260ff379115c.

    See issue bpo-9846.

  4. python-dev commented on Nov 4, 2012

    python-devmannequin
    Mannequin

    New changeset 6a14f692df1c by Jesus Cea in branch '2.7':
    Closes bpo-16183: ZipExtFile object close without file handle closed (backporting of Issue bpo-9846)
    http://hg.python.org/cpython/rev/6a14f692df1c

  5. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions