Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12251
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <arnodel@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'handler': 0.04; 'parameter': 0.05; 'subject:Python': 0.06; '"""': 0.07; 'pep': 0.07; 'practice,': 0.07; 'raises': 0.07; 'python': 0.08; '>>>>': 0.09; 'exception.': 0.09; 'indicates': 0.09; 'exception': 0.12; 'argument': 0.15; 'forgotten': 0.15; '"bad': 0.16; '"raise"': 0.16; '::=': 0.16; '[expression': 0.16; '``raise``': 0.16; 'otoh,': 0.16; 'raise_stmt': 0.16; 'skip:\xc2 30': 0.16; 'v);': 0.16; 'cc:addr:python-list': 0.16; 'syntax': 0.16; 'wrote:': 0.16; 'cc:no real name:2**0': 0.20; 'seems': 0.20; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'extract': 0.24; 'traceback': 0.24; 'parameters': 0.25; 'statement': 0.25; "i'm": 0.27; 'raise': 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.30; 'example': 0.30; 'module': 0.30; 'null;': 0.30; 'skip:\xc2 20': 0.30; 'thanks': 0.30; 'does': 0.32; "i've": 0.34; '...': 0.34; 'test': 0.34; 'things': 0.34; 'doc': 0.34; 'end.': 0.34; 'statement,': 0.34; '8bit%:6': 0.37; 'statements': 0.37; 'could': 0.38; 'some': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'here': 0.65; 'cause': 0.67; 'august': 0.70; 'subject:The': 0.72; 'otten': 0.84; 'received:209.85.218.46': 0.91; 'received:mail- yi0-f46.google.com': 0.91; 'ranging': 0.95 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=W6mtrCFlVsc2A58cpZR8X5+UfLORo5rKS9H8AhldC7g=; b=blcyNLLyJV3ydRHLxzrAP1/zXi3gJftia0mXsSNVLWC0fzrnAjSJMAj7OZ/2/W/BNT zW8kRUbXqgUCWJcYvUaS4tCEGdH0xiS+U/zVHunGOKRwOUhPLusw1RFtfJZXN6kKD7dn 19ybICES0WYzrx2i9B8BzeJBZxYElMyrJw12c= |
| MIME-Version | 1.0 |
| In-Reply-To | <j3a428$16b$1@solani.org> |
| References | <mailman.454.1314397241.27778.python-list@python.org> <j3a428$16b$1@solani.org> |
| Date | Sat, 27 Aug 2011 08:00:34 +0100 |
| Subject | Re: The RAISE_VARARGS opcode in Python 3 |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| To | Peter Otten <__peter__@web.de> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.456.1314428436.27778.python-list@python.org> (permalink) |
| Lines | 67 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1314428436 news.xs4all.nl 2448 [2001:888:2000:d::a6]:60927 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:12251 |
Show key headers only | View raw
On 27 August 2011 07:49, Peter Otten <__peter__@web.de> wrote:
> Arnaud Delobelle wrote:
>
>> Here is an extract from the dis module doc [1]
>>
>> """
>> RAISE_VARARGS(argc)
>> Raises an exception. argc indicates the number of parameters to the
>> raise statement, ranging from 0 to 3. The handler will find the
>> traceback as TOS2, the parameter as TOS1, and the exception as TOS.
>> """
>>
>> OTOH, looking at PEP 3109:
>>
>> """
>> In Python 3, the grammar for raise statements will change from [2]
>>
>> raise_stmt: 'raise' [test [',' test [',' test]]]
>> to
>>
>> raise_stmt: 'raise' [test]
>> """
>>
>> So it seems that RAISE_VARARGS's argument can only be 0 or 1 in Python
>> 3, whereas it could be up to 3 in Python 2.
>
> It can be up to 2 in Python 3,
>
>>>> help("raise")
> The ``raise`` statement
> ***********************
>
> raise_stmt ::= "raise" [expression ["from" expression]]
> ...
>
> confirmed by a quick look into ceval.c:
>
> TARGET(RAISE_VARARGS)
> v = w = NULL;
> switch (oparg) {
> case 2:
> v = POP(); /* cause */
> case 1:
> w = POP(); /* exc */
> case 0: /* Fallthrough */
> why = do_raise(w, v);
> break;
> default:
> PyErr_SetString(PyExc_SystemError,
> "bad RAISE_VARARGS oparg");
> why = WHY_EXCEPTION;
> break;
> }
> break;
Thanks again, Peter! I'm out of Python practice, and I've forgotten
some things like help("keyword"). Also PEP 3109 does indeed mention
the raise .. from .. syntax in an example at the end.
--
Arnaud
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
The RAISE_VARARGS opcode in Python 3 Arnaud Delobelle <arnodel@gmail.com> - 2011-08-26 23:20 +0100
Re: The RAISE_VARARGS opcode in Python 3 Peter Otten <__peter__@web.de> - 2011-08-27 08:49 +0200
Re: The RAISE_VARARGS opcode in Python 3 Arnaud Delobelle <arnodel@gmail.com> - 2011-08-27 08:00 +0100
csiph-web