diff Modules/_codecsmodule.c @ 73600:fe2be7d35660

#13406: fix more deprecation warnings and move the deprecation of unicode-internal earlier in the code.
author Ezio Melotti <ezio.melotti@gmail.com>
date Thu, 17 Nov 2011 12:23:34 +0200
parents 4f534cd40f54
children 152d85b2da3a
line wrap: on
line diff
--- a/Modules/_codecsmodule.c	Thu Nov 17 02:20:48 2011 +0100
+++ b/Modules/_codecsmodule.c	Thu Nov 17 12:23:34 2011 +0200
@@ -677,6 +677,11 @@
     const char *data;
     Py_ssize_t len, size;
 
+    if (PyErr_WarnEx(PyExc_DeprecationWarning,
+                     "unicode_internal codec has been deprecated",
+                     1))
+        return NULL;
+
     if (!PyArg_ParseTuple(args, "O|z:unicode_internal_encode",
                           &obj, &errors))
         return NULL;
@@ -687,11 +692,6 @@
         if (PyUnicode_READY(obj) < 0)
             return NULL;
 
-        if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                         "unicode_internal codec has been deprecated",
-                         1))
-            return NULL;
-
         u = PyUnicode_AsUnicodeAndSize(obj, &len);
         if (u == NULL)
             return NULL;