summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35560: Remove assertion from format(float, "n") (GH-11288) (GH-23231)Miss Islington (bot)2020-11-101-1/+1
| | | | | | | | | Fix an assertion error in format() in debug build for floating point formatting with "n" format, zero padding and small width. Release build is not impacted. Patch by Karthikeyan Singaravelan. (cherry picked from commit 3f7983a25a3d19779283c707fbdd5bc91b1587ef) Co-authored-by: Xtreak <tir.karthi@gmail.com>
* bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)Miss Islington (bot)2018-12-031-5/+4
| | | | | (cherry picked from commit 4013c179117754b039957db4730880bf3285919d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33954: Rewrite FILL() macro of unicodeobject.c (GH-10740)Victor Stinner2018-11-271-9/+17
| | | | | | | Copy code from master: add assertions on start and value, replace 'i' iterator with 'end' pointer for the loop stop condition. _PyUnicode_FastFill(): fix type of 'data', it must not be constant, since data is modified by FILL().
* bpo-33954: Fix _PyUnicode_InsertThousandsGrouping() (GH-10623) (GH-10718) ↵Victor Stinner2018-11-261-93/+152
| | | | | | | | | | | | | (GH-10720) Fix str.format(), float.__format__() and complex.__format__() methods for non-ASCII decimal point when using the "n" formatter. Rewrite _PyUnicode_InsertThousandsGrouping(): it now requires a _PyUnicodeWriter object for the buffer and a Python str object for digits. (cherry picked from commit 59423e3ddd736387cef8f7632c71954c1859bed0) (cherry picked from commit 6f5fa1b4be735159e964906ab608dc467476e47c)
* bpo-35214: Fix OOB memory access in unicode escape parser (GH-10506)Miss Islington (bot)2018-11-131-1/+1
| | | | | | | | | Discovered using clang's MemorySanitizer when it ran python3's test_fstring test_misformed_unicode_character_name. An msan build will fail by simply executing: ./python -c 'u"\N"' (cherry picked from commit 746b2d35ea47005054ed774fecaed64fab803d7d) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* bpo-34435: Add missing NULL check to unicode_encode_ucs1(). (GH-8823)Miss Islington (bot)2018-08-191-2/+3
| | | | | | Reported by Svace static analyzer. (cherry picked from commit 74a307d48ef8b278c4629ca0ef2139be1c9a34e6) Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
* bpo-32827: Fix usage of _PyUnicodeWriter_Prepare() in decoding errors ↵Miss Islington (bot)2018-02-131-7/+3
| | | | | | | handler. (GH-5636) (cherry picked from commit b7e2d67f7c035f09c921ca4e7a36529cd502ccf7) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.6] bpo-32583: Fix possible crashing in builtin Unicode decoders (GH-5325) ↵Xiang Zhang2018-01-311-2/+20
| | | | | | | (#5459) When using customized decode error handlers, it is possible for builtin decoders to write out-of-bounds and then crash.. (cherry picked from commit 2c7fd46e11333ef5e5cce34212f7d087694f3658)
* Fix wrong assert in unicodeobject (GH-5340)Miss Islington (bot)2018-01-271-1/+1
| | | (cherry picked from commit 7cc95f5069c8983afb8a55928db6956abe2d5afa)
* [3.6] bpo-32555: Fix locale encodings (#5193)Victor Stinner2018-01-151-10/+26
| | | | | | | | | | | | | | | | | On FreeBSD and Solaris, os.strerror() now always decode the byte string from the current locale encoding, rather than using ASCII/surrogateescape in some cases. Changes: * Add _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() which has an additional current_locale parameter. * PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize() and * PyUnicode_EncodeLocale() now always use the current locale * encoding, instead of using Py_DecodeLocale()/Py_EncodeLocale(). * Document encoding in Py_DecodeLocale() and Py_EncodeLocale() documentations. * Add USE_FORCE_ASCII define to not define decode_ascii_surrogateescape() on Android.
* bpo-31825: Fixed OverflowError in the 'unicode-escape' codec (GH-4058) (#4059)Miss Islington (bot)2017-10-201-1/+1
| | | | and in codecs.escape_decode() when decode an escaped non-ascii byte. (cherry picked from commit 56cb465cc93dcb35aaf7266ca3dbe2dcff1fac5f)
* [3.6] bpo-30923: Silence fall-through warnings included in -Wextra since ↵Victor Stinner2017-09-121-2/+3
| | | | | | | | | | | | | | | | gcc-7.0 (#3518) * bpo-30923: Disable warning that has been part of -Wextra since gcc-7.0. (#3142) (cherry picked from commit d73a960c575207539c3f9765cff26d4fff400b45) * bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. (#3157) (cherry picked from commit f432a3234f9f2ee09bd40be03e06bf72865ee375) * bpo-31275: Small refactoring to silence a fall-through warning. (#3206) (cherry picked from commit 138753c1b96b5e06a5c5d409fa4cae5e2fe1108b)
* [3.6] bpo-31393: Fix the use of PyUnicode_READY(). (GH-3451). (#3453)Serhiy Storchaka2017-09-081-2/+8
| | | (cherry picked from commit e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c)
* [3.6] bpo-22207: Add checks for possible integer overflows in ↵Serhiy Storchaka2017-07-111-6/+12
| | | | | | unicodeobject.c. (GH-2623) (#2658) Based on patch by Victor Stinner. (cherry picked from commit 64e461b)
* [3.6] bpo-13617: Reject embedded null characters in wchar* strings. ↵Serhiy Storchaka2017-06-281-0/+14
| | | | | | | | | | (GH-2302) (#2462) 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.6] bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). ↵Serhiy Storchaka2017-06-271-0/+31
| | | | | | | (GH-2285) (#2443) Raise a ValueError if the second argument is NULL and the wchar_t\* string contains null characters.. (cherry picked from commit e613e6add5f07ff6aad5802924596b631b707d2a)
* bpo-29802: Fix the cleaning up issue in PyUnicode_FSDecoder(). (#1217)Serhiy Storchaka2017-04-201-0/+1
|
* [3.6] bpo-29549: Fixes docstring for str.index (GH-256) (GH-1028)Mariatta2017-04-091-2/+10
| | | (cherry picked from commit 43ba8861e0ad044efafa46a7cc04e12ac5df640e)
* Expand the PySlice_GetIndicesEx macro. (#1023) (#1044)Serhiy Storchaka2017-04-081-2/+3
| | | (cherry picked from commit b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8)
* Issue #29145: Merge 3.5.Xiang Zhang2017-01-101-6/+8
|\
| * Issue #29145: Fix overflow checks in str.replace() and str.join().Xiang Zhang2017-01-101-6/+8
| | | | | | | | Based on patch by Martin Panter.
* | Issue #29044: Merge 3.5.Xiang Zhang2016-12-221-3/+4
|\ \ | |/
| * Issue #29044: Fix a use-after-free in string '%c' formatter.Xiang Zhang2016-12-221-3/+4
| |
* | Issue #26919: On Android, operating system data is now always encoded/decodedXavier de Gaye2016-12-151-3/+3
| | | | | | | | | | to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8.
* | Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions.Serhiy Storchaka2016-12-051-2/+16
|\ \ | |/
| * Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions.Serhiy Storchaka2016-12-051-2/+16
| |
* | Issue #28760: Clean up and fix comments in PyUnicode_AsUnicodeEscapeString().Serhiy Storchaka2016-11-211-10/+4
| | | | | | | | Patch by Xiang Zhang.
* | Issue #28701: _PyUnicode_EqualToASCIIId and _PyUnicode_EqualToASCIIString nowSerhiy Storchaka2016-11-161-0/+11
| | | | | | | | require ASCII right argument and assert this condition in debug build.
* | Fixed an off-by-one error in _PyUnicode_EqualToASCIIString (issue #28701).Serhiy Storchaka2016-11-161-1/+1
|\ \ | |/
| * Fixed an off-by-one error in _PyUnicode_EqualToASCIIString (issue #28701).Serhiy Storchaka2016-11-161-1/+1
| |
* | Issue #21449: Removed private function _PyUnicode_CompareWithId.Serhiy Storchaka2016-11-161-9/+0
| |
* | Issue #28701: Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.Serhiy Storchaka2016-11-161-0/+38
|\ \ | |/ | | | | | | | | The latter function is more readable, faster and doesn't raise exceptions. Based on patch by Xiang Zhang.
| * Issue #28701: Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.Serhiy Storchaka2016-11-161-0/+38
| | | | | | | | | | | | 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/+35
|\ \ | |/ | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
| * Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-0/+35
| | | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
* | Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS XSerhiy Storchaka2016-11-121-1/+1
|\ \ | |/ | | | | when decode astral characters.
| * Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS XSerhiy Storchaka2016-11-121-1/+1
| |\ | | | | | | | | | when decode astral characters.
| | * Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS XSerhiy Storchaka2016-11-121-1/+1
| | |\ | | | | | | | | | | | | when decode astral characters.
| | | * Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS XSerhiy Storchaka2016-11-121-1/+1
| | | | | | | | | | | | | | | | when decode astral characters.
| | | * Issue #25709: Fixed problem with in-place string concatenation and utf-8 cache.Serhiy Storchaka2015-12-021-0/+5
| | | |
* | | | Closes #27781: Removes special cases for the experimental aspect of PEP 529Steve Dower2016-11-071-10/+1
| | | |
* | | | Issue 28128: Print out better error/warning messages for invalid string ↵Eric V. Smith2016-10-311-6/+32
| | | | | | | | | | | | | | | | escapes. Backport to 3.6.
* | | | Issue #28426: Deprecated undocumented functions PyUnicode_AsEncodedObject(),Serhiy Storchaka2016-10-271-0/+21
| | | | | | | | | | | | | | | | | | | | PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and PyUnicode_AsEncodedUnicode().
* | | | Issue #28408: Fixed a leak and remove redundant code in ↵Serhiy Storchaka2016-10-251-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | _PyUnicodeWriter_Finish(). Patch by Xiang Zhang.
* | | | Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug ↵Serhiy Storchaka2016-10-251-10/+2
|\ \ \ \ | |/ / / | | | | | | | | build.
| * | | Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug ↵Serhiy Storchaka2016-10-251-10/+2
| |\ \ \ | | |/ / | | | | | | | | build.
| | * | Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug ↵Serhiy Storchaka2016-10-251-10/+2
| | | | | | | | | | | | | | | | build.
* | | | Issue #28410: Added _PyErr_FormatFromCause() -- the helper for raisingSerhiy Storchaka2016-10-211-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new exception with setting current exception as __cause__. _PyErr_FormatFromCause(exception, format, args...) is equivalent to Python raise exception(format % args) from sys.exc_info()[1]
* | | | merge 3.5 (#28454)Benjamin Peterson2016-10-161-4/+4
|\ \ \ \ | |/ / /
| * | | remove extra PyErr_Format arguments (closes #28454)Benjamin Peterson2016-10-161-4/+4
| | | | | | | | | | | | | | | | Patch from Xiang Zhang.