Skip to content
GitLab
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 264
    • Issues 264
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and 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
  • !193

fix file descriptor leak

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Bitbucket Importer requested to merge bitbucket/declined-pr-193 into branch/default Sep 16, 2017
  • Overview 2
  • Commits 0
  • Pipelines 0
  • Changes 0

Created originally on Bitbucket by benoit-pierre (Benoit Pierre)

Changesets for this Pull Request have not been imported, because it had been already declined on Bitbucket. Marked as closed by the import user.

The issue can be seen with the following script:

#!python
#!/usr/bin/env python

import os
import sys

import openpyxl

wb = openpyxl.load_workbook(sys.argv[1], read_only=True)
ws = wb.get_sheet_by_name(wb.get_sheet_names()[0])
for row in ws.iter_rows():
    print('doing important work')
wb.close()

fd_dir = '/proc/%u/fd' % os.getpid()
for fd_name in os.listdir(fd_dir):
  print(fd_name, '-> ', end='')
  try:
    print(os.readlink('%s/%s' % (fd_dir, fd_name)))
  except FileNotFoundError:
    print()
#!shell
> python file_leak_test.py test.xlsx
doing important work
doing important work
doing important work
doing important work
doing important work
doing important work
doing important work
doing important work
doing important work
doing important work
0 -> /dev/pts/3
1 -> /dev/pts/3
2 -> /dev/pts/3
3 ->
4 -> [...]/openpyxl/test.xlsx
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: bitbucket/declined-pr-193