summaryrefslogtreecommitdiffstats
path: root/Lib/codecs.py
Commit message (Collapse)AuthorAgeFilesLines
* Add a BufferedIncrementalEncoder class that can be used for implementingWalter Dörwald2006-04-141-0/+27
| | | | | | | | | an incremental encoder that must retain part of the data between calls to the encode() method. Fix the incremental encoder and decoder for the IDNA encoding. This closes SF patch #1453235.
* Fix wrong attribute name.Walter Dörwald2006-04-141-1/+1
|
* Change raise statement to PEP 8 style.Walter Dörwald2006-03-181-2/+1
|
* Add some versionadded info to new incremental codec docs and fix doco nits.Neal Norwitz2006-03-161-2/+2
|
* Patch #1436130: codecs.lookup() now returns a CodecInfo object (a subclassWalter Dörwald2006-03-151-11/+172
| | | | | | | of tuple) that provides incremental decoders and encoders (a way to use stateful codecs without the stream API). Functions codecs.getincrementaldecoder() and codecs.getincrementalencoder() have been added.
* If size is specified, try to read at least size characters.Walter Dörwald2006-03-061-1/+4
| | | | This is a alternative version of patch #1379332.
* Whitespace normalization.Tim Peters2005-12-251-2/+2
|
* Patch #1268314: Cache lines in StreamReader.readlines for performance.Martin v. Löwis2005-09-181-0/+37
| | | | Will backport to Python 2.4.
* SF bug #1235646: codecs.StreamRecoder.next() now reencodes the data it readsWalter Dörwald2005-09-011-1/+3
| | | | | from the input stream, so that the output is a byte string in the correct encoding instead of a unicode string.
* Return complete lines from codec stream readersMartin v. Löwis2005-08-241-3/+17
| | | | | | even if there is an exception in later lines, resulting in correct line numbers for decoding errors in source code. Fixes #1178484. Will backport to 2.4.
* Make attributes and local variables in the StreamReader str objects insteadWalter Dörwald2005-07-201-5/+7
| | | | | of unicode objects, so that codecs that do a str->str decoding won't promote the result to unicode. This fixes SF bug #1241507.
* Fix comment.Walter Dörwald2005-04-211-2/+2
|
* If the data read from the bytestream in readline() ends in a '\r' read one moreWalter Dörwald2005-04-211-12/+4
| | | | | | | | | | | byte, even if the user has passed a size parameter. This extra byte shouldn't cause a buffer overflow in the tokenizer. The original plan was to return a line ending in '\r', which might be recognizable as a complete line and skip any '\n' that was read afterwards. Unfortunately this didn't work, as the tokenizer only recognizes '\n' as line ends, which in turn lead to joined lines and SyntaxErrors, so this special treatment of a split '\r\n' has been dropped. (It can only happen with a temporarily exhausted bytestream now anyway.) Fixes parts of SF bugs #1163244 and #1175396.
* Fix typos.Walter Dörwald2005-04-041-2/+2
|
* Fix for SF bug #1175396: readline() will now read one more character, ifWalter Dörwald2005-04-041-0/+9
| | | | | | | | | | | | the last character read is "\r" (and size is None, i.e. we're allowed to call read() multiple times), so that we can return the correct line ending (this additional character might be a "\n"). If the stream is temporarily exhausted, we might return the wrong line ending (if the last character read is "\r" and the next one (after the byte stream provides more data) is "\n", but at least the atcr member ensure that we get the correct number of lines (i.e. this "\n" will not be treated as another line ending.)
* typoSkip Montanaro2005-03-161-1/+1
|
* Add default value for "whence" argument.Walter Dörwald2005-03-141-1/+1
|
* Reset internal buffers when seek() is called. This fixes SF bug #1156259.Walter Dörwald2005-03-141-1/+11
|
* Build with --disable-unicode again. Fixes #1158607.Martin v. Löwis2005-03-081-5/+13
| | | | Will backport to 2.4.
* Fix and test for SF bug #1098990: codec readline() splits lines apart.Walter Dörwald2005-01-101-2/+2
|
* The changes to the stateful codecs in 2.4 resulted in StreamReader.readline()Walter Dörwald2004-12-211-30/+41
| | | | | | | | | | | | | | trying to return a complete line even if a size parameter was given (see http://www.python.org/sf/1076985). This leads to buffer overflows with long source lines under Windows if e.g. cp1252 is used as the source encoding. This patch reverts the behaviour of readline() to something that behaves more like Python 2.3: If a size parameter is given, read() is called only once. As a side effect of this, readline() now supports all types of linebreaks supported by unicode.splitlines(). Note that the tokenizer is still broken and it's possible to provoke segfaults (see http://www.python.org/sf/1089395).
* SF #1048865: Fix a trivial typo that breaks StreamReader.readlines()Hye-Shik Chang2004-10-171-1/+1
|
* SF patch #998993: The UTF-8 and the UTF-16 stateful decoders now supportWalter Dörwald2004-09-071-43/+69
| | | | | | | | | | | decoding incomplete input (when the input stream is temporarily exhausted). codecs.StreamReader now implements buffering, which enables proper readline support for the UTF-16 decoders. codecs.StreamReader.read() has a new argument chars which specifies the number of characters to return. codecs.StreamReader.readline() and codecs.StreamReader.readlines() have a new argument keepends. Trailing "\n"s will be stripped from the lines if keepends is false. Added C APIs PyUnicode_DecodeUTF8Stateful and PyUnicode_DecodeUTF16Stateful.
* Ignore sizehint argument. Fixes SF #844561.Marc-André Lemburg2004-02-261-10/+4
|
* Fix typos.Walter Dörwald2003-02-021-4/+4
|
* sys was already imported, remove second importNeal Norwitz2002-12-301-2/+0
|
* Patch to make _codecs a builtin module. This is necessary sinceMarc-André Lemburg2002-12-121-5/+15
| | | | | | | Python 2.3 will support source code encodings which rely on the builtin codecs being available to the parser. Remove struct dependency from codecs.py
* Add missing documentation for the PEP 293 functionality toWalter Dörwald2002-11-191-7/+22
| | | | the codecs docstrings.
* Add next() and __iter__() methods to StreamReader, StreamReaderWriterWalter Dörwald2002-11-061-0/+27
| | | | | | and StreamRecoder. This closes SF bug #634246.
* PEP 293 implemention (from SF patch http://www.python.org/sf/432401)Walter Dörwald2002-09-021-1/+12
|
* Add constants BOM_UTF8, BOM_UTF16, BOM_UTF16_LE, BOM_UTF16_BE,Walter Dörwald2002-06-041-17/+32
| | | | | | | | | | BOM_UTF32, BOM_UTF32_LE and BOM_UTF32_BE that represent the Byte Order Mark in UTF-8, UTF-16 and UTF-32 encodings for little and big endian systems. The old names BOM32_* and BOM64_* were off by a factor of 2. This closes SF bug http://www.python.org/sf/555360
* SF 563203. Replaced 'has_key()' with 'in'.Raymond Hettinger2002-06-011-1/+1
|
* Set default value for readlines.sizehint to None. Change needed for 2.2.1Martin v. Löwis2002-03-051-1/+1
| | | | as well.
* Added new helpers for easy access to codecs. Docs will follow.Marc-André Lemburg2001-09-191-0/+42
|
* Fix typo in commentAndrew M. Kuchling2001-09-181-1/+1
|
* Patch #444359: Remove unused imports.Martin v. Löwis2001-08-021-1/+1
|
* Add dead imports of modules that are "magically" imported.Martin v. Löwis2001-07-311-0/+6
|
* Whitespace normalization.Tim Peters2001-05-291-1/+1
|
* Moved the encoding map building logic from the individual mappingMarc-André Lemburg2001-05-161-0/+21
| | | | | | codec files to codecs.py and added logic so that multi mappings in the decoding maps now result in mappings to None (undefined mapping) in the encoding maps.
* Just changed "x,y" to "x, y" everywhere (i.e., inserted horizontal spaceTim Peters2001-05-151-37/+34
| | | | after commas that didn't have any).
* added __all__ lists to a number of Python modulesSkip Montanaro2001-01-201-0/+3
| | | | | | | | added test script and expected output file as well this closes patch 103297. __all__ attributes will be added to other modules without first submitting a patch, just adding the necessary line to the test script to verify more-or-less correct implementation.
* Whitespace normalization.Tim Peters2001-01-141-7/+7
|
* This patch changes the default behaviour of the builtin charmapMarc-André Lemburg2001-01-031-0/+15
| | | | | | | | | | | | | | | | codec to not apply Latin-1 mappings for keys which are not found in the mapping dictionaries, but instead treat them as undefined mappings. The patch was originally written by Martin v. Loewis with some additional (cosmetic) changes and an updated test script by Marc-Andre Lemburg. The standard codecs were recreated from the most current files available at the Unicode.org site using the Tools/scripts/gencodec.py tool. This patch closes the bugs #116285 and #119960.
* (Patch #102698) Fix for a bug reported by Wade Leftwich:Andrew M. Kuchling2000-12-101-4/+4
| | | | StreamReader ignores the 'errors' parameter passed to its constructor
* Remove redundent information from a docstring.Fred Drake2000-10-021-3/+0
|
* Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters2000-07-161-2/+2
| | | | | | | | | | comments, docstrings or error messages. I fixed two minor things in test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't"). There is a minor style issue involved: Guido seems to have preferred English grammar (behaviour, honour) in a couple places. This patch changes that to American, which is the more prominent style in the source. I prefer English myself, so if English is preferred, I'd be happy to supply a patch myself ;)
* Marc-Andre Lemburg <mal@lemburg.com>:Marc-André Lemburg2000-06-211-1/+6
| | | | Made codecs.open() default to 'rb' as file mode.
* Marc-Andre Lemburg:Guido van Rossum2000-05-011-2/+2
| | | | | The two methods .readline() and .readlines() in StreamReaderWriter didn't define the self argument. Found by Tom Emerson.
* M.-A. Lemburg <mal@lemburg.com>:Fred Drake2000-04-131-4/+40
| | | | Added more documentation. Clarified some existing comments.
* Deleted trailing whitespace. This is really a way to be able to addGuido van Rossum2000-04-111-14/+14
| | | | | | | | | a missing part of the previous checkin message: Marc-Andre Lemburg: Added encoding name attributes to wrapper classes which allow applications to check the used encoding names.