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 terry.reedy
Recipients nirinA raseliarison, terry.reedy
Date 2020-07-15.04:43:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Your suggestion is correct.

A side issue is that the line numbers in the traceback are correct but the quoted text lines from iomenu (and only iomenu) are wrong, being from the line previous.  I will have to investigate this discrepancy.

After the patch, two weeks ago, for #41158, iomenu line 199 in save is
            if self.writefile(self.filename):
line 232 in writefile is 
        chars = self.encode(text)
line 291 in encode is
        enc, _ = tokenize.detect_encoding(io.BytesIO(encoded).readline)
This is only tried if ascii encoding fails and require the addition of 'import io'.

Before I close this, I will try to add a unittest that similarly fails without the import added, as well as some others for other exit points.
Date User Action Args
2020-07-15 04:43:51terry.reedysetrecipients: + terry.reedy, nirinA raseliarison
2020-07-15 04:43:51terry.reedysetmessageid: <>
2020-07-15 04:43:51terry.reedylinkissue41300 messages
2020-07-15 04:43:51terry.reedycreate