summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-15 16:22:47 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-15 16:22:47 (GMT)
commite699e5a21869d8ced1726518044faae45dd22b9c (patch)
tree3a769cd6dbe3964078d798e951d0e9a10b049325 /Objects/unicodeobject.c
parent3de58698647221df4dc0d198bb512e7e80eec818 (diff)
downloadcpython-e699e5a21869d8ced1726518044faae45dd22b9c.zip
cpython-e699e5a21869d8ced1726518044faae45dd22b9c.tar.gz
cpython-e699e5a21869d8ced1726518044faae45dd22b9c.tar.bz2
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.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 1a44882..8ce3f96 100644
--- 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) \
- (assert(_PyUnicode_CHECK(op)), \
- (!PyUnicode_IS_COMPACT_ASCII(op) \
+ ((!PyUnicode_IS_COMPACT_ASCII(op) \
&& _PyUnicode_UTF8(op) \
&& _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) \
- (assert(_PyUnicode_CHECK(op)), \
- (_PyUnicode_WSTR(op) && \
+ ((_PyUnicode_WSTR(op) && \
(!PyUnicode_IS_READY(op) || \
_PyUnicode_WSTR(op) != PyUnicode_DATA(op))))