Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12243

The RAISE_VARARGS opcode in Python 3

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'handler': 0.04; 'parameter': 0.05; 'subject:Python': 0.06; '"""': 0.07; 'pep': 0.07; 'raises': 0.07; 'python': 0.08; 'exception.': 0.09; 'indicates': 0.09; 'url:peps': 0.09; 'exception': 0.12; 'argument': 0.15; 'otoh,': 0.16; 'seems': 0.20; 'extract': 0.24; 'traceback': 0.24; 'parameters': 0.25; 'guess': 0.26; 'received:209.85.220': 0.27; 'all,': 0.28; 'raise': 0.28; 'message-id:@mail.gmail.com': 0.29; 'module': 0.30; 'url:dev': 0.30; 'url:library': 0.31; 'anyone': 0.32; 'to:addr:python-list': 0.33; 'test': 0.34; 'doc': 0.34; 'statement,': 0.34; 'thank': 0.35; 'url:python': 0.36; 'statements': 0.37; 'could': 0.38; 'received:google.com': 0.38; 'url:org': 0.38; 'received:209.85': 0.38; 'url:docs': 0.39; 'to:addr:python.org': 0.39; 'here': 0.65; 'subject:The': 0.72; 'confirm': 0.73; 'case?': 0.84; 'updated.': 0.93; 'ranging': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=SQ68tcSPyo6Z4q+u8QDZL7hEAaCofZmEzfbsn/e/0Qw=; b=NEXGphZyegBKYnPomSIZMm+WB3GUMIPJfsoEM3C7gy2vVpAZecPkpDEHyIQp+Ae+Fb Fe5nRry8coSUOZE0JwsLMiCHgAaBC3UPC0hwlMnyZqY2AcMmEOYDgMtqJAwxq48Hd6f2 5FUmmCxKyTGEGuaAdmt/vKCCdd4jakZxC3LJo=
MIME-Version 1.0
Date Fri, 26 Aug 2011 23:20:38 +0100
Subject The RAISE_VARARGS opcode in Python 3
From Arnaud Delobelle <arnodel@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
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.454.1314397241.27778.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314397241 news.xs4all.nl 2548 [2001:888:2000:d::a6]:41018
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12243

Show key headers only | View raw


Hi all,

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.  Can anyone confirm that
this is the case?  In this case, I guess the dis docs need to be
updated.

Thank you,

Arnaud

[1] http://docs.python.org/py3k/library/dis.html#opcode-RAISE_VARARGS
[2] http://www.python.org/dev/peps/pep-3109/#grammar-changes

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


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