Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 72677:411c0734cf48
Add DONT_MAKE_RESULT_READY to unicodeobject.c to help detecting bugs
Use also _PyUnicode_READY_REPLACE() when it's applicable.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Tue, 04 Oct 2011 20:05:46 +0200 |
| parents | 3e721c405093 |
| children | a81f5ced46a8 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Tue Oct 04 20:04:52 2011 +0200 +++ b/Objects/unicodeobject.c Tue Oct 04 20:05:46 2011 +0200 @@ -2625,10 +2625,12 @@ goto onError; } Py_DECREF(buffer); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&unicode)) { Py_DECREF(unicode); return NULL; } +#endif return unicode; onError: @@ -3674,10 +3676,12 @@ Py_XDECREF(errorHandler); Py_XDECREF(exc); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&unicode)) { Py_DECREF(unicode); return NULL; } +#endif return (PyObject *)unicode; onError: @@ -4244,10 +4248,12 @@ Py_XDECREF(errorHandler); Py_XDECREF(exc); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&unicode)) { Py_DECREF(unicode); return NULL; } +#endif return (PyObject *)unicode; onError: @@ -4747,10 +4753,12 @@ Py_XDECREF(errorHandler); Py_XDECREF(exc); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&unicode)) { Py_DECREF(unicode); return NULL; } +#endif return (PyObject *)unicode; onError: @@ -5145,10 +5153,12 @@ Py_XDECREF(errorHandler); Py_XDECREF(exc); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&unicode)) { Py_DECREF(unicode); return NULL; } +#endif return (PyObject *)unicode; onError: @@ -5604,10 +5614,12 @@ } Py_XDECREF(errorHandler); Py_XDECREF(exc); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&v)) { Py_DECREF(v); return NULL; } +#endif return (PyObject *)v; ucnhashError: @@ -5905,10 +5917,12 @@ goto onError; Py_XDECREF(errorHandler); Py_XDECREF(exc); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&v)) { Py_DECREF(v); return NULL; } +#endif return (PyObject *)v; onError: @@ -6093,10 +6107,12 @@ goto onError; Py_XDECREF(errorHandler); Py_XDECREF(exc); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&v)) { Py_DECREF(v); return NULL; } +#endif return (PyObject *)v; onError: @@ -6519,10 +6535,12 @@ goto onError; Py_XDECREF(errorHandler); Py_XDECREF(exc); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&v)) { Py_DECREF(v); return NULL; } +#endif return (PyObject *)v; onError: @@ -6713,10 +6731,12 @@ goto retry; } #endif +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&v)) { Py_DECREF(v); return NULL; } +#endif return (PyObject *)v; } @@ -7012,10 +7032,12 @@ goto onError; Py_XDECREF(errorHandler); Py_XDECREF(exc); +#ifndef DONT_MAKE_RESULT_READY if (_PyUnicode_READY_REPLACE(&v)) { Py_DECREF(v); return NULL; } +#endif return (PyObject *)v; onError: @@ -8057,10 +8079,12 @@ p[i] = '0' + decimal; } } - if (PyUnicode_READY((PyUnicodeObject*)result) == -1) { +#ifndef DONT_MAKE_RESULT_READY + if (_PyUnicode_READY_REPLACE(&result)) { Py_DECREF(result); return NULL; } +#endif return result; } /* --- Decimal Encoder ---------------------------------------------------- */ @@ -10265,10 +10289,12 @@ } } assert (j == PyUnicode_GET_LENGTH(u)); - if (PyUnicode_READY(u)) { +#ifndef DONT_MAKE_RESULT_READY + if (_PyUnicode_READY_REPLACE(&u)) { Py_DECREF(u); return NULL; } +#endif return (PyObject*) u; overflow:
