New submission from Jean-Paul Calderone <[EMAIL PROTECTED]>:

In Python 2.5 and earlier, the `showwarning´ function in the `warnings´
module has this signature:

  def showwarning(message, category, filename, lineno, file=None):

In trunk (and presumably what will become Python 2.6), this has become:

  def showwarning(message, category, filename, lineno, file=None,
line=None):

`showwarning´ is documented as a hook which libraries or applications
may override in order to control how warnings are reported.  The
addition of a new parameter to the function and the change to related
code to call it with an argument for that new parameter means that
libraries and applications which replaced it will not work without
modification on Python 2.6.  Instead, a `TypeError´ will be raised when
a warning is emitted.

I suggest restoring the previous signature for `showwarning´ and adding
a new (perhaps preferred) API for showing a warning with the extra
information available.  It may also make sense to emit a deprecation
warning when an overridden old-style `showwarning´ is found.

----------
components: Library (Lib)
messages: 65894
nosy: exarkun
severity: normal
status: open
title: incompatible change to warnings.showwarning
type: behavior
versions: Python 2.6

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2705>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to