summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorCharles-François Natali <cf.natali@gmail.com>2014-06-19 21:45:09 (GMT)
committerCharles-François Natali <cf.natali@gmail.com>2014-06-19 21:45:09 (GMT)
commite4cda6ce21dc268e308f0ee95e097f667f680d43 (patch)
tree083b7fbe6e01e752a0c367729b513e9dcc5c9bfd /Objects/exceptions.c
parentcee4f034385902659ec1ade666e17537eb2bc399 (diff)
parent077c9564b7f0c09352d1d918f38d2cb75fe61881 (diff)
downloadcpython-e4cda6ce21dc268e308f0ee95e097f667f680d43.zip
cpython-e4cda6ce21dc268e308f0ee95e097f667f680d43.tar.gz
cpython-e4cda6ce21dc268e308f0ee95e097f667f680d43.tar.bz2
Merge.
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 0f86cfb..e165528 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -1648,6 +1648,10 @@ UnicodeEncodeError_str(PyObject *self)
PyObject *reason_str = NULL;
PyObject *encoding_str = NULL;
+ if (!uself->object)
+ /* Not properly initialized. */
+ return PyUnicode_FromString("");
+
/* Get reason and encoding as strings, which they might not be if
they've been modified after we were contructed. */
reason_str = PyObject_Str(uself->reason);
@@ -1733,6 +1737,10 @@ UnicodeDecodeError_str(PyObject *self)
PyObject *reason_str = NULL;
PyObject *encoding_str = NULL;
+ if (!uself->object)
+ /* Not properly initialized. */
+ return PyUnicode_FromString("");
+
/* Get reason and encoding as strings, which they might not be if
they've been modified after we were contructed. */
reason_str = PyObject_Str(uself->reason);
@@ -1830,6 +1838,10 @@ UnicodeTranslateError_str(PyObject *self)
PyObject *result = NULL;
PyObject *reason_str = NULL;
+ if (!uself->object)
+ /* Not properly initialized. */
+ return PyUnicode_FromString("");
+
/* Get reason as a string, which it might not be if it's been
modified after we were contructed. */
reason_str = PyObject_Str(uself->reason);