Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openpyxl
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 248
    • Issues 248
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 5
    • Merge requests 5
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • openpyxl
  • openpyxl
  • Merge requests
  • !388

Fix file descriptor leak

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Keith Erskine requested to merge topic/3.0/issue-1450-file-descriptor-leak into branch/3.0 Jan 04, 2021
  • Overview 11
  • Commits 1
  • Pipelines 1
  • Changes 2

--HG-- branch : 3.0

In \openpyxl\worksheet\_read_only.py, file descriptors opened using function _get_source() must be closed after use. This is not being done in the two places _get_source() is being used in that module. This MR adds a try..finally block around those two cases and closes the file descriptor.

This fixes issue 1450, where an Excel file remains locked (on Windows) even after the workbook is closed because file descriptors are left open after a partial iteration of worksheets in the file.

I have updated the file descriptor unit test to cover this scenario.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: topic/3.0/issue-1450-file-descriptor-leak