Re: [Python-3000] sys.exc_info()

2008-06-02 Thread Fred Drake
On Jun 2, 2008, at 11:59 PM, Guido van Rossum wrote: Actually I think we won't need that function once we're used to just passing exception instances around. Ah, so many differences that I've lost track of. I feel so... py2k. :-( -Fred -- Fred Drake ___

Re: [Python-3000] sys.exc_info()

2008-06-02 Thread Guido van Rossum
On Mon, Jun 2, 2008 at 8:56 PM, Adam Olsen <[EMAIL PROTECTED]> wrote: > On Mon, Jun 2, 2008 at 9:46 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: >> On Mon, Jun 2, 2008 at 8:16 PM, Adam Olsen <[EMAIL PROTECTED]> wrote: >>> On Mon, Jun 2, 2008 at 8:56 PM, Fred Drake <[EMAIL PROTECTED]> wrote:

Re: [Python-3000] sys.exc_info()

2008-06-02 Thread Adam Olsen
On Mon, Jun 2, 2008 at 9:46 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On Mon, Jun 2, 2008 at 8:16 PM, Adam Olsen <[EMAIL PROTECTED]> wrote: >> On Mon, Jun 2, 2008 at 8:56 PM, Fred Drake <[EMAIL PROTECTED]> wrote: >>> On May 31, 2008, at 6:42 PM, Tim Delaney wrote: This reminds me

Re: [Python-3000] sys.exc_info()

2008-06-02 Thread Guido van Rossum
On Mon, Jun 2, 2008 at 8:16 PM, Adam Olsen <[EMAIL PROTECTED]> wrote: > On Mon, Jun 2, 2008 at 8:56 PM, Fred Drake <[EMAIL PROTECTED]> wrote: >> On May 31, 2008, at 6:42 PM, Tim Delaney wrote: >>> >>> This reminds me of something I've thought a few times - maybe the tuple >>> returned from sys.exc_

Re: [Python-3000] sys.exc_info()

2008-06-02 Thread Antoine Pitrou
Collin Winter gmail.com> writes: > > See PEP 3109: http://www.python.org/dev/peps/pep-3109/ By the way, this document mentions a "raise ... from ..." form, but it doesn't seem to me it has been implemented. Perhaps the document should be corrected? Also, it doesn't mention the with_traceback()

Re: [Python-3000] sys.exc_info()

2008-06-02 Thread Adam Olsen
On Mon, Jun 2, 2008 at 8:56 PM, Fred Drake <[EMAIL PROTECTED]> wrote: > On May 31, 2008, at 6:42 PM, Tim Delaney wrote: >> >> This reminds me of something I've thought a few times - maybe the tuple >> returned from sys.exc_info() should be a named tuple. > > +1 It should be replaced with a functio

Re: [Python-3000] sys.exc_info()

2008-06-02 Thread Fred Drake
On May 31, 2008, at 6:42 PM, Tim Delaney wrote: This reminds me of something I've thought a few times - maybe the tuple returned from sys.exc_info() should be a named tuple. +1 -Fred -- Fred Drake ___ Python-3000 mailing list Python-3000@

Re: [Python-3000] sys.exc_info()

2008-06-01 Thread Collin Winter
On Sat, May 31, 2008 at 6:08 PM, Mark Hammond <[EMAIL PROTECTED]> wrote: > Antoine: >> Mark Hammond skippinet.com.au> writes: >> > In both Python 2.x and 3 (a few months old build of Py3k though), the >> > traceback isn't the same. For Python 2.0 you could write it like: >> > >> > def handle_exce

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Mark Hammond
Antoine: > Mark Hammond skippinet.com.au> writes: > > In both Python 2.x and 3 (a few months old build of Py3k though), the > > traceback isn't the same. For Python 2.0 you could write it like: > > > > def handle_exception(): > > ... > > raise sys.exc_info()[0], sys.exc_info()[1], sys.exc_inf

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Antoine Pitrou
Hello again, > Why not move f_exc_* into the PyTryBlock struct? We can eliminate the > per-thread exception and have sys.exc_info() search the stack for an > active except block. No need to swap anything because the stack is > always current. Yes it's a possible implementation. At the expense

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Tim Delaney
Antoine Pitrou <[EMAIL PROTECTED]> wrote: sys.exc_info() will remain, it's just that the returned value will be (None, None, None) if we are not in an except block in any of the currently active frames in the thread. In the case above it would return the current exception (the one caught in one

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Adam Olsen
On Sat, May 31, 2008 at 2:03 PM, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > Adam Olsen gmail.com> writes: >> >> The bytecode generation for "raise" could be changed literally be the >> same as "except Foo as e: raise e". Reuse our existing stack, not add >> another one. > > As someone else point

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Antoine Pitrou
Adam Olsen gmail.com> writes: > > The bytecode generation for "raise" could be changed literally be the > same as "except Foo as e: raise e". Reuse our existing stack, not add > another one. As someone else pointed, there is a difference between the two constructs: the latter appends a line to

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Adam Olsen
On Sat, May 31, 2008 at 11:41 AM, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > Adam Olsen gmail.com> writes: >> > By the way, another interesting sys.exc_info() case: >> > >> > def except_yield(): >> >try: >> >raise TypeError >> >except: >> >yield 1 >> > >> > def f(): >> >

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Antoine Pitrou
Adam Olsen gmail.com> writes: > > By the way, another interesting sys.exc_info() case: > > > > def except_yield(): > >try: > >raise TypeError > >except: > >yield 1 > > > > def f(): > >for i in except_yield(): > >return sys.exc_info() > > > > Right now, running f

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Adam Olsen
On Sat, May 31, 2008 at 7:59 AM, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > Mark Hammond skippinet.com.au> writes: >> In both Python 2.x and 3 (a few months old build of Py3k though), the >> traceback isn't the same. For Python 2.0 you could write it like: >> >> def handle_exception(): >> ... >>

Re: [Python-3000] sys.exc_info()

2008-05-31 Thread Antoine Pitrou
Mark Hammond skippinet.com.au> writes: > In both Python 2.x and 3 (a few months old build of Py3k though), the > traceback isn't the same. For Python 2.0 you could write it like: > > def handle_exception(): > ... > raise sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2] > > Its not cl