You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
formatwarning function signature change breaks code #49141
External code that temporarily replaces warnings.formatwarning, a
technique used in IDLE and worked around (see bpo-4043), is broken by
the addition of the optional parameter lineno to the formatwarning function.
While normal calls to functions can be "compatibly" extended with
additional optional parameters, that is not the case when the function
is substituted for, by matching its signature... if the signature is
extended, the code breaks on a Python upgrade, because the substituted
function doesn't know about the new parameter, and has fewer than are
being supplied by calls to the function.
Whether this is good, bad, documented, or appropriate, I don't know, but
it broke CherryPy 3.1.1 when running on Python 2.6, because of the new,
optional, lineno=None parameter to warnings.formatwarning
Not sure I have type and components right. I'm a newbie.
This problem probably also applies to 3.0, but I don't have the
environment to test it there at present.
I first described this problem on python-dev and the suggestion was made
to put it here (remainder of this comment is a quote):
This formatwarning compatibility problem between 2.5 and 2.6 is a bug.
Please file a new issue for this.
Activity
vpython commentedon Jan 9, 2009
External code that temporarily replaces warnings.formatwarning, a
technique used in IDLE and worked around (see bpo-4043), is broken by
the addition of the optional parameter lineno to the formatwarning function.
While normal calls to functions can be "compatibly" extended with
additional optional parameters, that is not the case when the function
is substituted for, by matching its signature... if the signature is
extended, the code breaks on a Python upgrade, because the substituted
function doesn't know about the new parameter, and has fewer than are
being supplied by calls to the function.
Whether this is good, bad, documented, or appropriate, I don't know, but
it broke CherryPy 3.1.1 when running on Python 2.6, because of the new,
optional, lineno=None parameter to warnings.formatwarning
Not sure I have type and components right. I'm a newbie.
This problem probably also applies to 3.0, but I don't have the
environment to test it there at present.
I first described this problem on python-dev and the suggestion was made
to put it here (remainder of this comment is a quote):
This formatwarning compatibility problem between 2.5 and 2.6 is a bug.
Please file a new issue for this.
-- Amaury Forgeot d'Arc
vpython commentedon Jan 9, 2009
For reference, the issue on the CherryPy tracker is #891 (amazing
numerical coincidence 891 there and 4891 here).
birkenfeld commentedon Aug 1, 2010
Probably too late to change something here.