Skip to content

formatwarning function signature change breaks code #49141

Closed

Description

@vpython
mannequin
BPO 4891
Nosy @birkenfeld

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2010-08-01.07:39:58.674>
created_at = <Date 2009-01-09.11:08:59.197>
labels = ['interpreter-core', 'type-bug']
title = 'formatwarning function signature change breaks code'
updated_at = <Date 2010-08-01.07:39:58.672>
user = 'https://bugs.python.org/vpython'

bugs.python.org fields:

activity = <Date 2010-08-01.07:39:58.672>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2010-08-01.07:39:58.674>
closer = 'georg.brandl'
components = ['Interpreter Core']
creation = <Date 2009-01-09.11:08:59.197>
creator = 'v+python'
dependencies = []
files = []
hgrepos = []
issue_num = 4891
keywords = []
message_count = 3.0
messages = ['79462', '79463', '112275']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'v+python']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'test needed'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue4891'
versions = ['Python 2.6']

Activity

  1. vpython commented on Jan 9, 2009

    vpythonmannequin
    MannequinAuthor

    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

  2. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    on Jan 9, 2009
  3. vpython commented on Jan 9, 2009

    vpythonmannequin
    MannequinAuthor

    For reference, the issue on the CherryPy tracker is #891 (amazing
    numerical coincidence 891 there and 4891 here).

  4. added
    type-bugAn unexpected behavior, bug, or error
    and removed
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Feb 9, 2010
  5. birkenfeld commented on Aug 1, 2010

    @birkenfeld
    Member

    Probably too late to change something here.

  6. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions