cpython: ef0dbe00760e (original) (raw)
Mercurial > cpython
changeset 84642:ef0dbe00760e
Issue #18408: Don't check unicode consistency in _PyUnicode_HAS_UTF8_MEMORY() and _PyUnicode_HAS_WSTR_MEMORY() macros These macros are called in unicode_dealloc(), whereas the unicode object can be "inconsistent" if the creation of the object failed. For example, when unicode_subtype_new() fails on a memory allocation, _PyUnicode_CheckConsistency() fails with an assertion error because data is NULL. [#18408]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Mon, 15 Jul 2013 18:22:47 +0200 |
parents | 82b2ee140994 |
children | c676fc74d779 |
files | Objects/unicodeobject.c |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-)[+] [-] Objects/unicodeobject.c 6 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -122,16 +122,14 @@ extern "C" { /* true if the Unicode object has an allocated UTF-8 memory block (not shared with other data) */ #define _PyUnicode_HAS_UTF8_MEMORY(op) [](#l1.6)
- (assert(_PyUnicode_CHECK(op)), [](#l1.7)
(!PyUnicode_IS_COMPACT_ASCII(op) \[](#l1.8)
- ((!PyUnicode_IS_COMPACT_ASCII(op) [](#l1.9) && _PyUnicode_UTF8(op) [](#l1.10) && _PyUnicode_UTF8(op) != PyUnicode_DATA(op))) /* true if the Unicode object has an allocated wstr memory block (not shared with other data) */
#define _PyUnicode_HAS_WSTR_MEMORY(op) [](#l1.15)
- (assert(_PyUnicode_CHECK(op)), [](#l1.16)
(_PyUnicode_WSTR(op) && \[](#l1.17)