summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2006-08-14 10:55:19 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2006-08-14 10:55:19 (GMT)
commit040f76b79c0ce86dc33b9c525fbcd84b2254e559 (patch)
treee907d6c112d52b1a92d7b98c63023ca338c9a188 /Objects/exceptions.c
parente6dd31c50be76a5b57917226e16bdaa6ca20a28f (diff)
downloadcpython-040f76b79c0ce86dc33b9c525fbcd84b2254e559.zip
cpython-040f76b79c0ce86dc33b9c525fbcd84b2254e559.tar.gz
cpython-040f76b79c0ce86dc33b9c525fbcd84b2254e559.tar.bz2
Slightly revised version of patch #1538956:
Replace UnicodeDecodeErrors raised during == and != compares of Unicode and other objects with a new UnicodeWarning. All other comparisons continue to raise exceptions. Exceptions other than UnicodeDecodeErrors are also left untouched.
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index be9627c..c3ead69 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -1948,6 +1948,14 @@ SimpleExtendsException(PyExc_Warning, ImportWarning,
"Base class for warnings about probable mistakes in module imports");
+/*
+ * UnicodeWarning extends Warning
+ */
+SimpleExtendsException(PyExc_Warning, UnicodeWarning,
+ "Base class for warnings about Unicode related problems, mostly\n"
+ "related to conversion problems.");
+
+
/* Pre-computed MemoryError instance. Best to create this as early as
* possible and not wait until a MemoryError is actually raised!
*/
@@ -2048,6 +2056,7 @@ _PyExc_Init(void)
PRE_INIT(RuntimeWarning)
PRE_INIT(FutureWarning)
PRE_INIT(ImportWarning)
+ PRE_INIT(UnicodeWarning)
m = Py_InitModule4("exceptions", functions, exceptions_doc,
(PyObject *)NULL, PYTHON_API_VERSION);
@@ -2113,6 +2122,7 @@ _PyExc_Init(void)
POST_INIT(RuntimeWarning)
POST_INIT(FutureWarning)
POST_INIT(ImportWarning)
+ POST_INIT(UnicodeWarning)
PyExc_MemoryErrorInst = BaseException_new(&_PyExc_MemoryError, NULL, NULL);
if (!PyExc_MemoryErrorInst)