This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients alexandre.vassalotti, xtreak
Date 2020-07-25.14:12:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
pickle and pickletools use argparse with FileType which is not automatically closed. Other cli interfaces like json [0], ast [1] use context manager to close filetype objects.

pickle :


>>> import pickle
>>> with open("mypickle", "wb") as f: pickle.dump({"a": 1}, f)

./python -Wall -m pickle mypickle                    
{'a': 1}
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='mypickle'>

pickletools :

./python -Wall -m pickletools mypickle -o
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='mypickle'>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='' mode='w' encoding='UTF-8'>

Date User Action Args
2020-07-25 14:12:10xtreaksetrecipients: + xtreak, alexandre.vassalotti
2020-07-25 14:12:10xtreaksetmessageid: <>
2020-07-25 14:12:10xtreaklinkissue41395 messages
2020-07-25 14:12:10xtreakcreate