summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-04-15 00:19:12 (GMT)
committerGuido van Rossum <guido@python.org>2002-04-15 00:19:12 (GMT)
commitf90d5292298cbaa114c4a1d000e7d8e946ca65b3 (patch)
tree73d58f00b7a98efd6d015ea81b7bf8a415f8f1b7 /Lib
parenta258324a3d6e6c70c13e70b2313c169b6c46ec66 (diff)
downloadcpython-f90d5292298cbaa114c4a1d000e7d8e946ca65b3.zip
cpython-f90d5292298cbaa114c4a1d000e7d8e946ca65b3.tar.gz
cpython-f90d5292298cbaa114c4a1d000e7d8e946ca65b3.tar.bz2
Provisional fix for writefile() [SF bug # 541730].
The problem was that an exception can occur in the text.get() call or in the write() call, when the text buffer contains non-ASCII characters. This causes the previous contents of the file to be lost. The provisional fix is to call str(self.text.get(...)) *before* opening the file, so that if the exception occurs, we never open the file. Two orthogonal better solutions have to wait for policy decisions: 1. We could try to encode the data as Latin-1 or as UTF-8; but that would require IDLE to grow a notion of file encoding which requires more thought. 2. We could make backups before overwriting a file. This requires more thought because it needs to be fast and cross-platform and configurable.
Diffstat (limited to 'Lib')
0 files changed, 0 insertions, 0 deletions