Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspect.getsource() breakage in 2.4 #41599

Closed
arigo mannequin opened this issue Feb 18, 2005 · 5 comments
Closed

inspect.getsource() breakage in 2.4 #41599

arigo mannequin opened this issue Feb 18, 2005 · 5 comments
Labels
stdlib Python modules in the Lib dir

Comments

@arigo
Copy link
Mannequin

arigo mannequin commented Feb 18, 2005

BPO 1143895
Nosy @arigo, @simonpercivall
Files
  • inspect_bugs.diff: failing test cases
  • 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 2005-03-12.16:39:13.000>
    created_at = <Date 2005-02-18.16:26:01.000>
    labels = ['library']
    title = 'inspect.getsource() breakage in 2.4'
    updated_at = <Date 2005-03-12.16:39:13.000>
    user = 'https://github.com/arigo'

    bugs.python.org fields:

    activity = <Date 2005-03-12.16:39:13.000>
    actor = 'jlgijsbers'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2005-02-18.16:26:01.000>
    creator = 'arigo'
    dependencies = []
    files = ['1606']
    hgrepos = []
    issue_num = 1143895
    keywords = []
    message_count = 5.0
    messages = ['24351', '24352', '24353', '24354', '24355']
    nosy_count = 3.0
    nosy_names = ['arigo', 'jlgijsbers', 'simon.percivall']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1143895'
    versions = ['Python 2.4']

    @arigo
    Copy link
    Mannequin Author

    arigo mannequin commented Feb 18, 2005

    In a real-life case, inspect.getsource() used to
    produce the correct result on 2.3 but no longer does on
    2.4:

    def somefunc(x, y):  # comments
         ...body...

    With 2.4 (and 2.5 CVS) the body is completely skipped
    because the first line doesn't end with a colon. In my
    opinion that's a critical problem for any code relying
    on getsource(), even though such code can be considered
    as relying on a large pile of fragile hacks in the
    first place...

    Attached is a patch for test_inspect.py, showing the
    problem (also includes a different, much more
    convoluted bug example). It seems that looking for and
    around ':' in the first line isn't such a good idea;
    relying more fully on the tokenizer would probably be a
    better solution.

    Assigned to jlgijsbers, as the author of the changes
    that broke this (Dec 12th, 2004). (No blame intended,
    the change was meant to fix a different bug, and it did
    so.)

    @arigo arigo mannequin closed this as completed Feb 18, 2005
    @arigo arigo mannequin added the stdlib Python modules in the Lib dir label Feb 18, 2005
    @arigo arigo mannequin closed this as completed Feb 18, 2005
    @arigo arigo mannequin added the stdlib Python modules in the Lib dir label Feb 18, 2005
    @jlgijsbers
    Copy link
    Mannequin

    jlgijsbers mannequin commented Feb 18, 2005

    Logged In: YES
    user_id=469548

    Right now I don't have time to look into this bug deeply,
    but I will do so this week. I'll note that the convoluted
    example doesn't seem to be working under 2.3, though.

    @jlgijsbers
    Copy link
    Mannequin

    jlgijsbers mannequin commented Mar 9, 2005

    Logged In: YES
    user_id=469548

    Well, I'm sorry, but I can't make the time after all. I've
    asked the author of the original patch to take a look at
    this patch. Note that this code isn't yet in a 2.4 release,
    so we could also back this out before 2.4.1.

    @simonpercivall
    Copy link
    Mannequin

    simonpercivall mannequin commented Mar 9, 2005

    Logged In: YES
    user_id=329382

    Patch http://www.python.org/sf/1159931 fixes this problem.

    @jlgijsbers
    Copy link
    Mannequin

    jlgijsbers mannequin commented Mar 12, 2005

    Logged In: YES
    user_id=469548

    Simons patch has now been checked in on maint24 and HEAD.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants