Terry J. Reedy <tjre...@udel.edu> added the comment:
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. ---------- stage: -> test needed title: IDLE: missing import io in iomenu.py -> IDLE: add missing import io in iomenu.py type: -> behavior versions: +Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41300> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com