FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-85567: Fix pickle and pickletools not closing files by kj7rrv · Pull Request #94583 · python/cpython · GitHub

/ cpython Public

gh-85567: Fix pickle and pickletools not closing files - #94583

Closed
kj7rrv wants to merge 5 commits into
python:mainfrom
kj7rrv:pickle-close-files
Closed

gh-85567: Fix pickle and pickletools not closing files#94583
kj7rrv wants to merge 5 commits into
python:mainfrom
kj7rrv:pickle-close-files

Conversation

kj7rrv commented Jul 5, 2022
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

serhiy-storchaka left a comment
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It goes in the right direction, but it cannot overcome the main innate defect of FileType. It leaves the files open if Python quits or fails before it has a chance to handle the opened files. For example, when pass option -t in the pickletools CLI. Or pass only the output file argument without input file arguments. Or when it fails processing an input file if several input file arguments are specified.

#113618 manages files more explicitly and does not have such issues.

Comment thread Lib/pickletools.py
dis(f, args.output, memo, args.indentlevel, annotate)
finally:
f.close()
args.output.close()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It is not correct to close the output file after processing the first input file.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pickle and pickletools cli interface doesn't close input and output file.

4 participants


Back | FazBrowse Home | New Git URL