[Python-checkins] r58109 - in python/branches/release25-maint: Misc/NEWS Objects/genobject.c

Guido van Rossum guido at python.org
Wed Sep 12 00:32:59 CEST 2007


Are you sure it's a good idea to add a new deprecation warning to a
2.5 bugfix release?

On 9/11/07, brett.cannon <python-checkins at python.org> wrote:
> Author: brett.cannon
> Date: Tue Sep 11 23:12:14 2007
> New Revision: 58109
>
> Modified:
>    python/branches/release25-maint/Misc/NEWS
>    python/branches/release25-maint/Objects/genobject.c
> Log:
> Cause passing a string to generator.throw() to raise a deprecation warning.
>
>
> Modified: python/branches/release25-maint/Misc/NEWS
> ==============================================================================
> --- python/branches/release25-maint/Misc/NEWS   (original)
> +++ python/branches/release25-maint/Misc/NEWS   Tue Sep 11 23:12:14 2007
> @@ -12,6 +12,9 @@
>  Core and builtins
>  -----------------
>
> +- Issue #1147: Generators were not raising a DeprecationWarning when a string
> +  was passed into throw().
> +
>  - Patch #1031213: Decode source line in SyntaxErrors back to its original source
>    encoding.
>
>
> Modified: python/branches/release25-maint/Objects/genobject.c
> ==============================================================================
> --- python/branches/release25-maint/Objects/genobject.c (original)
> +++ python/branches/release25-maint/Objects/genobject.c Tue Sep 11 23:12:14 2007
> @@ -262,6 +262,12 @@
>                              typ->ob_type->tp_name);
>                         goto failed_throw;
>         }
> +       else {
> +               /* String exceptions are deprecated. */
> +               if (PyErr_Warn(PyExc_DeprecationWarning,
> +                                       "raising string exceptions is deprecated"))
> +                       goto failed_throw;
> +       }
>
>         PyErr_Restore(typ, val, tb);
>         return gen_send_ex(gen, Py_None, 1);
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-checkins mailing list