summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-10-04 00:32:58 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-10-04 00:32:58 (GMT)
commitaa7712711d85ded84055d8deffa6177b7b763b0e (patch)
treed511c1826fa26e6ccdd8b17a0f69c926f1672f46 /Objects
parenta4708231e6db33e182e823d827d83165d4ce4b38 (diff)
downloadcpython-aa7712711d85ded84055d8deffa6177b7b763b0e.zip
cpython-aa7712711d85ded84055d8deffa6177b7b763b0e.tar.gz
cpython-aa7712711d85ded84055d8deffa6177b7b763b0e.tar.bz2
unicode_result_wchar(): move the assert() to the "#ifdef Py_DEBUG" block
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 2481b96..98b10e9 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -412,8 +412,6 @@ unicode_result_wchar(PyObject *unicode)
#ifndef Py_DEBUG
Py_ssize_t len;
- assert(Py_REFCNT(unicode) == 1);
-
len = _PyUnicode_WSTR_LENGTH(unicode);
if (len == 0) {
Py_INCREF(unicode_empty);
@@ -431,10 +429,12 @@ unicode_result_wchar(PyObject *unicode)
}
if (_PyUnicode_Ready(unicode) < 0) {
- Py_XDECREF(unicode);
+ Py_DECREF(unicode);
return NULL;
}
#else
+ assert(Py_REFCNT(unicode) == 1);
+
/* don't make the result ready in debug mode to ensure that the caller
makes the string ready before using it */
assert(_PyUnicode_CheckConsistency(unicode, 1));