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 Jake Lever
Recipients Jake Lever
Date 2017-10-03.23:48:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507074488.46.0.213398074469.issue31686@psf.upfronthosting.co.za>
In-reply-to
Content
The attached code is designed to output compressed data to a gzip file. It creates two GzipFile objects, but only one is really used. It seems that it doesn't clean up and close the file properly.

In Py2, the attached code will fail. The output file (debug.txt.gz) will be corrupt. However if the self.unused line is commented out, it works and the file is not corrupted.

In Py3, a sys.exit call at the end is required to see the same behaviour.


As example output, when the sys.exit is include in Py3, the output is below and the file is corrupt.
Compressor.__init__
UnusedClass.write
UnusedClass.write
UnusedClass.write
UnusedClass.write
UnusedClass.write
UnusedClass.write
Compressor.compressToFile

And when the sys.exit is commented out, the console output is below and the file is not corrupt.

Compressor.__init__
UnusedClass.write
UnusedClass.write
UnusedClass.write
UnusedClass.write
UnusedClass.write
UnusedClass.write
Compressor.compressToFile
UnusedClass.write
UnusedClass.write
UnusedClass.write
History
Date User Action Args
2017-10-03 23:48:08Jake Leversetrecipients: + Jake Lever
2017-10-03 23:48:08Jake Leversetmessageid: <1507074488.46.0.213398074469.issue31686@psf.upfronthosting.co.za>
2017-10-03 23:48:08Jake Leverlinkissue31686 messages
2017-10-03 23:48:08Jake Levercreate