diff Objects/typeobject.c @ 68399:ee259a4f3eee

Issue 9856: Change object.__format__ with a non-empty format string from a PendingDeprecationWarning to a DeprecationWarning.
author Eric V. Smith <eric@trueblade.com>
date Sat, 12 Mar 2011 10:08:48 -0500
parents ff0220c9d213
children db73857669fb
line wrap: on
line diff
--- a/Objects/typeobject.c	Sat Mar 12 15:56:09 2011 +0100
+++ b/Objects/typeobject.c	Sat Mar 12 10:08:48 2011 -0500
@@ -3401,21 +3401,21 @@
     self_as_str = PyObject_Str(self);
     if (self_as_str != NULL) {
         /* Issue 7994: If we're converting to a string, we
-	   should reject format specifications */
+           should reject format specifications */
         if (PyUnicode_GET_SIZE(format_spec) > 0) {
-	    if (PyErr_WarnEx(PyExc_PendingDeprecationWarning,
-			     "object.__format__ with a non-empty format "
-			     "string is deprecated", 1) < 0) {
-	      goto done;
-	    }
-	    /* Eventually this will become an error:
-	       PyErr_Format(PyExc_TypeError,
-	       "non-empty format string passed to object.__format__");
-	       goto done;
-	    */
-	}
-
-	result = PyObject_Format(self_as_str, format_spec);
+            if (PyErr_WarnEx(PyExc_DeprecationWarning,
+                             "object.__format__ with a non-empty format "
+                             "string is deprecated", 1) < 0) {
+              goto done;
+            }
+            /* Eventually this will become an error:
+               PyErr_Format(PyExc_TypeError,
+               "non-empty format string passed to object.__format__");
+               goto done;
+            */
+        }
+
+        result = PyObject_Format(self_as_str, format_spec);
     }
 
 done: