summaryrefslogtreecommitdiffstats
path: root/Include/unicodeobject.h
Commit message (Collapse)AuthorAgeFilesLines
* [3.5] bpo-13617: Reject embedded null characters in wchar* strings. ↵Serhiy Storchaka2017-06-281-3/+7
| | | | | | | | | | (GH-2302) (#2463) Based on patch by Victor Stinner. Add private C API function _PyUnicode_AsUnicode() which is similar to PyUnicode_AsUnicode(), but checks for null characters.. (cherry picked from commit f7eae0adfcd4c50034281b2c69f461b43b68db84)
* [3.5] bpo-30708: Add private C API function _PyUnicode_AsWideCharString(). ↵Serhiy Storchaka2017-06-271-0/+6
| | | | | | | | | | (GH-2285) (GH-2443) (#2448) And use it instead of PyUnicode_AsWideCharString() if appropriate. _PyUnicode_AsWideCharString(unicode) is like PyUnicode_AsWideCharString(unicode, NULL), but raises a ValueError if the wchar_t* string contains null characters. (cherry picked from commit e613e6add5f07ff6aad5802924596b631b707d2a). (cherry picked from commit 0edffa3073b551ffeca34952529e7b292f1bd350)
* bpo-29941: Assert fixes (#886) (#956)T. Wouters2017-04-021-0/+4
| | | | | | | | | | Make a non-Py_DEBUG, asserts-enabled build of CPython possible. This means making sure helper functions are defined when NDEBUG is not defined, not just when Py_DEBUG is defined. Also fix a division-by-zero in obmalloc.c that went unnoticed because in Py_DEBUG mode, elsize is never zero. (cherry picked from commit a00c3fd12d421e41b769debd7df717d17b0deed5 and 06bb4873d6a9ac303701d08a851d6cd9a51e02a3)
* bpo-28749: Fixed the documentation of the mapping codec APIs. (#487) (#715)Serhiy Storchaka2017-03-191-27/+18
| | | | Added the documentation for PyUnicode_Translate(). (cherry picked from commit c85a26628ceb9624c96c3064e8b99033c026d8a3)
* Issue #29009: Remove outdated doc of PyUnicode_RichCompare.Xiang Zhang2016-12-191-4/+0
|
* Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions.Serhiy Storchaka2016-12-051-1/+1
|
* Issue #28701: Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.Serhiy Storchaka2016-11-161-0/+19
| | | | | | The latter function is more readable, faster and doesn't raise exceptions. Based on patch by Xiang Zhang.
* Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-0/+11
| | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
* Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().Serhiy Storchaka2016-10-021-1/+1
| | | | Original patch by Xiang Zhang.
* Issue #28139: Fix messed up indentationMartin Panter2016-09-171-1/+1
| | | | | Also update the classmethod and staticmethod doc strings and comments to match the RST documentation.
* Fix spelling and grammar in documentation and code commentsMartin Panter2016-08-041-1/+1
|
* Issue #26778: Fixed "a/an/and" typos in code comment and documentation.Serhiy Storchaka2016-04-171-1/+1
|
* Issue #15984: Correct PyUnicode_FromObject() and _FromEncodedObject() docsMartin Panter2016-04-151-16/+8
|
* Correct “an” → “a” with “Unicode”, “user”, “UTF”, etcMartin Panter2016-04-151-4/+4
| | | | This affects documentation, code comments, and a debugging messages.
* Fix typos in documentation and commentsMartin Panter2016-04-051-1/+1
|
* Issue #25523: Merge a-to-an corrections from 3.4.Serhiy Storchaka2015-11-021-2/+2
|\
| * Issue #25523: Further a-to-an corrections.Serhiy Storchaka2015-11-021-2/+2
| |
* | Issue #23908: os functions now reject paths with embedded null characterSerhiy Storchaka2015-04-201-6/+0
|\ \ | |/ | | | | | | | | on Windows instead of silently truncate them. Removed no longer used _PyUnicode_HasNULChars().
* | Merge 3.4 (typo)Victor Stinner2015-02-111-1/+1
|\ \ | |/
| * Fix typo: PyMem_Alloc => PyMem_MallocVictor Stinner2015-02-111-1/+1
| |
* | Issue20284: Implement PEP461Ethan Furman2015-01-241-0/+2
|/
* fix instances of consecutive articles (closes #23221)Benjamin Peterson2015-01-131-1/+1
| | | | Patch by Karan Goel.
* Issue #22581: Use more "bytes-like object" throughout the docs and comments.Serhiy Storchaka2014-12-051-1/+1
|
* Issue #19537: Fix PyUnicode_DATA() alignment under m68k. Patch by Andreas ↵Antoine Pitrou2014-03-231-0/+3
| | | | Schwab.
* Issue #19526: Exclude all new API from the stable ABI.Martin v. Löwis2014-01-031-0/+2
|
* oops, remove _PyObject_ReprWriter() definition (unwanted change)Victor Stinner2013-11-191-3/+0
|
* Add _PyUnicodeWriter_WriteASCIIString() functionVictor Stinner2013-11-191-3/+14
|
* Issue #19512: add _PyUnicode_CompareWithId() functionVictor Stinner2013-11-061-0/+5
| | | | | | | _PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString() when both strings are equal and interned. Add also _PyId_builtins identifier for "builtins" common string.
* Issue #18722: Remove uses of the "register" keyword in C code.Antoine Pitrou2013-08-131-4/+4
|
* fix typo in a commentVictor Stinner2013-04-181-1/+1
|
* Close #17694: Add minimum length to _PyUnicodeWriterVictor Stinner2013-04-171-7/+13
| | | | | | | | | | | | * Add also min_char attribute to _PyUnicodeWriter structure (currently unused) * _PyUnicodeWriter_Init() has no more argument (except the writer itself): min_length and overallocate must be set explicitly * In error handlers, only enable overallocation if the replacement string is longer than 1 character * CJK decoders don't use overallocation anymore * Set min_length, instead of preallocating memory using _PyUnicodeWriter_Prepare(), in many decoders * _PyUnicode_DecodeUnicodeInternal() checks for integer overflow
* Close #17693: Rewrite CJK decoders to use the _PyUnicodeWriter API instead ofVictor Stinner2013-04-111-0/+7
| | | | | | the legacy Py_UNICODE API. Add also a new _PyUnicodeWriter_WriteChar() function.
* Add _PyUnicodeWriter_WriteSubstring() functionVictor Stinner2013-04-021-0/+9
| | | | | | | | | Write a function to enable more optimizations: * If the substring is the whole string and overallocation is disabled, just keep a reference to the string, don't copy characters * Avoid a call to the expensive _PyUnicode_FindMaxChar() function when possible
* Issue #16455: On FreeBSD and Solaris, if the locale is C, theVictor Stinner2012-12-041-1/+1
| | | | | | | ASCII/surrogateescape codec is now used, instead of the locale encoding, to decode the command line arguments. This change fixes inconsistencies with os.fsencode() and os.fsdecode() because these operating systems announces an ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
* Issue #16330: Use surrogate-related macrosVictor Stinner2012-10-301-3/+3
| | | | Patch written by Serhiy Storchaka.
* Issue #16147: Rewrite PyUnicode_FromFormatV() to use _PyUnicodeWriter APIVictor Stinner2012-10-061-1/+17
| | | | | | | | | | | | | | | | | | | | * Simplify the code: replace 4 steps with one unique step using the _PyUnicodeWriter API. PyUnicode_Format() has the same design. It avoids to store intermediate results which require to allocate an array of pointers on the heap. * Use the _PyUnicodeWriter API for speed (and its convinient API): overallocate the buffer to reduce the number of "realloc()" * Implement "width" and "precision" in Python, don't rely on sprintf(). It avoids to need of a temporary buffer allocated on the heap: only use a small buffer allocated in the stack. * Add _PyUnicodeWriter_WriteCstr() function * Split PyUnicode_FromFormatV() into two functions: add unicode_fromformat_arg(). * Inline parse_format_flags(): the format of an argument is now only parsed once, it's no more needed to have a subfunction. * Optimize PyUnicode_FromFormatV() for characters between two "%" arguments: search the next "%" and copy the substring in one chunk, instead of copying character per character.
* #16127: merge with 3.3.Ezio Melotti2012-10-051-2/+1
|\
| * #16127: remove outdated references to narrow builds. Patch by Serhiy Storchaka.Ezio Melotti2012-10-051-2/+1
| |
* | Enable also ptr==ptr optimization in PyUnicode_Compare()Victor Stinner2012-10-041-1/+2
|/ | | | It was already implemented in PyUnicode_RichCompare()
* Issue #15026: utf-16 encoding is now significantly faster (up to 10x).Antoine Pitrou2012-06-151-2/+2
| | | | Patch by Serhiy Storchaka.
* Issue #14993: Use standard "unsigned char" instead of a unsigned char bitfieldVictor Stinner2012-06-041-6/+4
|
* Issue #14744: Use the new _PyUnicodeWriter internal API to speed up str%args ↵Victor Stinner2012-05-291-6/+89
| | | | | | | | | | | | | | | | | and str.format(args) * Formatting string, int, float and complex use the _PyUnicodeWriter API. It avoids a temporary buffer in most cases. * Add _PyUnicodeWriter_WriteStr() to restore the PyAccu optimization: just keep a reference to the string if the output is only composed of one string * Disable overallocation when formatting the last argument of str%args and str.format(args) * Overallocation allocates at least 100 characters: add min_length attribute to the _PyUnicodeWriter structure * Add new private functions: _PyUnicode_FastCopyCharacters(), _PyUnicode_FastFill() and _PyUnicode_FromASCII() The speed up is around 20% in average.
* Close #14648: Compute correctly maxchar in str.format() for substrinVictor Stinner2012-04-231-0/+9
|
* Close #14085: remove assertions from PyUnicode_WRITE macroVictor Stinner2012-03-041-3/+0
| | | | | Add checks in PyUnicode_WriteChar() and convert PyUnicode_New() assertion to a test raising a Python exception.
* Issue #13706: Fix format(int, "n") for locale with non-ASCII thousands separatorVictor Stinner2012-02-231-15/+3
| | | | | | | | | | | * Decode thousands separator and decimal point using PyUnicode_DecodeLocale() (from the locale encoding), instead of decoding them implicitly from latin1 * Remove _PyUnicode_InsertThousandsGroupingLocale(), it was not used * Change _PyUnicode_InsertThousandsGrouping() API to return the maximum character if unicode is NULL * Replace MIN/MAX macros by Py_MIN/Py_MAX * stringlib/undef.h undefines STRINGLIB_IS_UNICODE * stringlib/localeutil.h only supports Unicode
* Issue #13706: Add assertions to detect bugs earlierVictor Stinner2012-01-311-0/+3
|
* Issue #13848: open() and the FileIO constructor now check for NUL characters ↵Antoine Pitrou2012-01-291-0/+6
|\ | | | | | | | | | | in the file name. Patch by Hynek Schlawack.
| * Issue #13848: open() and the FileIO constructor now check for NUL characters ↵Antoine Pitrou2012-01-291-0/+6
| | | | | | | | | | | | in the file name. Patch by Hynek Schlawack.
* | use the static identifier api for looking up special methodsBenjamin Peterson2012-01-221-29/+0
| | | | | | | | | | I had to move the static identifier code from unicodeobject.h to object.h in order for this to work.
* | add str.casefold() (closes #13752)Benjamin Peterson2012-01-141-0/+5
| |