This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vaultah
Recipients serhiy.storchaka, vaultah
Date 2014-10-23.18:17:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1414088230.61.0.979888125545.issue22619@psf.upfronthosting.co.za>
In-reply-to
Content
I think the reason this patch hasn't been discussed well is that it only changes the behavior for traceback.*_tb functions that only deal with tracebacks. I commented on the review page that we don't have to change the behavior of traceback.*_stack functions to make it obvious. Let me show an example:

import sys

def a():
    b()

def b():
    c()

def c():
    d()

def d():
    def e():
        print_stack(limit=2) # Last 2 entries
        ''' Output:
            File "file", line 331, in d                                                                                                                                                                                       
              e()                                                                                                                                                                                                                         
            File "file", line 328, in e
              print_stack(limit=2) # Last 2 entries '''
        raise Exception
    e()
    
try:
    a()
except Exception:
    print_exc(limit=2) # 2 entries from the caller
    ''' Output:
        Traceback (most recent call last):
          File "file", line 336, in <module>
            a()
          File "file", line 318, in a
            b()
        Exception '''

If we decide to unify the behavior of *_tb and *_stack functions, the change will break some existing code, although the breakage will be purely cosmetic.
History
Date User Action Args
2014-10-23 18:17:10vaultahsetrecipients: + vaultah, serhiy.storchaka
2014-10-23 18:17:10vaultahsetmessageid: <1414088230.61.0.979888125545.issue22619@psf.upfronthosting.co.za>
2014-10-23 18:17:10vaultahlinkissue22619 messages
2014-10-23 18:17:10vaultahcreate