diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-05-14 18:55:55 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-05-14 18:55:55 (GMT) |
commit | e450185b4ad645d4f72cbd4b2139d6a987edc84d (patch) | |
tree | d588925c1710f0404f9ac61058a79a5b33382408 /Modules/_io/_iomodule.c | |
parent | b565577aa722d8b39aa42da0384f776680c03c36 (diff) | |
download | cpython-e450185b4ad645d4f72cbd4b2139d6a987edc84d.zip cpython-e450185b4ad645d4f72cbd4b2139d6a987edc84d.tar.gz cpython-e450185b4ad645d4f72cbd4b2139d6a987edc84d.tar.bz2 |
Issue #5006: Better handling of unicode byte-order marks (BOM) in the io library.
This means, for example, that opening an UTF-16 text file in
append mode doesn't add a BOM at the end of the file if the file isn't
empty.
Diffstat (limited to 'Modules/_io/_iomodule.c')
-rw-r--r-- | Modules/_io/_iomodule.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index 1bba13a..ba653d6 100644 --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -41,6 +41,7 @@ PyObject *_PyIO_str_readline; PyObject *_PyIO_str_reset; PyObject *_PyIO_str_seek; PyObject *_PyIO_str_seekable; +PyObject *_PyIO_str_setstate; PyObject *_PyIO_str_tell; PyObject *_PyIO_str_truncate; PyObject *_PyIO_str_writable; @@ -48,6 +49,7 @@ PyObject *_PyIO_str_write; PyObject *_PyIO_empty_str; PyObject *_PyIO_empty_bytes; +PyObject *_PyIO_zero; PyDoc_STRVAR(module_doc, @@ -734,6 +736,8 @@ PyInit__io(void) goto fail; if (!(_PyIO_str_seekable = PyUnicode_InternFromString("seekable"))) goto fail; + if (!(_PyIO_str_setstate = PyUnicode_InternFromString("setstate"))) + goto fail; if (!(_PyIO_str_tell = PyUnicode_InternFromString("tell"))) goto fail; if (!(_PyIO_str_truncate = PyUnicode_InternFromString("truncate"))) @@ -747,6 +751,8 @@ PyInit__io(void) goto fail; if (!(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) goto fail; + if (!(_PyIO_zero = PyLong_FromLong(0L))) + goto fail; state->initialized = 1; |