Author: neal.norwitz
Date: Sat Aug 25 03:04:21 2007
New Revision: 57441

Modified:
   python/branches/py3k/Objects/unicodeobject.c
Log:
Since PyUnicode_AsString is a public API, don't just assert, but do
a regular check and return an error if not unicode.


Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c        (original)
+++ python/branches/py3k/Objects/unicodeobject.c        Sat Aug 25 03:04:21 2007
@@ -1204,7 +1204,10 @@
 char*
 PyUnicode_AsString(PyObject *unicode)
 {
-    assert(PyUnicode_Check(unicode));
+    if (!PyUnicode_Check(unicode)) {
+        PyErr_BadArgument();
+        return NULL;
+    }
     unicode = _PyUnicode_AsDefaultEncodedString(unicode, NULL);
     if (!unicode)
         return NULL;
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to