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

profiler: Bad return and Bad call errors with exceptions #41539

Closed
donut mannequin opened this issue Feb 7, 2005 · 7 comments
Closed

profiler: Bad return and Bad call errors with exceptions #41539

donut mannequin opened this issue Feb 7, 2005 · 7 comments
Labels
stdlib Python modules in the Lib dir

Comments

@donut
Copy link
Mannequin

donut mannequin commented Feb 7, 2005

BPO 1117670
Nosy @birkenfeld
Files
  • profile_badcall.py: test case one: 'Bad call' error.
  • profile_badreturn.py: test case two: 'Bad return' error.
  • 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 2007-11-25.17:06:01.765>
    created_at = <Date 2005-02-07.04:50:54.000>
    labels = ['library']
    title = 'profiler: Bad return and Bad call errors with exceptions'
    updated_at = <Date 2007-11-25.17:06:01.763>
    user = 'https://bugs.python.org/donut'

    bugs.python.org fields:

    activity = <Date 2007-11-25.17:06:01.763>
    actor = 'georg.brandl'
    assignee = 'none'
    closed = True
    closed_date = <Date 2007-11-25.17:06:01.765>
    closer = 'georg.brandl'
    components = ['Library (Lib)']
    creation = <Date 2005-02-07.04:50:54.000>
    creator = 'donut'
    dependencies = []
    files = ['1589', '1590']
    hgrepos = []
    issue_num = 1117670
    keywords = []
    message_count = 7.0
    messages = ['24181', '24182', '24183', '24184', '24185', '57830', '57831']
    nosy_count = 7.0
    nosy_names = ['georg.brandl', 'donut', 'edloper', 'spiv', 'adsr', 'garyoberbrunner', 'therve']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1117670'
    versions = []

    @donut
    Copy link
    Mannequin Author

    donut mannequin commented Feb 7, 2005

    I ran into a weird error when trying to profile a test
    script of mine:
    AssertionError: ('Bad call', ('', 0, 'encode'))

    I managed to whittle it down to some minimal test
    cases, which are attached (although the errors they
    generate are slightly different.)

    $ python-cvs -m profile profile_badcall.py
    Traceback (most recent call last):
    [snipped ...]
      File
    "/home/donut/usr64/python/lib/python2.5/profile.py",
    line 444, in runctx
        exec cmd in globals, locals
      File "<string>", line 1, in ?
      File "profile_badcall.py", line 10, in ?
        os.path.join("C",'b')
      File
    "/home/donut/usr64/python/lib/python2.5/posixpath.py",
    line 56, in join
        def join(a, *p):
      File
    "/home/donut/usr64/python/lib/python2.5/profile.py",
    line 228, in trace_dispatch_i
        if self.dispatch[event](self, frame, t):
      File
    "/home/donut/usr64/python/lib/python2.5/profile.py",
    line 285, in trace_dispatch_call
        assert (self.cur is None or \
    AssertionError: ('Bad call', ('profile_badcall.py', 2,
    'trier'))
    
    $ python-cvs -m profile profile_badreturn.py
    Traceback (most recent call last):
    [snipped...]
      File
    "/home/donut/usr64/python/lib/python2.5/profile.py",
    line 444, in runctx
        exec cmd in globals, locals
      File "<string>", line 1, in ?
      File
    "/home/donut/usr64/python/lib/python2.5/profile.py",
    line 228, in trace_dispatch_i
        if self.dispatch[event](self, frame, t):
      File
    "/home/donut/usr64/python/lib/python2.5/profile.py",
    line 312, in trace_dispatch_return
        assert frame is self.cur[-2].f_back, ("Bad return",
    self.cur[-3])
    AssertionError: ('Bad return', ('profile_badreturn.py',
    1, 'trier'))

    The errors occur in python CVS as of 20050206 and
    python 2.4, but not in python 2.3.4.
    OS: debian sid (3.1)
    Arch: amd64

    @donut donut mannequin added stdlib Python modules in the Lib dir labels Feb 7, 2005
    @garyoberbrunner
    Copy link
    Mannequin

    garyoberbrunner mannequin commented Mar 9, 2005

    Logged In: YES
    user_id=417980

    Is there any news on this bug? It is possibly preventing
    scons (http://scons.org) from being profiled on python 2.4
    -- we get the same errors as above. Test case is too large
    to include here, but please email me with any news if
    possible! Would be glad to test a fix.
    -- Gary

    @spiv
    Copy link
    Mannequin

    spiv mannequin commented Oct 8, 2005

    Logged In: YES
    user_id=50945

    I still see this in current python 2.4, but not in current
    python CVS.

    Also, hotshot seems to work ok in 2.4 and CVS.

    OS: ubuntu breezy (5.10)
    Arch: i386

    @adsr
    Copy link
    Mannequin

    adsr mannequin commented Feb 4, 2006

    Logged In: YES
    user_id=728207

    I've run into this bug too and decided to check the test
    cases. Here's what I found:

    1. Both test cases fail as mentioned above under Cygwin.

    2. Under native Windows Python, profile_badcall.py passes OK
      and profile_badreturn.py gives the following traceback:

    Traceback (most recent call last):
      File "c:\Python24\lib\profile.py", line 611, in ?
        run('execfile(%r)' % (sys.argv[0],), options.outfile,
    options.sort)
      File "c:\Python24\lib\profile.py", line 72, in run
        prof = prof.run(statement)
      File "c:\Python24\lib\profile.py", line 448, in run
        return self.runctx(cmd, dict, dict)
      File "c:\Python24\lib\profile.py", line 454, in runctx
        exec cmd in globals, locals
      File "<string>", line 1, in ?
      File "profile_badreturn.py", line 9, in ?
        sum(1,0)
    TypeError: iteration over non-sequence

    Python versions used:

    Python 2.4.1 (#1, May 27 2005, 18:02:40)
    [GCC 3.3.3 (cygwin special)] on cygwin

    Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit
    (Intel)] on win32

    @edloper
    Copy link
    Mannequin

    edloper mannequin commented Aug 24, 2006

    Logged In: YES
    user_id=195958

    This bug was fixed by the following check-in:

    http://mail.python.org/pipermail/python-checkins/2005-
    September/047099.html

    It should be closed. A work-around for people using older
    versions of 2.4 is to do:

    from profile import Profile
    Profile.dispatch['c_exception'] = \
              Profile.trace_dispatch_return

    @therve
    Copy link
    Mannequin

    therve mannequin commented Nov 25, 2007

    Ping to close this?

    @birkenfeld
    Copy link
    Member

    With pleasure.

    @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

    1 participant