2024-05-08 16:34:40 -03:00
:mod: `!dis` --- Disassembler for Python bytecode
================================================
2007-08-15 11:28:22 -03:00
.. module :: dis
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
:synopsis: Disassembler for Python bytecode.
2007-08-15 11:28:22 -03:00
2011-01-09 23:26:08 -04:00
**Source code:** :source: `Lib/dis.py`
2007-08-15 11:28:22 -03:00
2022-06-03 07:02:58 -03:00
.. testsetup ::
import dis
def myfunc(alist):
return len(alist)
2011-01-10 15:54:11 -04:00
--------------
2010-07-02 19:03:00 -03:00
The :mod: `dis` module supports the analysis of CPython :term: `bytecode` by
2015-03-02 10:31:40 -04:00
disassembling it. The CPython bytecode which this module takes as an input is
defined in the file :file: `Include/opcode.h` and used by the compiler and the
interpreter.
2007-08-15 11:28:22 -03:00
2010-07-03 07:21:50 -03:00
.. impl-detail ::
2011-01-09 23:26:08 -04:00
Bytecode is an implementation detail of the CPython interpreter. No
2010-07-03 07:21:50 -03:00
guarantees are made that bytecode will not be added, removed, or changed
between versions of Python. Use of this module should not be considered to
work across Python VMs or Python releases.
2017-03-24 18:05:04 -03:00
.. versionchanged :: 3.6
Use 2 bytes for each instruction. Previously the number of bytes varied
by instruction.
2022-10-07 10:54:21 -03:00
.. versionchanged :: 3.10
The argument of jump, exception handling and loop instructions is now
the instruction offset rather than the byte offset.
2022-02-25 08:11:34 -04:00
.. versionchanged :: 3.11
Some instructions are accompanied by one or more inline cache entries,
which take the form of :opcode: `CACHE` instructions. These instructions
are hidden by default, but can be shown by passing `` show_caches=True `` to
2022-10-25 19:58:04 -03:00
any :mod: `dis` utility. Furthermore, the interpreter now adapts the
bytecode to specialize it for different runtime conditions. The
adaptive bytecode can be shown by passing `` adaptive=True `` .
2022-02-25 08:11:34 -04:00
2023-10-17 09:59:34 -03:00
.. versionchanged :: 3.12
The argument of a jump is the offset of the target instruction relative
to the instruction that appears immediately after the jump instruction's
:opcode: `CACHE` entries.
As a consequence, the presence of the :opcode: `CACHE` instructions is
transparent for forward jumps but needs to be taken into account when
reasoning about backward jumps.
2010-07-02 19:03:00 -03:00
2023-11-22 18:36:55 -04:00
.. versionchanged :: 3.13
The output shows logical labels rather than instruction offsets
for jump targets and exception handlers. The `` -O `` command line
option and the `` show_offsets `` argument were added.
2024-08-21 10:46:24 -03:00
.. versionchanged :: 3.14
The :option: `-P <dis --show-positions>` command-line option
and the `` show_positions `` argument were added.
2023-08-25 08:28:47 -03:00
Example: Given the function :func: `!myfunc` ::
2007-08-15 11:28:22 -03:00
def myfunc(alist):
return len(alist)
2013-05-06 10:59:20 -03:00
the following command can be used to display the disassembly of
2023-08-25 08:28:47 -03:00
:func: `!myfunc` :
2007-08-15 11:28:22 -03:00
2022-06-03 07:02:58 -03:00
.. doctest ::
2022-01-28 08:42:30 -04:00
2022-06-03 07:02:58 -03:00
>>> dis.dis(myfunc)
2023-11-22 18:36:55 -04:00
2 RESUME 0
2022-06-03 07:02:58 -03:00
<BLANKLINE>
2023-11-22 18:36:55 -04:00
3 LOAD_GLOBAL 1 (len + NULL)
LOAD_FAST 0 (alist)
CALL 1
RETURN_VALUE
2007-08-15 11:28:22 -03:00
(The "2" is a line number).
2023-10-10 19:31:28 -03:00
.. _dis-cli:
Command-line interface
----------------------
The :mod: `dis` module can be invoked as a script from the command line:
.. code-block :: sh
2024-08-21 10:46:24 -03:00
python -m dis [-h] [-C] [-O] [-P] [infile]
2023-10-10 19:31:28 -03:00
The following options are accepted:
.. program :: dis
.. cmdoption :: -h, --help
Display usage and exit.
.. cmdoption :: -C, --show-caches
Show inline caches.
2023-11-22 18:36:55 -04:00
.. cmdoption :: -O, --show-offsets
Show offsets of instructions.
2024-08-21 10:46:24 -03:00
.. cmdoption :: -P, --show-positions
Show positions of instructions in the source code.
2023-10-10 19:31:28 -03:00
If :file: `infile` is specified, its disassembled code will be written to stdout.
2024-05-07 06:23:06 -03:00
Otherwise, disassembly is performed on compiled source code received from stdin.
2023-10-10 19:31:28 -03:00
2013-05-06 10:59:20 -03:00
Bytecode analysis
-----------------
2007-08-15 11:28:22 -03:00
2014-01-07 15:30:17 -04:00
.. versionadded :: 3.4
2013-05-06 10:59:20 -03:00
The bytecode analysis API allows pieces of Python code to be wrapped in a
2015-03-02 10:31:40 -04:00
:class: `Bytecode` object that provides easy access to details of the compiled
code.
2013-05-06 10:59:20 -03:00
2022-10-25 19:58:04 -03:00
.. class :: Bytecode(x, *, first_line=None, current_offset=None,\
2024-08-21 10:46:24 -03:00
show_caches=False, adaptive=False, show_offsets=False,\
show_positions=False)
2013-05-06 10:59:20 -03:00
2017-08-17 23:29:21 -03:00
Analyse the bytecode corresponding to a function, generator, asynchronous
generator, coroutine, method, string of source code, or a code object (as
returned by :func: `compile` ).
2013-05-06 10:59:20 -03:00
2015-03-02 10:31:40 -04:00
This is a convenience wrapper around many of the functions listed below, most
notably :func: `get_instructions` , as iterating over a :class: `Bytecode`
instance yields the bytecode operations as :class: `Instruction` instances.
2013-05-06 10:59:20 -03:00
2016-10-19 10:29:26 -03:00
If *first_line* is not `` None `` , it indicates the line number that should be
2015-03-02 10:31:40 -04:00
reported for the first source line in the disassembled code. Otherwise, the
source line information (if any) is taken directly from the disassembled code
object.
2013-05-06 10:59:20 -03:00
2016-10-19 10:29:26 -03:00
If *current_offset* is not `` None `` , it refers to an instruction offset in the
2015-03-02 10:31:40 -04:00
disassembled code. Setting this means :meth: `.dis` will display a "current
instruction" marker against the specified opcode.
2013-11-22 10:57:00 -04:00
2022-10-25 19:58:04 -03:00
If *show_caches* is `` True `` , :meth: `.dis` will display inline cache
entries used by the interpreter to specialize the bytecode.
If *adaptive* is `` True `` , :meth: `.dis` will display specialized bytecode
that may be different from the original bytecode.
2023-11-22 18:36:55 -04:00
If *show_offsets* is `` True `` , :meth: `.dis` will include instruction
offsets in the output.
2024-08-21 10:46:24 -03:00
If *show_positions* is `` True `` , :meth: `.dis` will include instruction
source code positions in the output.
2022-02-25 08:11:34 -04:00
.. classmethod :: from_traceback(tb, *, show_caches=False)
2013-11-22 10:57:00 -04:00
2015-03-02 10:31:40 -04:00
Construct a :class: `Bytecode` instance from the given traceback, setting
*current_offset* to the instruction responsible for the exception.
2013-11-22 10:57:00 -04:00
2013-05-06 10:59:20 -03:00
.. data :: codeobj
The compiled code object.
2013-11-06 08:08:36 -04:00
.. data :: first_line
2013-05-06 10:59:20 -03:00
2013-11-06 08:08:36 -04:00
The first source line of the code object (if available)
.. method :: dis()
2015-03-02 10:27:43 -04:00
Return a formatted view of the bytecode operations (the same as printed by
:func: `dis.dis` , but returned as a multi-line string).
2013-05-06 10:59:20 -03:00
.. method :: info()
Return a formatted multi-line string with detailed information about the
code object, like :func: `code_info` .
2017-08-17 23:29:21 -03:00
.. versionchanged :: 3.7
This can now handle coroutine and asynchronous generator objects.
2022-02-25 08:11:34 -04:00
.. versionchanged :: 3.11
2022-10-25 19:58:04 -03:00
Added the *show_caches* and *adaptive* parameters.
2022-02-25 08:11:34 -04:00
2024-08-21 10:46:24 -03:00
.. versionchanged :: 3.13
Added the *show_offsets* parameter
.. versionchanged :: 3.14
Added the *show_positions* parameter.
2022-06-03 07:02:58 -03:00
Example:
.. doctest ::
2013-05-06 10:59:20 -03:00
>>> bytecode = dis.Bytecode(myfunc)
>>> for instr in bytecode:
... print(instr.opname)
...
2022-01-28 08:42:30 -04:00
RESUME
2013-05-06 10:59:20 -03:00
LOAD_GLOBAL
LOAD_FAST
2022-01-28 08:42:30 -04:00
CALL
2013-05-06 10:59:20 -03:00
RETURN_VALUE
Analysis functions
------------------
2015-03-02 10:31:40 -04:00
The :mod: `dis` module also defines the following analysis functions that convert
the input directly to the desired output. They can be useful if only a single
operation is being performed, so the intermediate analysis object isn't useful:
2007-08-15 11:28:22 -03:00
2010-09-10 11:08:04 -03:00
.. function :: code_info(x)
2010-08-17 05:03:36 -03:00
2010-08-17 12:07:14 -03:00
Return a formatted multi-line string with detailed code object information
2017-08-17 23:29:21 -03:00
for the supplied function, generator, asynchronous generator, coroutine,
method, source code string or code object.
2010-08-17 05:03:36 -03:00
2010-08-17 12:07:14 -03:00
Note that the exact contents of code info strings are highly implementation
dependent and they may change arbitrarily across Python VMs or Python
releases.
2010-08-17 05:03:36 -03:00
.. versionadded :: 3.2
2017-08-17 23:29:21 -03:00
.. versionchanged :: 3.7
This can now handle coroutine and asynchronous generator objects.
2010-08-17 12:07:14 -03:00
2013-05-06 10:59:20 -03:00
.. function :: show_code(x, *, file=None)
2010-09-10 11:08:04 -03:00
Print detailed code object information for the supplied function, method,
2013-08-23 16:41:39 -03:00
source code string or code object to *file* (or `` sys.stdout `` if *file*
is not specified).
2010-09-10 11:08:04 -03:00
2013-05-06 10:59:20 -03:00
This is a convenient shorthand for `` print(code_info(x), file=file) `` ,
intended for interactive exploration at the interpreter prompt.
2010-09-10 11:08:04 -03:00
.. versionadded :: 3.2
2013-05-06 10:59:20 -03:00
.. versionchanged :: 3.4
2014-11-11 04:02:11 -04:00
Added *file* parameter.
2013-05-06 10:59:20 -03:00
2024-08-21 10:46:24 -03:00
.. function :: dis(x=None, *, file=None, depth=None, show_caches=False,\
adaptive=False, show_offsets=False, show_positions=False)
2007-08-15 11:28:22 -03:00
2010-08-17 12:07:14 -03:00
Disassemble the *x* object. *x* can denote either a module, a class, a
2018-10-05 11:17:18 -03:00
method, a function, a generator, an asynchronous generator, a coroutine,
2017-08-17 23:29:21 -03:00
a code object, a string of source code or a byte sequence of raw bytecode.
For a module, it disassembles all functions. For a class, it disassembles
all methods (including class and static methods). For a code object or
sequence of raw bytecode, it prints one line per bytecode instruction.
2023-05-26 14:48:17 -03:00
It also recursively disassembles nested code objects. These can include
generator expressions, nested functions, the bodies of nested classes,
and the code objects used for :ref: `annotation scopes <annotation-scopes>` .
2017-06-11 08:09:39 -03:00
Strings are first compiled to code objects with the :func: `compile`
2016-04-23 03:23:52 -03:00
built-in function before being disassembled. If no object is provided, this
function disassembles the last traceback.
2007-08-15 11:28:22 -03:00
2014-11-11 04:02:11 -04:00
The disassembly is written as text to the supplied *file* argument if
2013-05-06 10:59:20 -03:00
provided and to `` sys.stdout `` otherwise.
2017-06-11 08:09:39 -03:00
The maximal depth of recursion is limited by *depth* unless it is `` None `` .
`` depth=0 `` means no recursion.
2022-10-25 19:58:04 -03:00
If *show_caches* is `` True `` , this function will display inline cache
entries used by the interpreter to specialize the bytecode.
If *adaptive* is `` True `` , this function will display specialized bytecode
that may be different from the original bytecode.
2013-05-06 10:59:20 -03:00
.. versionchanged :: 3.4
2014-11-11 04:02:11 -04:00
Added *file* parameter.
2007-08-15 11:28:22 -03:00
2017-06-11 08:09:39 -03:00
.. versionchanged :: 3.7
Implemented recursive disassembling and added *depth* parameter.
2017-08-17 23:29:21 -03:00
.. versionchanged :: 3.7
This can now handle coroutine and asynchronous generator objects.
2022-02-25 08:11:34 -04:00
.. versionchanged :: 3.11
2022-10-25 19:58:04 -03:00
Added the *show_caches* and *adaptive* parameters.
2022-02-25 08:11:34 -04:00
2024-08-21 10:46:24 -03:00
.. versionchanged :: 3.13
Added the *show_offsets* parameter.
.. versionchanged :: 3.14
Added the *show_positions* parameter.
2013-05-06 10:59:20 -03:00
2024-08-21 10:46:24 -03:00
.. function :: distb(tb=None, *, file=None, show_caches=False, adaptive=False,\
show_offset=False, show_positions=False)
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
Disassemble the top-of-stack function of a traceback, using the last
traceback if none was passed. The instruction causing the exception is
indicated.
2007-08-15 11:28:22 -03:00
2014-11-11 04:02:11 -04:00
The disassembly is written as text to the supplied *file* argument if
2013-05-06 10:59:20 -03:00
provided and to `` sys.stdout `` otherwise.
.. versionchanged :: 3.4
2014-11-11 04:02:11 -04:00
Added *file* parameter.
2007-08-15 11:28:22 -03:00
2022-02-25 08:11:34 -04:00
.. versionchanged :: 3.11
2022-10-25 19:58:04 -03:00
Added the *show_caches* and *adaptive* parameters.
2013-05-06 10:59:20 -03:00
2023-11-22 18:36:55 -04:00
.. versionchanged :: 3.13
Added the *show_offsets* parameter.
2022-02-25 08:11:34 -04:00
2024-08-21 10:46:24 -03:00
.. versionchanged :: 3.14
Added the *show_positions* parameter.
2024-09-10 11:25:27 -03:00
.. function :: disassemble(code, lasti=-1, *, file=None, show_caches=False,\
adaptive=False, show_offsets=False, show_positions=False)
2024-08-21 10:46:24 -03:00
disco(code, lasti=-1, *, file=None, show_caches=False, adaptive=False,\
show_offsets=False, show_positions=False)
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
Disassemble a code object, indicating the last instruction if *lasti* was
2007-08-15 11:28:22 -03:00
provided. The output is divided in the following columns:
2024-08-21 10:46:24 -03:00
#. the source code location of the instruction. Complete location information
is shown if *show_positions* is true. Otherwise (the default) only the
line number is displayed.
2007-08-15 11:28:22 -03:00
#. the current instruction, indicated as `` --> `` ,
#. a labelled instruction, indicated with `` >> `` ,
#. the address of the instruction,
#. the operation code name,
#. operation parameters, and
#. interpretation of the parameters in parentheses.
The parameter interpretation recognizes local and global variable names,
constant values, branch targets, and compare operators.
2014-11-11 04:02:11 -04:00
The disassembly is written as text to the supplied *file* argument if
2013-05-06 10:59:20 -03:00
provided and to `` sys.stdout `` otherwise.
.. versionchanged :: 3.4
2014-11-11 04:02:11 -04:00
Added *file* parameter.
2013-05-06 10:59:20 -03:00
2022-02-25 08:11:34 -04:00
.. versionchanged :: 3.11
2022-10-25 19:58:04 -03:00
Added the *show_caches* and *adaptive* parameters.
2022-02-25 08:11:34 -04:00
2023-11-22 18:36:55 -04:00
.. versionchanged :: 3.13
Added the *show_offsets* parameter.
2013-05-06 10:59:20 -03:00
2024-08-21 10:46:24 -03:00
.. versionchanged :: 3.14
Added the *show_positions* parameter.
2022-10-25 19:58:04 -03:00
.. function :: get_instructions(x, *, first_line=None, show_caches=False, adaptive=False)
2013-05-06 10:59:20 -03:00
Return an iterator over the instructions in the supplied function, method,
source code string or code object.
2015-03-02 10:31:40 -04:00
The iterator generates a series of :class: `Instruction` named tuples giving
the details of each operation in the supplied code.
2013-05-06 10:59:20 -03:00
2016-10-19 10:29:26 -03:00
If *first_line* is not `` None `` , it indicates the line number that should be
2015-03-02 10:31:40 -04:00
reported for the first source line in the disassembled code. Otherwise, the
source line information (if any) is taken directly from the disassembled code
object.
2013-05-06 10:59:20 -03:00
2023-12-13 08:00:21 -04:00
The *adaptive* parameter works as it does in :func: `dis` .
2022-10-25 19:58:04 -03:00
2013-05-06 10:59:20 -03:00
.. versionadded :: 3.4
2022-02-25 08:11:34 -04:00
.. versionchanged :: 3.11
2022-10-25 19:58:04 -03:00
Added the *show_caches* and *adaptive* parameters.
2022-02-25 08:11:34 -04:00
2023-12-13 08:00:21 -04:00
.. versionchanged :: 3.13
2024-06-04 20:00:02 -03:00
The *show_caches* parameter is deprecated and has no effect. The iterator
generates the :class: `Instruction` instances with the *cache_info*
field populated (regardless of the value of *show_caches* ) and it no longer
generates separate items for the cache entries.
2007-08-15 11:28:22 -03:00
Merged revisions 68116-68119,68121,68123-68127 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68116 | georg.brandl | 2009-01-01 05:46:51 -0600 (Thu, 01 Jan 2009) | 2 lines
#4100: note that element children are not necessarily present on "start" events.
........
r68117 | georg.brandl | 2009-01-01 05:53:55 -0600 (Thu, 01 Jan 2009) | 2 lines
#4156: make clear that "protocol" is to be replaced with the protocol name.
........
r68118 | georg.brandl | 2009-01-01 06:00:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4185: clarify escape behavior of replacement strings.
........
r68119 | georg.brandl | 2009-01-01 06:09:40 -0600 (Thu, 01 Jan 2009) | 3 lines
#4222: document dis.findlabels() and dis.findlinestarts() and
put them into dis.__all__.
........
r68121 | georg.brandl | 2009-01-01 06:43:33 -0600 (Thu, 01 Jan 2009) | 2 lines
Point to types module in new module deprecation notice.
........
r68123 | georg.brandl | 2009-01-01 06:52:29 -0600 (Thu, 01 Jan 2009) | 2 lines
#4784: ... on three counts ...
........
r68124 | georg.brandl | 2009-01-01 06:53:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4782: Fix markup error that hid load() and loads().
........
r68125 | georg.brandl | 2009-01-01 07:02:09 -0600 (Thu, 01 Jan 2009) | 2 lines
#4776: add data_files and package_dir arguments.
........
r68126 | georg.brandl | 2009-01-01 07:05:13 -0600 (Thu, 01 Jan 2009) | 2 lines
Handlers are in the `logging.handlers` module.
........
r68127 | georg.brandl | 2009-01-01 07:14:49 -0600 (Thu, 01 Jan 2009) | 2 lines
#4767: Use correct submodules for all MIME classes.
........
2009-01-01 11:05:06 -04:00
.. function :: findlinestarts(code)
2024-01-03 15:29:24 -04:00
This generator function uses the :meth: `~codeobject.co_lines` method
of the :ref: `code object <code-objects>` *code* to find the offsets which
are starts of
Merged revisions 68116-68119,68121,68123-68127 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68116 | georg.brandl | 2009-01-01 05:46:51 -0600 (Thu, 01 Jan 2009) | 2 lines
#4100: note that element children are not necessarily present on "start" events.
........
r68117 | georg.brandl | 2009-01-01 05:53:55 -0600 (Thu, 01 Jan 2009) | 2 lines
#4156: make clear that "protocol" is to be replaced with the protocol name.
........
r68118 | georg.brandl | 2009-01-01 06:00:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4185: clarify escape behavior of replacement strings.
........
r68119 | georg.brandl | 2009-01-01 06:09:40 -0600 (Thu, 01 Jan 2009) | 3 lines
#4222: document dis.findlabels() and dis.findlinestarts() and
put them into dis.__all__.
........
r68121 | georg.brandl | 2009-01-01 06:43:33 -0600 (Thu, 01 Jan 2009) | 2 lines
Point to types module in new module deprecation notice.
........
r68123 | georg.brandl | 2009-01-01 06:52:29 -0600 (Thu, 01 Jan 2009) | 2 lines
#4784: ... on three counts ...
........
r68124 | georg.brandl | 2009-01-01 06:53:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4782: Fix markup error that hid load() and loads().
........
r68125 | georg.brandl | 2009-01-01 07:02:09 -0600 (Thu, 01 Jan 2009) | 2 lines
#4776: add data_files and package_dir arguments.
........
r68126 | georg.brandl | 2009-01-01 07:05:13 -0600 (Thu, 01 Jan 2009) | 2 lines
Handlers are in the `logging.handlers` module.
........
r68127 | georg.brandl | 2009-01-01 07:14:49 -0600 (Thu, 01 Jan 2009) | 2 lines
#4767: Use correct submodules for all MIME classes.
........
2009-01-01 11:05:06 -04:00
lines in the source code. They are generated as `` (offset, lineno) `` pairs.
2017-03-24 18:05:04 -03:00
.. versionchanged :: 3.6
Line numbers can be decreasing. Before, they were always increasing.
Merged revisions 68116-68119,68121,68123-68127 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68116 | georg.brandl | 2009-01-01 05:46:51 -0600 (Thu, 01 Jan 2009) | 2 lines
#4100: note that element children are not necessarily present on "start" events.
........
r68117 | georg.brandl | 2009-01-01 05:53:55 -0600 (Thu, 01 Jan 2009) | 2 lines
#4156: make clear that "protocol" is to be replaced with the protocol name.
........
r68118 | georg.brandl | 2009-01-01 06:00:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4185: clarify escape behavior of replacement strings.
........
r68119 | georg.brandl | 2009-01-01 06:09:40 -0600 (Thu, 01 Jan 2009) | 3 lines
#4222: document dis.findlabels() and dis.findlinestarts() and
put them into dis.__all__.
........
r68121 | georg.brandl | 2009-01-01 06:43:33 -0600 (Thu, 01 Jan 2009) | 2 lines
Point to types module in new module deprecation notice.
........
r68123 | georg.brandl | 2009-01-01 06:52:29 -0600 (Thu, 01 Jan 2009) | 2 lines
#4784: ... on three counts ...
........
r68124 | georg.brandl | 2009-01-01 06:53:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4782: Fix markup error that hid load() and loads().
........
r68125 | georg.brandl | 2009-01-01 07:02:09 -0600 (Thu, 01 Jan 2009) | 2 lines
#4776: add data_files and package_dir arguments.
........
r68126 | georg.brandl | 2009-01-01 07:05:13 -0600 (Thu, 01 Jan 2009) | 2 lines
Handlers are in the `logging.handlers` module.
........
r68127 | georg.brandl | 2009-01-01 07:14:49 -0600 (Thu, 01 Jan 2009) | 2 lines
#4767: Use correct submodules for all MIME classes.
........
2009-01-01 11:05:06 -04:00
2022-06-30 11:57:35 -03:00
.. versionchanged :: 3.10
2024-01-03 15:29:24 -04:00
The :pep: `626` :meth: `~codeobject.co_lines` method is used instead of the
2023-12-06 16:15:46 -04:00
:attr: `~codeobject.co_firstlineno` and :attr: `~codeobject.co_lnotab`
2024-01-03 15:29:24 -04:00
attributes of the :ref: `code object <code-objects>` .
2022-06-30 11:57:35 -03:00
2023-08-25 05:31:26 -03:00
.. versionchanged :: 3.13
Line numbers can be `` None `` for bytecode that does not map to source lines.
Merged revisions 68116-68119,68121,68123-68127 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68116 | georg.brandl | 2009-01-01 05:46:51 -0600 (Thu, 01 Jan 2009) | 2 lines
#4100: note that element children are not necessarily present on "start" events.
........
r68117 | georg.brandl | 2009-01-01 05:53:55 -0600 (Thu, 01 Jan 2009) | 2 lines
#4156: make clear that "protocol" is to be replaced with the protocol name.
........
r68118 | georg.brandl | 2009-01-01 06:00:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4185: clarify escape behavior of replacement strings.
........
r68119 | georg.brandl | 2009-01-01 06:09:40 -0600 (Thu, 01 Jan 2009) | 3 lines
#4222: document dis.findlabels() and dis.findlinestarts() and
put them into dis.__all__.
........
r68121 | georg.brandl | 2009-01-01 06:43:33 -0600 (Thu, 01 Jan 2009) | 2 lines
Point to types module in new module deprecation notice.
........
r68123 | georg.brandl | 2009-01-01 06:52:29 -0600 (Thu, 01 Jan 2009) | 2 lines
#4784: ... on three counts ...
........
r68124 | georg.brandl | 2009-01-01 06:53:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4782: Fix markup error that hid load() and loads().
........
r68125 | georg.brandl | 2009-01-01 07:02:09 -0600 (Thu, 01 Jan 2009) | 2 lines
#4776: add data_files and package_dir arguments.
........
r68126 | georg.brandl | 2009-01-01 07:05:13 -0600 (Thu, 01 Jan 2009) | 2 lines
Handlers are in the `logging.handlers` module.
........
r68127 | georg.brandl | 2009-01-01 07:14:49 -0600 (Thu, 01 Jan 2009) | 2 lines
#4767: Use correct submodules for all MIME classes.
........
2009-01-01 11:05:06 -04:00
.. function :: findlabels(code)
2020-04-03 05:00:28 -03:00
Detect all offsets in the raw compiled bytecode string *code* which are jump targets, and
Merged revisions 68116-68119,68121,68123-68127 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68116 | georg.brandl | 2009-01-01 05:46:51 -0600 (Thu, 01 Jan 2009) | 2 lines
#4100: note that element children are not necessarily present on "start" events.
........
r68117 | georg.brandl | 2009-01-01 05:53:55 -0600 (Thu, 01 Jan 2009) | 2 lines
#4156: make clear that "protocol" is to be replaced with the protocol name.
........
r68118 | georg.brandl | 2009-01-01 06:00:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4185: clarify escape behavior of replacement strings.
........
r68119 | georg.brandl | 2009-01-01 06:09:40 -0600 (Thu, 01 Jan 2009) | 3 lines
#4222: document dis.findlabels() and dis.findlinestarts() and
put them into dis.__all__.
........
r68121 | georg.brandl | 2009-01-01 06:43:33 -0600 (Thu, 01 Jan 2009) | 2 lines
Point to types module in new module deprecation notice.
........
r68123 | georg.brandl | 2009-01-01 06:52:29 -0600 (Thu, 01 Jan 2009) | 2 lines
#4784: ... on three counts ...
........
r68124 | georg.brandl | 2009-01-01 06:53:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4782: Fix markup error that hid load() and loads().
........
r68125 | georg.brandl | 2009-01-01 07:02:09 -0600 (Thu, 01 Jan 2009) | 2 lines
#4776: add data_files and package_dir arguments.
........
r68126 | georg.brandl | 2009-01-01 07:05:13 -0600 (Thu, 01 Jan 2009) | 2 lines
Handlers are in the `logging.handlers` module.
........
r68127 | georg.brandl | 2009-01-01 07:14:49 -0600 (Thu, 01 Jan 2009) | 2 lines
#4767: Use correct submodules for all MIME classes.
........
2009-01-01 11:05:06 -04:00
return a list of these offsets.
2009-01-03 17:18:54 -04:00
2013-11-23 18:49:22 -04:00
2018-09-18 03:54:26 -03:00
.. function :: stack_effect(opcode, oparg=None, *, jump=None)
2013-11-23 18:49:22 -04:00
Compute the stack effect of *opcode* with argument *oparg* .
2018-09-18 03:54:26 -03:00
If the code has a jump target and *jump* is `` True `` , :func: `~stack_effect`
will return the stack effect of jumping. If *jump* is `` False `` ,
it will return the stack effect of not jumping. And if *jump* is
`` None `` (default), it will return the maximal stack effect of both cases.
2013-11-23 18:49:22 -04:00
.. versionadded :: 3.4
2018-09-18 03:54:26 -03:00
.. versionchanged :: 3.8
Added *jump* parameter.
2023-06-17 13:00:16 -03:00
.. versionchanged :: 3.13
If `` oparg `` is omitted (or `` None `` ), the stack effect is now returned
for `` oparg=0 `` . Previously this was an error for opcodes that use their
arg. It is also no longer an error to pass an integer `` oparg `` when
the `` opcode `` does not use it; the `` oparg `` in this case is ignored.
2018-09-18 03:54:26 -03:00
2013-05-06 10:59:20 -03:00
.. _bytecodes:
2009-01-03 17:18:54 -04:00
2013-05-06 10:59:20 -03:00
Python Bytecode Instructions
----------------------------
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
The :func: `get_instructions` function and :class: `Bytecode` class provide
details of bytecode instructions as :class: `Instruction` instances:
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
.. class :: Instruction
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
Details for a bytecode operation
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
.. data :: opcode
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
numeric code for operation, corresponding to the opcode values listed
below and the bytecode values in the :ref: `opcode_collections` .
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
.. data :: opname
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
human readable name for operation
2007-08-15 11:28:22 -03:00
2023-06-11 12:50:34 -03:00
.. data :: baseopcode
numeric code for the base operation if operation is specialized;
otherwise equal to :data: `opcode`
.. data :: baseopname
human readable name for the base operation if operation is specialized;
otherwise equal to :data: `opname`
2013-05-06 10:59:20 -03:00
.. data :: arg
2007-08-15 11:28:22 -03:00
2016-10-19 10:29:26 -03:00
numeric argument to operation (if any), otherwise `` None ``
2007-08-15 11:28:22 -03:00
2023-06-11 12:50:34 -03:00
.. data :: oparg
alias for :data: `arg`
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
.. data :: argval
2007-08-15 11:28:22 -03:00
2021-09-14 06:09:05 -03:00
resolved arg value (if any), otherwise `` None ``
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
.. data :: argrepr
2007-08-15 11:28:22 -03:00
2021-09-14 06:09:05 -03:00
human readable description of operation argument (if any),
otherwise an empty string.
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
.. data :: offset
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
start index of operation within bytecode sequence
2007-08-15 11:28:22 -03:00
2023-06-11 12:50:34 -03:00
.. data :: start_offset
start index of operation within bytecode sequence, including prefixed
`` EXTENDED_ARG `` operations if present; otherwise equal to :data: `offset`
.. data :: cache_offset
start index of the cache entries following the operation
.. data :: end_offset
end index of the cache entries following the operation
2013-05-06 10:59:20 -03:00
.. data :: starts_line
2007-08-15 11:28:22 -03:00
2023-08-25 05:31:26 -03:00
`` True `` if this opcode starts a source line, otherwise `` False ``
.. data :: line_number
source line number associated with this opcode (if any), otherwise `` None ``
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
.. data :: is_jump_target
2007-08-15 11:28:22 -03:00
2013-11-29 06:19:53 -04:00
`` True `` if other code jumps to here, otherwise `` False ``
2007-08-15 11:28:22 -03:00
2022-01-24 07:09:20 -04:00
2023-06-11 12:50:34 -03:00
.. data :: jump_target
bytecode index of the jump target if this is a jump operation,
otherwise `` None ``
2022-01-24 07:09:20 -04:00
.. data :: positions
:class: `dis.Positions` object holding the
start and end locations that are covered by this instruction.
2023-12-13 08:00:21 -04:00
.. data :: cache_info
Information about the cache entries of this instruction, as
triplets of the form `` (name, size, data) `` , where the `` name ``
and `` size `` describe the cache format and data is the contents
of the cache. `` cache_info `` is `` None `` if the instruction does not have
caches.
2013-05-06 10:59:20 -03:00
.. versionadded :: 3.4
2007-08-15 11:28:22 -03:00
2022-01-24 07:09:20 -04:00
.. versionchanged :: 3.11
Field `` positions `` is added.
2023-06-11 12:50:34 -03:00
.. versionchanged :: 3.13
2023-08-25 05:31:26 -03:00
Changed field `` starts_line `` .
2023-06-11 12:50:34 -03:00
Added fields `` start_offset `` , `` cache_offset `` , `` end_offset `` ,
2023-12-13 08:00:21 -04:00
`` baseopname `` , `` baseopcode `` , `` jump_target `` , `` oparg `` ,
`` line_number `` and `` cache_info `` .
2023-06-11 12:50:34 -03:00
2022-01-24 07:09:20 -04:00
.. class :: Positions
2022-10-06 22:01:30 -03:00
In case the information is not available, some fields might be `` None `` .
2022-01-24 07:09:20 -04:00
.. data :: lineno
.. data :: end_lineno
.. data :: col_offset
.. data :: end_col_offset
.. versionadded :: 3.11
2007-08-15 11:28:22 -03:00
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
The Python compiler currently generates the following bytecode instructions.
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
**General instructions**
2023-04-29 04:02:21 -03:00
In the following, We will refer to the interpreter stack as `` STACK `` and describe
2023-01-12 14:23:50 -04:00
operations on it as if it was a Python list. The top of the stack corresponds to
`` STACK[-1] `` in this language.
2010-07-03 07:41:33 -03:00
.. opcode :: NOP
2007-08-15 11:28:22 -03:00
2022-01-26 16:47:45 -04:00
Do nothing code. Used as a placeholder by the bytecode optimizer, and to
generate line tracing events.
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
.. opcode :: POP_TOP
2007-08-15 11:28:22 -03:00
2023-04-29 04:02:21 -03:00
Removes the top-of-stack item::
2023-01-12 14:23:50 -04:00
STACK.pop()
2007-08-15 11:28:22 -03:00
2022-10-27 07:55:03 -03:00
.. opcode :: END_FOR
2024-01-24 11:10:17 -04:00
Removes the top-of-stack item.
Equivalent to `` POP_TOP `` .
2022-10-27 07:55:03 -03:00
Used to clean up at the end of loops, hence the name.
.. versionadded :: 3.12
2023-10-17 09:59:34 -03:00
.. opcode :: END_SEND
Implements `` del STACK[-2] `` .
Used to clean up when a generator exits.
.. versionadded :: 3.12
2022-01-26 16:47:45 -04:00
.. opcode :: COPY (i)
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Push the i-th item to the top of the stack without removing it from its original
2023-04-29 04:02:21 -03:00
location::
2023-01-12 14:23:50 -04:00
assert i > 0
STACK.append(STACK[-i])
2007-08-15 11:28:22 -03:00
2022-01-26 16:47:45 -04:00
.. versionadded :: 3.11
2018-02-01 07:48:33 -04:00
2007-08-15 11:28:22 -03:00
2022-01-26 16:47:45 -04:00
.. opcode :: SWAP (i)
2007-08-15 11:28:22 -03:00
2023-04-29 04:02:21 -03:00
Swap the top of the stack with the i-th element::
2023-01-12 14:23:50 -04:00
2024-01-22 11:56:30 -04:00
STACK[-i], STACK[-1] = STACK[-1], STACK[-i]
2007-08-15 11:28:22 -03:00
2022-01-26 16:47:45 -04:00
.. versionadded :: 3.11
2018-02-01 07:48:33 -04:00
2007-08-15 11:28:22 -03:00
2022-08-05 02:45:05 -03:00
.. opcode :: CACHE
Rather than being an actual instruction, this opcode is used to mark extra
space for the interpreter to cache useful data directly in the bytecode
itself. It is automatically hidden by all `` dis `` utilities, but can be
viewed with `` show_caches=True `` .
Logically, this space is part of the preceding instruction. Many opcodes
expect to be followed by an exact number of caches, and will instruct the
interpreter to skip over them at runtime.
Populated caches can look like arbitrary instructions, so great care should
be taken when reading or modifying raw, adaptive bytecode containing
quickened data.
.. versionadded :: 3.11
2010-07-03 07:41:33 -03:00
**Unary operations**
Unary operations take the top of the stack, apply the operation, and push the
result back on the stack.
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
.. opcode :: UNARY_NEGATIVE
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Implements `` STACK[-1] = -STACK[-1] `` .
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
.. opcode :: UNARY_NOT
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Implements `` STACK[-1] = not STACK[-1] `` .
2007-08-15 11:28:22 -03:00
2023-06-29 17:49:54 -03:00
.. versionchanged :: 3.13
This instruction now requires an exact :class: `bool` operand.
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
.. opcode :: UNARY_INVERT
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Implements `` STACK[-1] = ~STACK[-1] `` .
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
.. opcode :: GET_ITER
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Implements `` STACK[-1] = iter(STACK[-1]) `` .
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:
1. Coroutines now have a distinct, separate from generators
type at the C level: PyGen_Type, and a new typedef PyCoroObject.
PyCoroObject shares the initial segment of struct layout with
PyGenObject, making it possible to reuse existing generators
machinery. The new type is exposed as 'types.CoroutineType'.
As a consequence of having a new type, CO_GENERATOR flag is
no longer applied to coroutines.
2. Having a separate type for coroutines made it possible to add
an __await__ method to the type. Although it is not used by the
interpreter (see details on that below), it makes coroutines
naturally (without using __instancecheck__) conform to
collections.abc.Coroutine and collections.abc.Awaitable ABCs.
[The __instancecheck__ is still used for generator-based
coroutines, as we don't want to add __await__ for generators.]
3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to
allow passing native coroutines to the YIELD_FROM opcode.
Before this change, 'yield from o' expression was compiled to:
(o)
GET_ITER
LOAD_CONST
YIELD_FROM
Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.
The reason for adding a new opcode is that GET_ITER is used
in some contexts (such as 'for .. in' loops) where passing
a coroutine object is invalid.
4. Add two new introspection functions to the inspec module:
getcoroutinestate(c) and getcoroutinelocals(c).
5. inspect.iscoroutine(o) is updated to test if 'o' is a native
coroutine object. Before this commit it used abc.Coroutine,
and it was requested to update inspect.isgenerator(o) to use
abc.Generator; it was decided, however, that inspect functions
should really be tailored for checking for native types.
6. sys.set_coroutine_wrapper(w) API is updated to work with only
native coroutines. Since types.coroutine decorator supports
any type of callables now, it would be confusing that it does
not work for all types of coroutines.
7. Exceptions logic in generators C implementation was updated
to raise clearer messages for coroutines:
Before: TypeError("generator raised StopIteration")
After: TypeError("coroutine raised StopIteration")
2015-06-22 13:19:30 -03:00
.. opcode :: GET_YIELD_FROM_ITER
2023-01-12 14:23:50 -04:00
If `` STACK[-1] `` is a :term: `generator iterator` or :term: `coroutine` object
it is left as is. Otherwise, implements `` STACK[-1] = iter(STACK[-1]) `` .
Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:
1. Coroutines now have a distinct, separate from generators
type at the C level: PyGen_Type, and a new typedef PyCoroObject.
PyCoroObject shares the initial segment of struct layout with
PyGenObject, making it possible to reuse existing generators
machinery. The new type is exposed as 'types.CoroutineType'.
As a consequence of having a new type, CO_GENERATOR flag is
no longer applied to coroutines.
2. Having a separate type for coroutines made it possible to add
an __await__ method to the type. Although it is not used by the
interpreter (see details on that below), it makes coroutines
naturally (without using __instancecheck__) conform to
collections.abc.Coroutine and collections.abc.Awaitable ABCs.
[The __instancecheck__ is still used for generator-based
coroutines, as we don't want to add __await__ for generators.]
3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to
allow passing native coroutines to the YIELD_FROM opcode.
Before this change, 'yield from o' expression was compiled to:
(o)
GET_ITER
LOAD_CONST
YIELD_FROM
Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.
The reason for adding a new opcode is that GET_ITER is used
in some contexts (such as 'for .. in' loops) where passing
a coroutine object is invalid.
4. Add two new introspection functions to the inspec module:
getcoroutinestate(c) and getcoroutinelocals(c).
5. inspect.iscoroutine(o) is updated to test if 'o' is a native
coroutine object. Before this commit it used abc.Coroutine,
and it was requested to update inspect.isgenerator(o) to use
abc.Generator; it was decided, however, that inspect functions
should really be tailored for checking for native types.
6. sys.set_coroutine_wrapper(w) API is updated to work with only
native coroutines. Since types.coroutine decorator supports
any type of callables now, it would be confusing that it does
not work for all types of coroutines.
7. Exceptions logic in generators C implementation was updated
to raise clearer messages for coroutines:
Before: TypeError("generator raised StopIteration")
After: TypeError("coroutine raised StopIteration")
2015-06-22 13:19:30 -03:00
.. versionadded :: 3.5
2023-06-29 17:49:54 -03:00
.. opcode :: TO_BOOL
Implements `` STACK[-1] = bool(STACK[-1]) `` .
.. versionadded :: 3.13
2021-11-11 02:56:22 -04:00
**Binary and in-place operations**
2010-07-03 07:41:33 -03:00
2023-01-12 14:23:50 -04:00
Binary operations remove the top two items from the stack (`` STACK[-1] `` and
`` STACK[-2] `` ). They perform the operation, then put the result back on the stack.
2007-08-15 11:28:22 -03:00
2022-06-27 08:24:23 -03:00
In-place operations are like binary operations, but the operation is done in-place
2023-01-12 14:23:50 -04:00
when `` STACK[-2] `` supports it, and the resulting `` STACK[-1] `` may be (but does
not have to be) the original `` STACK[-2] `` .
2007-08-15 11:28:22 -03:00
2021-11-11 02:56:22 -04:00
.. opcode :: BINARY_OP (op)
2007-08-15 11:28:22 -03:00
2021-11-11 02:56:22 -04:00
Implements the binary and in-place operators (depending on the value of
2023-04-29 04:02:21 -03:00
*op* )::
2023-01-12 14:23:50 -04:00
rhs = STACK.pop()
lhs = STACK.pop()
STACK.append(lhs op rhs)
2007-08-15 11:28:22 -03:00
2021-11-11 02:56:22 -04:00
.. versionadded :: 3.11
2007-08-15 11:28:22 -03:00
2021-11-11 02:56:22 -04:00
.. opcode :: BINARY_SUBSCR
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Implements::
key = STACK.pop()
container = STACK.pop()
2023-09-13 02:07:56 -03:00
STACK.append(container[key])
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
.. opcode :: STORE_SUBSCR
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Implements::
key = STACK.pop()
container = STACK.pop()
value = STACK.pop()
container[key] = value
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
.. opcode :: DELETE_SUBSCR
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Implements::
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
key = STACK.pop()
container = STACK.pop()
del container[key]
2007-08-15 11:28:22 -03:00
2022-06-27 08:24:23 -03:00
.. opcode :: BINARY_SLICE
2023-01-12 14:23:50 -04:00
Implements::
end = STACK.pop()
start = STACK.pop()
container = STACK.pop()
STACK.append(container[start:end])
2022-06-27 08:24:23 -03:00
.. versionadded :: 3.12
.. opcode :: STORE_SLICE
2023-01-12 14:23:50 -04:00
Implements::
end = STACK.pop()
start = STACK.pop()
container = STACK.pop()
values = STACK.pop()
container[start:end] = value
2022-06-27 08:24:23 -03:00
.. versionadded :: 3.12
2015-06-24 12:04:15 -03:00
**Coroutine opcodes**
2015-05-11 23:57:16 -03:00
2022-03-04 08:41:17 -04:00
.. opcode :: GET_AWAITABLE (where)
2015-05-11 23:57:16 -03:00
2023-01-12 14:23:50 -04:00
Implements `` STACK[-1] = get_awaitable(STACK[-1]) `` , where `` get_awaitable(o) ``
2015-06-24 12:04:15 -03:00
returns `` o `` if `` o `` is a coroutine object or a generator object with
2023-04-29 04:02:21 -03:00
the :data: `~inspect.CO_ITERABLE_COROUTINE` flag, or resolves
2015-06-24 12:04:15 -03:00
`` o.__await__ `` .
2015-05-11 23:57:16 -03:00
2022-03-04 08:41:17 -04:00
If the `` where `` operand is nonzero, it indicates where the instruction
occurs:
2023-04-29 04:02:21 -03:00
* `` 1 `` : After a call to `` __aenter__ ``
* `` 2 `` : After a call to `` __aexit__ ``
2022-03-04 08:41:17 -04:00
2018-02-01 07:48:33 -04:00
.. versionadded :: 3.5
2022-03-04 08:41:17 -04:00
.. versionchanged :: 3.11
Previously, this instruction did not have an oparg.
2015-05-11 23:57:16 -03:00
.. opcode :: GET_AITER
2023-01-12 14:23:50 -04:00
Implements `` STACK[-1] = STACK[-1].__aiter__() `` .
2017-10-06 11:18:10 -03:00
2018-02-01 07:48:33 -04:00
.. versionadded :: 3.5
2017-10-06 11:18:10 -03:00
.. versionchanged :: 3.7
Returning awaitable objects from `` __aiter__ `` is no longer
supported.
2015-05-11 23:57:16 -03:00
.. opcode :: GET_ANEXT
2023-01-12 14:23:50 -04:00
Implement `` STACK.append(get_awaitable(STACK[-1].__anext__())) `` to the stack.
See `` GET_AWAITABLE `` for details about `` get_awaitable `` .
2015-05-11 23:57:16 -03:00
2018-02-01 07:48:33 -04:00
.. versionadded :: 3.5
2015-05-11 23:57:16 -03:00
2018-03-23 09:34:35 -03:00
.. opcode :: END_ASYNC_FOR
Terminates an :keyword: `async for` loop. Handles an exception raised
2023-02-01 08:49:59 -04:00
when awaiting a next item. The stack contains the async iterable in
`` STACK[-2] `` and the raised exception in `` STACK[-1] `` . Both are popped.
If the exception is not :exc: `StopAsyncIteration` , it is re-raised.
2018-03-23 09:34:35 -03:00
.. versionadded :: 3.8
2023-05-19 17:11:21 -03:00
.. versionchanged :: 3.11
Exception representation on the stack now consist of one, not three, items.
2018-03-23 09:34:35 -03:00
2022-08-19 16:33:44 -03:00
.. opcode :: CLEANUP_THROW
Handles an exception raised during a :meth: `~generator.throw` or
2023-01-12 14:23:50 -04:00
:meth: `~generator.close` call through the current frame. If `` STACK[-1] `` is an
2022-08-19 16:33:44 -03:00
instance of :exc: `StopIteration` , pop three values from the stack and push
2023-01-12 14:23:50 -04:00
its `` value `` member. Otherwise, re-raise `` STACK[-1] `` .
2022-08-19 16:33:44 -03:00
.. versionadded :: 3.12
2015-05-11 23:57:16 -03:00
2010-07-03 07:41:33 -03:00
**Miscellaneous opcodes**
2007-08-15 11:28:22 -03:00
2008-12-18 07:06:25 -04:00
.. opcode :: SET_ADD (i)
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Implements::
2023-04-29 04:02:21 -03:00
2023-01-12 14:23:50 -04:00
item = STACK.pop()
set.add(STACK[-i], item)
Used to implement set comprehensions.
2007-08-15 11:28:22 -03:00
2008-12-18 07:06:25 -04:00
.. opcode :: LIST_APPEND (i)
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Implements::
item = STACK.pop()
list.append(STACK[-i], item)
Used to implement list comprehensions.
2008-12-18 07:06:25 -04:00
.. opcode :: MAP_ADD (i)
2023-01-12 14:23:50 -04:00
Implements::
value = STACK.pop()
key = STACK.pop()
dict.__setitem__(STACK[-i], key, value)
Used to implement dict comprehensions.
2008-12-18 07:06:25 -04:00
2018-02-01 07:48:33 -04:00
.. versionadded :: 3.1
2019-06-22 11:40:55 -03:00
.. versionchanged :: 3.8
2023-01-12 14:23:50 -04:00
Map value is `` STACK[-1] `` and map key is `` STACK[-2] `` . Before, those
were reversed.
2018-02-01 07:48:33 -04:00
2014-11-11 04:02:11 -04:00
For all of the :opcode: `SET_ADD` , :opcode: `LIST_APPEND` and :opcode: `MAP_ADD`
2015-03-02 10:31:40 -04:00
instructions, while the added value or key/value pair is popped off, the
container object remains on the stack so that it is available for further
iterations of the loop.
2007-08-15 11:28:22 -03:00
2010-07-03 07:41:33 -03:00
.. opcode :: RETURN_VALUE
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Returns with `` STACK[-1] `` to the caller of the function.
2007-08-15 11:28:22 -03:00
2023-02-07 18:32:21 -04:00
.. opcode :: RETURN_CONST (consti)
Returns with `` co_consts[consti] `` to the caller of the function.
.. versionadded :: 3.12
2010-07-03 07:41:33 -03:00
.. opcode :: YIELD_VALUE
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Yields `` STACK.pop() `` from a :term: `generator` .
2007-08-15 11:28:22 -03:00
2023-04-29 04:02:21 -03:00
.. versionchanged :: 3.11
oparg set to be the stack depth.
2023-01-24 13:25:37 -04:00
2023-04-29 04:02:21 -03:00
.. versionchanged :: 3.12
oparg set to be the exception block depth, for efficient closing of generators.
2007-08-15 11:28:22 -03:00
2023-11-02 07:18:43 -03:00
.. versionchanged :: 3.13
2023-11-03 07:01:36 -03:00
oparg is `` 1 `` if this instruction is part of a yield-from or await, and `` 0 ``
otherwise.
2018-02-01 07:48:33 -04:00
2016-09-09 00:50:03 -03:00
.. opcode :: SETUP_ANNOTATIONS
Checks whether `` __annotations__ `` is defined in `` locals() `` , if not it is
2016-10-09 21:38:21 -03:00
set up to an empty `` dict `` . This opcode is only emitted if a class
2016-09-09 00:50:03 -03:00
or module body contains :term: `variable annotations <variable annotation>`
statically.
2012-01-13 07:43:40 -04:00
2016-09-12 02:00:01 -03:00
.. versionadded :: 3.6
2018-02-01 07:48:33 -04:00
2010-07-03 07:41:33 -03:00
.. opcode :: POP_EXCEPT
2008-06-11 12:59:43 -03:00
2021-12-17 10:46:22 -04:00
Pops a value from the stack, which is used to restore the exception state.
2008-06-11 12:59:43 -03:00
2023-04-29 04:02:21 -03:00
.. versionchanged :: 3.11
Exception representation on the stack now consist of one, not three, items.
2008-06-11 12:59:43 -03:00
2019-11-21 05:11:43 -04:00
.. opcode :: RERAISE
2018-02-22 17:33:30 -04:00
2023-04-29 04:02:21 -03:00
Re-raises the exception currently on top of the stack. If oparg is non-zero,
2023-12-05 15:27:59 -04:00
pops an additional value from the stack which is used to set
:attr: `~frame.f_lasti` of the current frame.
2018-02-22 17:33:30 -04:00
2023-04-29 04:02:21 -03:00
.. versionadded :: 3.9
2018-02-22 17:33:30 -04:00
2023-04-29 04:02:21 -03:00
.. versionchanged :: 3.11
Exception representation on the stack now consist of one, not three, items.
2018-02-22 17:33:30 -04:00
2021-05-07 11:19:19 -03:00
.. opcode :: PUSH_EXC_INFO
2023-04-29 04:02:21 -03:00
Pops a value from the stack. Pushes the current exception to the top of the stack.
Pushes the value originally popped back to the stack.
Used in exception handlers.
2021-05-07 11:19:19 -03:00
2023-04-29 04:02:21 -03:00
.. versionadded :: 3.11
2021-05-07 11:19:19 -03:00
2022-04-01 09:59:38 -03:00
.. opcode :: CHECK_EXC_MATCH
2023-01-12 14:23:50 -04:00
Performs exception matching for `` except `` . Tests whether the `` STACK[-2] ``
2023-04-29 04:02:21 -03:00
is an exception matching `` STACK[-1] `` . Pops `` STACK[-1] `` and pushes the boolean
2023-01-12 14:23:50 -04:00
result of the test.
2022-04-01 09:59:38 -03:00
.. versionadded :: 3.11
2021-05-07 11:19:19 -03:00
2022-04-05 08:06:22 -03:00
.. opcode :: CHECK_EG_MATCH
2023-01-12 14:23:50 -04:00
Performs exception matching for `` except* `` . Applies `` split(STACK[-1]) `` on
the exception group representing `` STACK[-2] `` .
2022-04-05 08:06:22 -03:00
In case of a match, pops two items from the stack and pushes the
non-matching subgroup (`` None `` in case of full match) followed by the
matching subgroup. When there is no match, pops one item (the match
type) and pushes `` None `` .
.. versionadded :: 3.11
2019-11-21 05:11:43 -04:00
.. opcode :: WITH_EXCEPT_START
2018-02-22 17:33:30 -04:00
2023-04-29 04:02:21 -03:00
Calls the function in position 4 on the stack with arguments (type, val, tb)
representing the exception at the top of the stack.
Used to implement the call `` context_manager.__exit__(*exc_info()) `` when an exception
has occurred in a :keyword: `with` statement.
2018-02-22 17:33:30 -04:00
2023-04-29 04:02:21 -03:00
.. versionadded :: 3.9
2007-08-15 11:28:22 -03:00
2023-04-29 04:02:21 -03:00
.. versionchanged :: 3.11
The `` __exit__ `` function is in position 4 of the stack rather than 7.
Exception representation on the stack now consist of one, not three, items.
2007-08-15 11:28:22 -03:00
2021-05-07 11:19:19 -03:00
2024-05-21 21:46:39 -03:00
.. opcode :: LOAD_COMMON_CONSTANT
2019-08-25 06:44:09 -03:00
2024-05-21 21:46:39 -03:00
Pushes a common constant onto the stack. The interpreter contains a hardcoded
list of constants supported by this instruction. Used by the :keyword: `assert`
statement to load :exc: `AssertionError` .
2019-08-25 06:44:09 -03:00
2024-05-21 21:46:39 -03:00
.. versionadded :: 3.14
2019-08-25 06:44:09 -03:00
2010-07-03 07:41:33 -03:00
.. opcode :: LOAD_BUILD_CLASS
2007-08-15 11:28:22 -03:00
2023-08-25 08:28:47 -03:00
Pushes :func: `!builtins.__build_class__` onto the stack. It is later called
2022-01-28 08:42:30 -04:00
to construct a class.
2007-08-15 11:28:22 -03:00
2021-02-26 18:51:55 -04:00
.. opcode :: GET_LEN
2023-01-12 14:23:50 -04:00
Perform `` STACK.append(len(STACK[-1])) `` .
2021-02-26 18:51:55 -04:00
.. versionadded :: 3.10
.. opcode :: MATCH_MAPPING
2023-01-12 14:23:50 -04:00
If `` STACK[-1] `` is an instance of :class: `collections.abc.Mapping` (or, more
2023-07-21 04:52:07 -03:00
technically: if it has the :c:macro: `Py_TPFLAGS_MAPPING` flag set in its
2023-01-12 14:23:50 -04:00
:c:member: `~PyTypeObject.tp_flags` ), push `` True `` onto the stack. Otherwise,
push `` False `` .
2021-02-26 18:51:55 -04:00
.. versionadded :: 3.10
.. opcode :: MATCH_SEQUENCE
2023-01-12 14:23:50 -04:00
If `` STACK[-1] `` is an instance of :class: `collections.abc.Sequence` and is *not* an instance
2021-06-25 12:20:43 -03:00
of :class: `str` /:class: `bytes` /:class: `bytearray` (or, more technically: if it has
2023-07-21 04:52:07 -03:00
the :c:macro: `Py_TPFLAGS_SEQUENCE` flag set in its :c:member: `~PyTypeObject.tp_flags` ),
2021-06-25 12:20:43 -03:00
push `` True `` onto the stack. Otherwise, push `` False `` .
2021-02-26 18:51:55 -04:00
.. versionadded :: 3.10
.. opcode :: MATCH_KEYS
2023-01-12 14:23:50 -04:00
`` STACK[-1] `` is a tuple of mapping keys, and `` STACK[-2] `` is the match subject.
If `` STACK[-2] `` contains all of the keys in `` STACK[-1] `` , push a :class: `tuple`
containing the corresponding values. Otherwise, push `` None `` .
2021-02-26 18:51:55 -04:00
.. versionadded :: 3.10
2021-10-27 06:45:35 -03:00
.. versionchanged :: 3.11
Previously, this instruction also pushed a boolean value indicating
success (`` True `` ) or failure (`` False `` ).
2021-02-26 18:51:55 -04:00
2007-08-15 11:28:22 -03:00
.. opcode :: STORE_NAME (namei)
2023-01-12 14:23:50 -04:00
Implements `` name = STACK.pop() `` . *namei* is the index of *name* in the attribute
2023-12-06 16:15:46 -04:00
:attr: `~codeobject.co_names` of the :ref: `code object <code-objects>` .
2023-08-25 08:28:47 -03:00
The compiler tries to use :opcode: `STORE_FAST` or :opcode: `STORE_GLOBAL` if possible.
2007-08-15 11:28:22 -03:00
.. opcode :: DELETE_NAME (namei)
2023-12-06 16:15:46 -04:00
Implements `` del name `` , where *namei* is the index into :attr: `~codeobject.co_names`
2023-08-25 08:28:47 -03:00
attribute of the :ref: `code object <code-objects>` .
2007-08-15 11:28:22 -03:00
.. opcode :: UNPACK_SEQUENCE (count)
2023-01-12 14:23:50 -04:00
Unpacks `` STACK[-1] `` into *count* individual values, which are put onto the stack
2023-07-30 12:40:37 -03:00
right-to-left. Require there to be exactly *count* values.::
2023-01-12 14:23:50 -04:00
2023-07-30 12:40:37 -03:00
assert(len(STACK[-1]) == count)
STACK.extend(STACK.pop()[:-count-1:-1])
2007-08-15 11:28:22 -03:00
2008-07-20 18:39:03 -03:00
.. opcode :: UNPACK_EX (counts)
2023-01-12 14:23:50 -04:00
Implements assignment with a starred target: Unpacks an iterable in `` STACK[-1] ``
into individual values, where the total number of values can be smaller than the
2016-04-05 03:19:42 -03:00
number of items in the iterable: one of the new values will be a list of all
2008-07-20 18:39:03 -03:00
leftover items.
2023-01-12 14:23:50 -04:00
The number of values before and after the list value is limited to 255.
The number of values before the list value is encoded in the argument of the
opcode. The number of values after the list if any is encoded using an
`` EXTENDED_ARG `` . As a consequence, the argument can be seen as a two bytes values
where the low byte of *counts* is the number of values before the list value, the
high byte of *counts* the number of values after it.
The extracted values are put onto the stack right-to-left, i.e. `` a, *b, c = d ``
will be stored after execution as `` STACK.extend((a, b, c)) `` .
2009-01-03 17:18:54 -04:00
2008-07-20 18:39:03 -03:00
2007-08-15 11:28:22 -03:00
.. opcode :: STORE_ATTR (namei)
2023-01-12 14:23:50 -04:00
Implements::
obj = STACK.pop()
value = STACK.pop()
obj.name = value
2007-08-15 11:28:22 -03:00
2023-12-06 16:15:46 -04:00
where *namei* is the index of name in :attr: `~codeobject.co_names` of the
2023-08-25 08:28:47 -03:00
:ref: `code object <code-objects>` .
2007-08-15 11:28:22 -03:00
.. opcode :: DELETE_ATTR (namei)
2023-01-12 14:23:50 -04:00
Implements::
obj = STACK.pop()
del obj.name
2023-12-06 16:15:46 -04:00
where *namei* is the index of name into :attr: `~codeobject.co_names` of the
2023-08-25 08:28:47 -03:00
:ref: `code object <code-objects>` .
2007-08-15 11:28:22 -03:00
.. opcode :: STORE_GLOBAL (namei)
2014-11-11 04:02:11 -04:00
Works as :opcode: `STORE_NAME` , but stores the name as a global.
2007-08-15 11:28:22 -03:00
.. opcode :: DELETE_GLOBAL (namei)
2014-11-11 04:02:11 -04:00
Works as :opcode: `DELETE_NAME` , but deletes a global name.
2007-08-15 11:28:22 -03:00
.. opcode :: LOAD_CONST (consti)
Pushes `` co_consts[consti] `` onto the stack.
.. opcode :: LOAD_NAME (namei)
Pushes the value associated with `` co_names[namei] `` onto the stack.
2023-05-26 14:48:17 -03:00
The name is looked up within the locals, then the globals, then the builtins.
.. opcode :: LOAD_LOCALS
Pushes a reference to the locals dictionary onto the stack. This is used
to prepare namespace dictionaries for :opcode: `LOAD_FROM_DICT_OR_DEREF`
and :opcode: `LOAD_FROM_DICT_OR_GLOBALS` .
.. versionadded :: 3.12
.. opcode :: LOAD_FROM_DICT_OR_GLOBALS (i)
Pops a mapping off the stack and looks up the value for `` co_names[namei] `` .
If the name is not found there, looks it up in the globals and then the builtins,
similar to :opcode: `LOAD_GLOBAL` .
This is used for loading global variables in
:ref: `annotation scopes <annotation-scopes>` within class bodies.
.. versionadded :: 3.12
2007-08-15 11:28:22 -03:00
.. opcode :: BUILD_TUPLE (count)
2015-03-02 10:31:40 -04:00
Creates a tuple consuming *count* items from the stack, and pushes the
2024-08-05 06:17:55 -03:00
resulting tuple onto the stack::
2023-01-12 14:23:50 -04:00
2024-08-05 06:17:55 -03:00
if count == 0:
value = ()
else:
value = tuple(STACK[-count:])
2024-09-01 03:11:40 -03:00
STACK = STACK[:-count]
2024-08-05 06:17:55 -03:00
STACK.append(value)
2007-08-15 11:28:22 -03:00
.. opcode :: BUILD_LIST (count)
2014-11-11 04:02:11 -04:00
Works as :opcode: `BUILD_TUPLE` , but creates a list.
2007-08-15 11:28:22 -03:00
.. opcode :: BUILD_SET (count)
2014-11-11 04:02:11 -04:00
Works as :opcode: `BUILD_TUPLE` , but creates a set.
2007-08-15 11:28:22 -03:00
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 15:39:10 -04:00
.. opcode :: BUILD_MAP (count)
2007-08-15 11:28:22 -03:00
2017-03-03 17:46:39 -04:00
Pushes a new dictionary object onto the stack. Pops `` 2 * count `` items
so that the dictionary holds *count* entries:
2023-01-12 14:23:50 -04:00
`` {..., STACK[-4]: STACK[-3], STACK[-2]: STACK[-1]} `` .
2017-03-03 17:46:39 -04:00
.. versionchanged :: 3.5
The dictionary is created from stack items instead of creating an
empty dictionary pre-sized to hold *count* items.
2007-08-15 11:28:22 -03:00
2016-09-06 16:07:53 -03:00
.. opcode :: BUILD_STRING (count)
Concatenates *count* strings from the stack and pushes the resulting string
onto the stack.
.. versionadded :: 3.6
2020-01-23 05:25:17 -04:00
.. opcode :: LIST_EXTEND (i)
2017-03-03 17:46:39 -04:00
2023-01-12 14:23:50 -04:00
Implements::
seq = STACK.pop()
list.extend(STACK[-i], seq)
Used to build lists.
2017-03-03 17:46:39 -04:00
2020-01-23 05:25:17 -04:00
.. versionadded :: 3.9
2017-03-03 17:46:39 -04:00
2020-01-27 05:57:45 -04:00
.. opcode :: SET_UPDATE (i)
2017-03-03 17:46:39 -04:00
2023-01-12 14:23:50 -04:00
Implements::
seq = STACK.pop()
set.update(STACK[-i], seq)
Used to build sets.
2017-03-03 17:46:39 -04:00
2020-01-23 05:25:17 -04:00
.. versionadded :: 3.9
2017-03-03 17:46:39 -04:00
2020-01-27 05:57:45 -04:00
.. opcode :: DICT_UPDATE (i)
2017-03-03 17:46:39 -04:00
2023-01-12 14:23:50 -04:00
Implements::
map = STACK.pop()
dict.update(STACK[-i], map)
Used to build dicts.
2017-03-03 17:46:39 -04:00
2020-01-27 05:57:45 -04:00
.. versionadded :: 3.9
2017-03-03 17:46:39 -04:00
2021-06-27 09:19:14 -03:00
.. opcode :: DICT_MERGE (i)
2017-03-03 17:46:39 -04:00
2020-11-28 17:43:22 -04:00
Like :opcode: `DICT_UPDATE` but raises an exception for duplicate keys.
2017-03-03 17:46:39 -04:00
2020-01-27 05:57:45 -04:00
.. versionadded :: 3.9
2017-03-03 17:46:39 -04:00
2007-08-15 11:28:22 -03:00
.. opcode :: LOAD_ATTR (namei)
2023-01-12 14:23:50 -04:00
If the low bit of `` namei `` is not set, this replaces `` STACK[-1] `` with
`` getattr(STACK[-1], co_names[namei>>1]) `` .
2022-06-14 10:43:28 -03:00
If the low bit of `` namei `` is set, this will attempt to load a method named
2023-01-12 14:23:50 -04:00
`` co_names[namei>>1] `` from the `` STACK[-1] `` object. `` STACK[-1] `` is popped.
This bytecode distinguishes two cases: if `` STACK[-1] `` has a method with the
correct name, the bytecode pushes the unbound method and `` STACK[-1] `` .
`` STACK[-1] `` will be used as the first argument (`` self `` ) by :opcode: `CALL`
2023-09-13 14:25:45 -03:00
or :opcode: `CALL_KW` when calling the unbound method.
Otherwise, `` NULL `` and the object returned by
2023-01-12 14:23:50 -04:00
the attribute lookup are pushed.
2022-06-14 10:43:28 -03:00
2022-06-14 13:22:32 -03:00
.. versionchanged :: 3.12
2022-06-14 10:43:28 -03:00
If the low bit of `` namei `` is set, then a `` NULL `` or `` self `` is
pushed to the stack before the attribute or unbound method respectively.
2007-08-15 11:28:22 -03:00
2023-04-24 19:22:14 -03:00
.. opcode :: LOAD_SUPER_ATTR (namei)
2023-10-17 09:59:34 -03:00
This opcode implements :func: `super` , both in its zero-argument and
two-argument forms (e.g. `` super().method() `` , `` super().attr `` and
`` super(cls, self).method() `` , `` super(cls, self).attr `` ).
It pops three values from the stack (from top of stack down):
2023-12-24 16:28:39 -04:00
* `` self `` : the first argument to the current method
* `` cls `` : the class within which the current method was defined
* the global `` super ``
2023-10-17 09:59:34 -03:00
With respect to its argument, it works similarly to :opcode: `LOAD_ATTR` ,
except that `` namei `` is shifted left by 2 bits instead of 1.
2023-04-24 19:22:14 -03:00
The low bit of `` namei `` signals to attempt a method load, as with
2024-03-28 19:26:56 -03:00
:opcode: `LOAD_ATTR` , which results in pushing `` NULL `` and the loaded method.
2023-10-17 09:59:34 -03:00
When it is unset a single value is pushed to the stack.
2023-04-24 19:22:14 -03:00
The second-low bit of `` namei `` , if set, means that this was a two-argument
call to :func: `super` (unset means zero-argument).
.. versionadded :: 3.12
2007-08-15 11:28:22 -03:00
.. opcode :: COMPARE_OP (opname)
Performs a Boolean operation. The operation name can be found in
2023-06-29 17:49:54 -03:00
`` cmp_op[opname >> 5] `` . If the fifth-lowest bit of `` opname `` is set
(`` opname & 16 `` ), the result should be coerced to `` bool `` .
.. versionchanged :: 3.13
The fifth-lowest bit of the oparg now indicates a forced conversion to
:class: `bool` .
2007-08-15 11:28:22 -03:00
2020-01-14 06:12:45 -04:00
.. opcode :: IS_OP (invert)
2020-11-28 17:43:22 -04:00
Performs `` is `` comparison, or `` is not `` if `` invert `` is 1.
2020-01-14 06:12:45 -04:00
.. versionadded :: 3.9
.. opcode :: CONTAINS_OP (invert)
2020-11-28 17:43:22 -04:00
Performs `` in `` comparison, or `` not in `` if `` invert `` is 1.
2020-01-14 06:12:45 -04:00
.. versionadded :: 3.9
2007-08-15 11:28:22 -03:00
.. opcode :: IMPORT_NAME (namei)
2023-01-12 14:23:50 -04:00
Imports the module `` co_names[namei] `` . `` STACK[-1] `` and `` STACK[-2] `` are
popped and provide the *fromlist* and *level* arguments of :func: `__import__` .
The module object is pushed onto the stack. The current namespace is not affected: for a proper import statement, a subsequent :opcode: `STORE_FAST` instruction
Merged revisions 62386-62387,62389-62393,62396,62400-62402,62407,62409-62410,62412-62414,62418-62419 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62386 | christian.heimes | 2008-04-19 04:23:57 +0200 (Sat, 19 Apr 2008) | 2 lines
Added kill, terminate and send_signal to subprocess.Popen
The bits and pieces for the Windows side were already in place. The POSIX side is trivial (as usual) and uses os.kill().
........
r62387 | georg.brandl | 2008-04-19 10:23:59 +0200 (Sat, 19 Apr 2008) | 2 lines
Fix-up docs for revision 62386.
........
r62389 | georg.brandl | 2008-04-19 18:57:43 +0200 (Sat, 19 Apr 2008) | 2 lines
#2369: clarify that copyfile() doesn't take a target directory.
........
r62390 | georg.brandl | 2008-04-19 18:58:28 +0200 (Sat, 19 Apr 2008) | 2 lines
#2634: clarify meaning of env parameter to spawn/exec*e.
........
r62391 | georg.brandl | 2008-04-19 18:58:49 +0200 (Sat, 19 Apr 2008) | 2 lines
#2633: clarify meaning of env parameter.
........
r62392 | georg.brandl | 2008-04-19 18:59:16 +0200 (Sat, 19 Apr 2008) | 2 lines
#2631: clarify IMPORT_NAME semantics.
........
r62393 | georg.brandl | 2008-04-19 19:00:14 +0200 (Sat, 19 Apr 2008) | 2 lines
:func: et al. should *not* include the parens.
........
r62396 | mark.dickinson | 2008-04-19 20:51:48 +0200 (Sat, 19 Apr 2008) | 5 lines
Additional tests for math.pow, and extra special-case
handling code in math.pow, in the hope of making all
tests pass on the alpha Tru64 buildbot.
........
r62400 | mark.dickinson | 2008-04-19 21:41:52 +0200 (Sat, 19 Apr 2008) | 3 lines
Additional special-case handling for math.pow.
Windows/VS2008 doesn't like (-1)**(+-inf).
........
r62401 | benjamin.peterson | 2008-04-19 21:47:34 +0200 (Sat, 19 Apr 2008) | 2 lines
Complete documentation for errors argument of io's open and TextIOWrapper
........
r62402 | mark.dickinson | 2008-04-19 22:31:16 +0200 (Sat, 19 Apr 2008) | 2 lines
Document updates to math and cmath modules.
........
r62407 | georg.brandl | 2008-04-19 23:28:38 +0200 (Sat, 19 Apr 2008) | 2 lines
Update template for newest Sphinx.
........
r62409 | mark.dickinson | 2008-04-19 23:35:35 +0200 (Sat, 19 Apr 2008) | 5 lines
Correct documentation for math.pow;
0**nan is nan, not 0. (But nan**0 and 1**nan are 1.)
Also fix minor typo: 'quite NaN' -> 'quiet NaN'
........
r62410 | mark.dickinson | 2008-04-19 23:49:22 +0200 (Sat, 19 Apr 2008) | 4 lines
Move asinh documentation to the proper place.
Remove meaningless 'in radians' from inverse
hyperbolic functions.
........
r62412 | mark.dickinson | 2008-04-20 03:22:30 +0200 (Sun, 20 Apr 2008) | 5 lines
Report additional diagnostic information in
test_math, to help track down debian-alpha
buildbot failure.
........
r62413 | mark.dickinson | 2008-04-20 03:39:24 +0200 (Sun, 20 Apr 2008) | 3 lines
FreeBSD doesn't follow C99 for modf(inf); so add explicit
special-value handling to math.modf code.
........
r62414 | mark.dickinson | 2008-04-20 06:13:13 +0200 (Sun, 20 Apr 2008) | 5 lines
Yet more explicit special case handling to make
math.pow behave on alpha Tru64. All IEEE 754
special values are now handled directly; only
the finite**finite case is handled by libm.
........
r62418 | mark.dickinson | 2008-04-20 18:13:17 +0200 (Sun, 20 Apr 2008) | 7 lines
Issue 2662: Initialize special value tables dynamically (i.e. when
cmath module is loaded) instead of statically. This fixes compile-time
problems on platforms where HUGE_VAL is an extern variable rather than
a constant.
Thanks Hirokazu Yamamoto for the patch.
........
r62419 | andrew.kuchling | 2008-04-20 18:54:02 +0200 (Sun, 20 Apr 2008) | 1 line
Move description of math module changes; various edits to description of cmath changes
........
2008-04-20 18:01:16 -03:00
modifies the namespace.
2007-08-15 11:28:22 -03:00
.. opcode :: IMPORT_FROM (namei)
2023-01-12 14:23:50 -04:00
Loads the attribute `` co_names[namei] `` from the module found in `` STACK[-1] `` .
The resulting object is pushed onto the stack, to be subsequently stored by a
2014-11-11 04:02:11 -04:00
:opcode: `STORE_FAST` instruction.
2007-08-15 11:28:22 -03:00
.. opcode :: JUMP_FORWARD (delta)
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
Increments bytecode counter by *delta* .
2007-08-15 11:28:22 -03:00
2022-03-31 10:14:15 -03:00
.. opcode :: JUMP_BACKWARD (delta)
2022-04-05 08:49:08 -03:00
Decrements bytecode counter by *delta* . Checks for interrupts.
.. versionadded :: 3.11
.. opcode :: JUMP_BACKWARD_NO_INTERRUPT (delta)
Decrements bytecode counter by *delta* . Does not check for interrupts.
2022-03-31 10:14:15 -03:00
.. versionadded :: 3.11
2022-09-01 17:36:47 -03:00
.. opcode :: POP_JUMP_IF_TRUE (delta)
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
If `` STACK[-1] `` is true, increments the bytecode counter by *delta* .
`` STACK[-1] `` is popped.
2007-08-15 11:28:22 -03:00
2022-09-01 17:36:47 -03:00
.. versionchanged :: 3.11
The oparg is now a relative delta rather than an absolute target.
This opcode is a pseudo-instruction, replaced in final bytecode by
the directed versions (forward/backward).
2022-04-11 06:40:24 -03:00
2022-09-01 17:36:47 -03:00
.. versionchanged :: 3.12
This is no longer a pseudo-instruction.
2022-04-11 06:40:24 -03:00
2023-06-29 17:49:54 -03:00
.. versionchanged :: 3.13
This instruction now requires an exact :class: `bool` operand.
2022-09-01 17:36:47 -03:00
.. opcode :: POP_JUMP_IF_FALSE (delta)
2022-04-11 06:40:24 -03:00
2023-01-12 14:23:50 -04:00
If `` STACK[-1] `` is false, increments the bytecode counter by *delta* .
`` STACK[-1] `` is popped.
2022-04-11 06:40:24 -03:00
2022-09-01 17:36:47 -03:00
.. versionchanged :: 3.11
The oparg is now a relative delta rather than an absolute target.
This opcode is a pseudo-instruction, replaced in final bytecode by
the directed versions (forward/backward).
2022-04-11 06:40:24 -03:00
2022-09-01 17:36:47 -03:00
.. versionchanged :: 3.12
This is no longer a pseudo-instruction.
2022-04-11 06:40:24 -03:00
2023-06-29 17:49:54 -03:00
.. versionchanged :: 3.13
This instruction now requires an exact :class: `bool` operand.
2022-09-01 17:36:47 -03:00
.. opcode :: POP_JUMP_IF_NOT_NONE (delta)
2022-04-11 06:40:24 -03:00
2023-01-12 14:23:50 -04:00
If `` STACK[-1] `` is not `` None `` , increments the bytecode counter by *delta* .
`` STACK[-1] `` is popped.
This opcode is a pseudo-instruction, replaced in final bytecode by
the directed versions (forward/backward).
2022-04-11 06:40:24 -03:00
.. versionadded :: 3.11
2022-09-01 17:36:47 -03:00
.. versionchanged :: 3.12
This is no longer a pseudo-instruction.
2018-02-01 07:48:33 -04:00
2021-12-14 12:48:15 -04:00
2022-09-01 17:36:47 -03:00
.. opcode :: POP_JUMP_IF_NONE (delta)
2022-01-06 07:38:35 -04:00
2023-01-12 14:23:50 -04:00
If `` STACK[-1] `` is `` None `` , increments the bytecode counter by *delta* .
`` STACK[-1] `` is popped.
This opcode is a pseudo-instruction, replaced in final bytecode by
the directed versions (forward/backward).
2022-01-06 07:38:35 -04:00
.. versionadded :: 3.11
2022-09-01 17:36:47 -03:00
.. versionchanged :: 3.12
This is no longer a pseudo-instruction.
2022-01-06 07:38:35 -04:00
2007-08-15 11:28:22 -03:00
.. opcode :: FOR_ITER (delta)
2023-01-12 14:23:50 -04:00
`` STACK[-1] `` is an :term: `iterator` . Call its :meth: `~iterator.__next__` method.
If this yields a new value, push it on the stack (leaving the iterator below
it). If the iterator indicates it is exhausted then the byte code counter is
incremented by *delta* .
2007-08-15 11:28:22 -03:00
2022-10-27 07:55:03 -03:00
.. versionchanged :: 3.12
Up until 3.11 the iterator was popped when it was exhausted.
2007-08-15 11:28:22 -03:00
.. opcode :: LOAD_GLOBAL (namei)
2022-03-17 13:14:57 -03:00
Loads the global named `` co_names[namei>>1] `` onto the stack.
2007-08-15 11:28:22 -03:00
2022-03-17 13:14:57 -03:00
.. versionchanged :: 3.11
If the low bit of `` namei `` is set, then a `` NULL `` is pushed to the
stack before the global variable.
2007-08-15 11:28:22 -03:00
.. opcode :: LOAD_FAST (var_num)
Pushes a reference to the local `` co_varnames[var_num] `` onto the stack.
2022-06-05 12:24:09 -03:00
.. versionchanged :: 3.12
This opcode is now only used in situations where the local variable is
guaranteed to be initialized. It cannot raise :exc: `UnboundLocalError` .
.. opcode :: LOAD_FAST_CHECK (var_num)
Pushes a reference to the local `` co_varnames[var_num] `` onto the stack,
raising an :exc: `UnboundLocalError` if the local variable has not been
initialized.
.. versionadded :: 3.12
2007-08-15 11:28:22 -03:00
2023-05-09 14:02:14 -03:00
.. opcode :: LOAD_FAST_AND_CLEAR (var_num)
Pushes a reference to the local `` co_varnames[var_num] `` onto the stack (or
pushes `` NULL `` onto the stack if the local variable has not been
initialized) and sets `` co_varnames[var_num] `` to `` NULL `` .
.. versionadded :: 3.12
2007-08-15 11:28:22 -03:00
.. opcode :: STORE_FAST (var_num)
2023-01-12 14:23:50 -04:00
Stores `` STACK.pop() `` into the local `` co_varnames[var_num] `` .
2007-08-15 11:28:22 -03:00
.. opcode :: DELETE_FAST (var_num)
Deletes local `` co_varnames[var_num] `` .
2021-06-08 19:01:34 -03:00
.. opcode :: MAKE_CELL (i)
2023-04-29 04:02:21 -03:00
Creates a new cell in slot `` i `` . If that slot is nonempty then
2021-06-08 19:01:34 -03:00
that value is stored into the new cell.
.. versionadded :: 3.11
2007-08-15 11:28:22 -03:00
.. opcode :: LOAD_DEREF (i)
2021-06-07 15:22:26 -03:00
Loads the cell contained in slot `` i `` of the "fast locals" storage.
2007-08-15 11:28:22 -03:00
Pushes a reference to the object the cell contains on the stack.
2021-06-07 15:22:26 -03:00
.. versionchanged :: 3.11
2023-12-06 16:15:46 -04:00
`` i `` is no longer offset by the length of :attr: `~codeobject.co_varnames` .
2021-06-07 15:22:26 -03:00
2007-08-15 11:28:22 -03:00
2023-05-26 14:48:17 -03:00
.. opcode :: LOAD_FROM_DICT_OR_DEREF (i)
2013-04-30 10:41:40 -03:00
2023-05-26 14:48:17 -03:00
Pops a mapping off the stack and looks up the name associated with
slot `` i `` of the "fast locals" storage in this mapping.
If the name is not found there, loads it from the cell contained in
slot `` i `` , similar to :opcode: `LOAD_DEREF` . This is used for loading
free variables in class bodies (which previously used
:opcode: `!LOAD_CLASSDEREF` ) and in
:ref: `annotation scopes <annotation-scopes>` within class bodies.
2018-02-01 07:48:33 -04:00
2023-05-26 14:48:17 -03:00
.. versionadded :: 3.12
2021-06-07 15:22:26 -03:00
2013-04-30 10:41:40 -03:00
2007-08-15 11:28:22 -03:00
.. opcode :: STORE_DEREF (i)
2023-01-12 14:23:50 -04:00
Stores `` STACK.pop() `` into the cell contained in slot `` i `` of the "fast locals"
2007-08-15 11:28:22 -03:00
storage.
2021-06-07 15:22:26 -03:00
.. versionchanged :: 3.11
2023-12-06 16:15:46 -04:00
`` i `` is no longer offset by the length of :attr: `~codeobject.co_varnames` .
2021-06-07 15:22:26 -03:00
2007-08-15 11:28:22 -03:00
2010-09-10 18:39:53 -03:00
.. opcode :: DELETE_DEREF (i)
2021-06-07 15:22:26 -03:00
Empties the cell contained in slot `` i `` of the "fast locals" storage.
2010-09-10 18:39:53 -03:00
Used by the :keyword: `del` statement.
2018-02-01 07:48:33 -04:00
.. versionadded :: 3.2
2021-06-07 15:22:26 -03:00
.. versionchanged :: 3.11
2023-12-06 16:15:46 -04:00
`` i `` is no longer offset by the length of :attr: `~codeobject.co_varnames` .
2021-06-07 15:22:26 -03:00
2010-09-10 18:39:53 -03:00
2021-11-23 05:53:24 -04:00
.. opcode :: COPY_FREE_VARS (n)
Copies the `` n `` free variables from the closure into the frame.
Removes the need for special code on the caller's side when calling
closures.
.. versionadded :: 3.11
2007-08-15 11:28:22 -03:00
.. opcode :: RAISE_VARARGS (argc)
2019-06-02 18:34:12 -03:00
Raises an exception using one of the 3 forms of the `` raise `` statement,
depending on the value of *argc* :
* 0: `` raise `` (re-raise previous exception)
2023-01-12 14:23:50 -04:00
* 1: `` raise STACK[-1] `` (raise exception instance or type at `` STACK[-1] `` )
* 2: `` raise STACK[-2] from STACK[-1] `` (raise exception instance or type at
`` STACK[-2] `` with `` __cause__ `` set to `` STACK[-1] `` )
2007-08-15 11:28:22 -03:00
2022-02-21 14:26:47 -04:00
.. opcode :: CALL (argc)
2017-03-10 18:52:35 -04:00
2023-09-13 14:25:45 -03:00
Calls a callable object with the number of arguments specified by `` argc `` .
On the stack are (in ascending order):
2017-03-10 18:52:35 -04:00
2022-01-28 08:42:30 -04:00
* The callable
2023-09-13 14:25:45 -03:00
* `` self `` or `` NULL ``
2022-02-21 14:26:47 -04:00
* The remaining positional arguments
2023-09-13 14:25:45 -03:00
`` argc `` is the total of the positional arguments, excluding `` self `` .
2022-02-21 14:26:47 -04:00
2022-01-28 08:42:30 -04:00
`` CALL `` pops all arguments and the callable object off the stack,
2018-09-17 09:15:03 -03:00
calls the callable object with those arguments, and pushes the return value
returned by the callable object.
2017-03-10 18:52:35 -04:00
2021-12-14 14:22:44 -04:00
.. versionadded :: 3.11
2017-03-10 18:52:35 -04:00
2023-09-13 14:25:45 -03:00
.. versionchanged :: 3.13
The callable now always appears at the same position on the stack.
.. versionchanged :: 3.13
Calls with keyword arguments are now handled by :opcode: `CALL_KW` .
.. opcode :: CALL_KW (argc)
Calls a callable object with the number of arguments specified by `` argc `` ,
including one or more named arguments. On the stack are (in ascending order):
* The callable
* `` self `` or `` NULL ``
* The remaining positional arguments
* The named arguments
* A :class: `tuple` of keyword argument names
`` argc `` is the total of the positional and named arguments, excluding `` self `` .
The length of the tuple of keyword argument names is the number of named arguments.
`` CALL_KW `` pops all arguments, the keyword names, and the callable object
off the stack, calls the callable object with those arguments, and pushes the
return value returned by the callable object.
.. versionadded :: 3.13
2017-03-10 18:52:35 -04:00
.. opcode :: CALL_FUNCTION_EX (flags)
2018-09-17 09:15:03 -03:00
Calls a callable object with variable set of positional and keyword
arguments. If the lowest bit of *flags* is set, the top of the stack
contains a mapping object containing additional keyword arguments.
Before the callable is called, the mapping object and iterable object
are each "unpacked" and their contents passed in as keyword and
positional arguments respectively.
`` CALL_FUNCTION_EX `` pops all arguments and the callable object off the stack,
calls the callable object with those arguments, and pushes the return value
returned by the callable object.
2017-03-10 18:52:35 -04:00
.. versionadded :: 3.6
2007-08-15 11:28:22 -03:00
2022-02-21 14:26:47 -04:00
.. opcode :: PUSH_NULL
2022-01-28 08:42:30 -04:00
2023-04-29 04:02:21 -03:00
Pushes a `` NULL `` to the stack.
Used in the call sequence to match the `` NULL `` pushed by
:opcode: `LOAD_METHOD` for non-method calls.
2022-01-28 08:42:30 -04:00
.. versionadded :: 3.11
2023-06-16 14:36:59 -03:00
.. opcode :: MAKE_FUNCTION
2007-08-15 11:28:22 -03:00
2023-06-16 14:36:59 -03:00
Pushes a new function object on the stack built from the code object at `` STACK[1] `` .
.. versionchanged :: 3.10
Flag value `` 0x04 `` is a tuple of strings instead of dictionary
.. versionchanged :: 3.11
Qualified name at `` STACK[-1] `` was removed.
.. versionchanged :: 3.13
Extra function attributes on the stack, signaled by oparg flags, were
removed. They now use :opcode: `SET_FUNCTION_ATTRIBUTE` .
.. opcode :: SET_FUNCTION_ATTRIBUTE (flag)
Sets an attribute on a function object. Expects the function at `` STACK[-1] ``
and the attribute value to set at `` STACK[-2] `` ; consumes both and leaves the
function at `` STACK[-1] `` . The flag determines which attribute to set:
2016-06-12 11:36:24 -03:00
2018-09-17 09:15:03 -03:00
* `` 0x01 `` a tuple of default values for positional-only and
positional-or-keyword parameters in positional order
2016-06-12 11:36:24 -03:00
* `` 0x02 `` a dictionary of keyword-only parameters' default values
2020-11-25 06:43:18 -04:00
* `` 0x04 `` a tuple of strings containing parameters' annotations
2016-06-12 11:36:24 -03:00
* `` 0x08 `` a tuple containing cells for free variables, making a closure
2007-08-15 11:28:22 -03:00
2023-06-16 14:36:59 -03:00
.. versionadded :: 3.13
2023-06-15 21:04:57 -03:00
2007-08-15 11:28:22 -03:00
.. opcode :: BUILD_SLICE (argc)
2023-05-06 00:54:08 -03:00
.. index :: pair: built-in function; slice
2007-08-15 11:28:22 -03:00
2023-01-12 14:23:50 -04:00
Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, implements::
end = STACK.pop()
start = STACK.pop()
2024-08-17 05:50:58 -03:00
STACK.append(slice(start, end))
2023-01-12 14:23:50 -04:00
if it is 3, implements::
step = STACK.pop()
end = STACK.pop()
start = STACK.pop()
STACK.append(slice(start, end, step))
See the :func: `slice` built-in function for more information.
2007-08-15 11:28:22 -03:00
.. opcode :: EXTENDED_ARG (ext)
2019-06-12 00:46:09 -03:00
Prefixes any opcode which has an argument too big to fit into the default one
byte. *ext* holds an additional byte which act as higher bits in the argument.
For each opcode, at most three prefixal `` EXTENDED_ARG `` are allowed, forming
an argument from two-byte to four-byte.
2007-08-15 11:28:22 -03:00
2023-06-14 12:15:08 -03:00
.. opcode :: CONVERT_VALUE (oparg)
2015-11-03 14:09:01 -04:00
2023-06-14 12:15:08 -03:00
Convert value to a string, depending on `` oparg `` ::
2015-11-03 14:09:01 -04:00
2023-06-14 12:15:08 -03:00
value = STACK.pop()
result = func(value)
2024-02-15 03:14:03 -04:00
STACK.append(result)
2015-11-03 14:09:01 -04:00
2023-06-14 12:15:08 -03:00
* `` oparg == 1 `` : call :func: `str` on *value*
* `` oparg == 2 `` : call :func: `repr` on *value*
* `` oparg == 3 `` : call :func: `ascii` on *value*
2015-11-03 14:09:01 -04:00
2023-06-14 12:15:08 -03:00
Used for implementing formatted literal strings (f-strings).
.. versionadded :: 3.13
.. opcode :: FORMAT_SIMPLE
Formats the value on top of stack::
value = STACK.pop()
result = value.__format__("")
2024-02-15 03:14:03 -04:00
STACK.append(result)
2023-06-14 12:15:08 -03:00
Used for implementing formatted literal strings (f-strings).
.. versionadded :: 3.13
.. opcode :: FORMAT_SPEC
Formats the given value with the given format spec::
spec = STACK.pop()
value = STACK.pop()
result = value.__format__(spec)
2024-02-15 03:14:03 -04:00
STACK.append(result)
2023-06-14 12:15:08 -03:00
Used for implementing formatted literal strings (f-strings).
.. versionadded :: 3.13
2015-11-03 17:30:49 -04:00
2015-11-03 14:09:01 -04:00
2021-02-26 18:51:55 -04:00
.. opcode :: MATCH_CLASS (count)
2023-01-12 14:23:50 -04:00
`` STACK[-1] `` is a tuple of keyword attribute names, `` STACK[-2] `` is the class
being matched against, and `` STACK[-3] `` is the match subject. *count* is the
number of positional sub-patterns.
2021-02-26 18:51:55 -04:00
2023-01-12 14:23:50 -04:00
Pop `` STACK[-1] `` , `` STACK[-2] `` , and `` STACK[-3] `` . If `` STACK[-3] `` is an
instance of `` STACK[-2] `` and has the positional and keyword attributes
required by *count* and `` STACK[-1] `` , push a tuple of extracted attributes.
Otherwise, push `` None `` .
2021-02-26 18:51:55 -04:00
.. versionadded :: 3.10
2021-10-27 06:45:35 -03:00
.. versionchanged :: 3.11
Previously, this instruction also pushed a boolean value indicating
success (`` True `` ) or failure (`` False `` ).
2021-05-02 17:02:10 -03:00
2023-11-02 07:18:43 -03:00
.. opcode :: RESUME (context)
2022-01-06 09:09:25 -04:00
2023-04-29 04:02:21 -03:00
A no-op. Performs internal tracing, debugging and optimization checks.
2022-01-06 09:09:25 -04:00
2024-06-06 18:35:24 -03:00
The `` context `` operand consists of two parts. The lowest two bits
2023-11-02 07:18:43 -03:00
indicate where the `` RESUME `` occurs:
2022-01-06 09:09:25 -04:00
2023-04-29 04:02:21 -03:00
* `` 0 `` The start of a function, which is neither a generator, coroutine
nor an async generator
* `` 1 `` After a `` yield `` expression
* `` 2 `` After a `` yield from `` expression
* `` 3 `` After an `` await `` expression
2022-01-06 09:09:25 -04:00
2023-11-02 07:18:43 -03:00
The next bit is `` 1 `` if the RESUME is at except-depth `` 1 `` , and `` 0 ``
otherwise.
2022-01-06 09:09:25 -04:00
.. versionadded :: 3.11
2023-11-02 07:18:43 -03:00
.. versionchanged :: 3.13
The oparg value changed to include information about except-depth
2022-01-06 09:09:25 -04:00
2022-01-20 07:46:39 -04:00
.. opcode :: RETURN_GENERATOR
2023-04-29 04:02:21 -03:00
Create a generator, coroutine, or async generator from the current frame.
Used as first opcode of in code object for the above mentioned callables.
Clear the current frame and return the newly created generator.
2022-01-20 07:46:39 -04:00
2023-04-29 04:02:21 -03:00
.. versionadded :: 3.11
2022-01-20 07:46:39 -04:00
2022-08-19 16:33:44 -03:00
.. opcode :: SEND (delta)
2023-04-29 04:02:21 -03:00
Equivalent to `` STACK[-1] = STACK[-2].send(STACK[-1]) `` . Used in `` yield from ``
and `` await `` statements.
2022-01-24 07:08:53 -04:00
2023-10-17 09:59:34 -03:00
If the call raises :exc: `StopIteration` , pop the top value from the stack,
push the exception's `` value `` attribute, and increment the bytecode counter
by *delta* .
2022-01-24 07:08:53 -04:00
2023-04-29 04:02:21 -03:00
.. versionadded :: 3.11
2022-01-24 07:08:53 -04:00
2010-07-03 07:41:33 -03:00
.. opcode :: HAVE_ARGUMENT
2007-08-15 11:28:22 -03:00
2015-03-02 10:31:40 -04:00
This is not really an opcode. It identifies the dividing line between
2022-07-01 11:33:35 -03:00
opcodes in the range [0,255] which don't use their argument and those
that do (`` < HAVE_ARGUMENT `` and `` >= HAVE_ARGUMENT `` , respectively).
2023-09-12 07:36:17 -03:00
If your application uses pseudo instructions or specialized instructions,
use the :data: `hasarg` collection instead.
2017-03-24 18:05:04 -03:00
.. versionchanged :: 3.6
Now every instruction has an argument, but opcodes `` < HAVE_ARGUMENT ``
ignore it. Before, only opcodes `` >= HAVE_ARGUMENT `` had an argument.
2022-07-01 11:33:35 -03:00
.. versionchanged :: 3.12
Pseudo instructions were added to the :mod: `dis` module, and for them
it is not true that comparison with `` HAVE_ARGUMENT `` indicates whether
they use their arg.
2023-09-12 12:45:35 -03:00
.. deprecated :: 3.13
Use :data: `hasarg` instead.
2022-07-01 11:33:35 -03:00
2023-01-05 12:05:51 -04:00
.. opcode :: CALL_INTRINSIC_1
2023-01-12 14:23:50 -04:00
Calls an intrinsic function with one argument. Passes `` STACK[-1] `` as the
2023-02-14 07:54:13 -04:00
argument and sets `` STACK[-1] `` to the result. Used to implement
2023-10-17 09:59:34 -03:00
functionality that is not performance critical.
2023-01-05 12:05:51 -04:00
2023-04-29 04:02:21 -03:00
The operand determines which intrinsic function is called:
2023-01-05 12:05:51 -04:00
2023-05-26 14:48:17 -03:00
+-----------------------------------+-----------------------------------+
| Operand | Description |
+===================================+===================================+
| `` INTRINSIC_1_INVALID `` | Not valid |
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_PRINT `` | Prints the argument to standard |
| | out. Used in the REPL. |
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_IMPORT_STAR `` | Performs `` import * `` for the |
| | named module. |
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_STOPITERATION_ERROR `` | Extracts the return value from a |
| | `` StopIteration `` exception. |
+-----------------------------------+-----------------------------------+
2024-07-19 04:30:01 -03:00
| `` INTRINSIC_ASYNC_GEN_WRAP `` | Wraps an async generator value |
2023-05-26 14:48:17 -03:00
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_UNARY_POSITIVE `` | Performs the unary `` + `` |
| | operation |
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_LIST_TO_TUPLE `` | Converts a list to a tuple |
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_TYPEVAR `` | Creates a :class: `typing.TypeVar` |
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_PARAMSPEC `` | Creates a |
| | :class: `typing.ParamSpec` |
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_TYPEVARTUPLE `` | Creates a |
| | :class: `typing.TypeVarTuple` |
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_SUBSCRIPT_GENERIC `` | Returns :class: `typing.Generic` |
| | subscripted with the argument |
+-----------------------------------+-----------------------------------+
| `` INTRINSIC_TYPEALIAS `` | Creates a |
| | :class: `typing.TypeAliasType` ; |
| | used in the :keyword: `type` |
| | statement. The argument is a tuple|
| | of the type alias's name, |
| | type parameters, and value. |
+-----------------------------------+-----------------------------------+
2023-01-05 12:05:51 -04:00
.. versionadded :: 3.12
2023-02-14 07:54:13 -04:00
.. opcode :: CALL_INTRINSIC_2
2023-10-17 09:59:34 -03:00
Calls an intrinsic function with two arguments. Used to implement functionality
that is not performance critical::
arg2 = STACK.pop()
arg1 = STACK.pop()
result = intrinsic2(arg1, arg2)
2024-02-15 03:14:03 -04:00
STACK.append(result)
2023-02-14 07:54:13 -04:00
2023-04-29 04:02:21 -03:00
The operand determines which intrinsic function is called:
2023-02-14 07:54:13 -04:00
2023-05-26 14:48:17 -03:00
+----------------------------------------+-----------------------------------+
| Operand | Description |
+========================================+===================================+
| `` INTRINSIC_2_INVALID `` | Not valid |
+----------------------------------------+-----------------------------------+
| `` INTRINSIC_PREP_RERAISE_STAR `` | Calculates the |
| | :exc: `ExceptionGroup` to raise |
| | from a `` try-except* `` . |
+----------------------------------------+-----------------------------------+
| `` INTRINSIC_TYPEVAR_WITH_BOUND `` | Creates a :class: `typing.TypeVar` |
| | with a bound. |
+----------------------------------------+-----------------------------------+
| `` INTRINSIC_TYPEVAR_WITH_CONSTRAINTS `` | Creates a |
| | :class: `typing.TypeVar` with |
| | constraints. |
+----------------------------------------+-----------------------------------+
| `` INTRINSIC_SET_FUNCTION_TYPE_PARAMS `` | Sets the `` __type_params__ `` |
| | attribute of a function. |
+----------------------------------------+-----------------------------------+
2023-02-14 07:54:13 -04:00
.. versionadded :: 3.12
2023-01-05 12:05:51 -04:00
2024-06-18 08:17:46 -03:00
.. opcode :: LOAD_SPECIAL
Performs special method lookup on `` STACK[-1] `` .
If `` type(STACK[-1]).__xxx__ `` is a method, leave
`` type(STACK[-1]).__xxx__; STACK[-1] `` on the stack.
If `` type(STACK[-1]).__xxx__ `` is not a method, leave
`` STACK[-1].__xxx__; NULL `` on the stack.
.. versionadded :: 3.14
2022-07-01 11:33:35 -03:00
**Pseudo-instructions**
2023-04-29 04:02:21 -03:00
These opcodes do not appear in Python bytecode. They are used by the compiler
2022-07-01 11:33:35 -03:00
but are replaced by real opcodes or removed before bytecode is generated.
.. opcode :: SETUP_FINALLY (target)
Set up an exception handler for the following code block. If an exception
occurs, the value stack level is restored to its current state and control
is transferred to the exception handler at `` target `` .
.. opcode :: SETUP_CLEANUP (target)
2023-04-29 04:02:21 -03:00
Like `` SETUP_FINALLY `` , but in case of an exception also pushes the last
2022-07-01 11:33:35 -03:00
instruction (`` lasti `` ) to the stack so that `` RERAISE `` can restore it.
If an exception occurs, the value stack level and the last instruction on
the frame are restored to their current state, and control is transferred
to the exception handler at `` target `` .
.. opcode :: SETUP_WITH (target)
2023-04-29 04:02:21 -03:00
Like `` SETUP_CLEANUP `` , but in case of an exception one more item is popped
2022-07-01 11:33:35 -03:00
from the stack before control is transferred to the exception handler at
`` target `` .
This variant is used in :keyword: `with` and :keyword: `async with`
constructs, which push the return value of the context manager's
:meth: `~object.__enter__` or :meth: `~object.__aenter__` to the stack.
.. opcode :: POP_BLOCK
Marks the end of the code block associated with the last `` SETUP_FINALLY `` ,
`` SETUP_CLEANUP `` or `` SETUP_WITH `` .
.. opcode :: JUMP
.. opcode :: JUMP_NO_INTERRUPT
Undirected relative jump instructions which are replaced by their
directed (forward/backward) counterparts by the assembler.
2023-06-29 13:34:00 -03:00
.. opcode :: LOAD_CLOSURE (i)
Pushes a reference to the cell contained in slot `` i `` of the "fast locals"
storage.
Note that `` LOAD_CLOSURE `` is replaced with `` LOAD_FAST `` in the assembler.
.. versionchanged :: 3.13
This opcode is now a pseudo-instruction.
2022-07-01 11:33:35 -03:00
.. opcode :: LOAD_METHOD
Optimized unbound method lookup. Emitted as a `` LOAD_ATTR `` opcode
with a flag set in the arg.
2007-08-15 11:28:22 -03:00
2013-05-06 10:59:20 -03:00
.. _opcode_collections:
Opcode collections
------------------
These collections are provided for automatic introspection of bytecode
instructions:
2023-04-29 04:02:21 -03:00
.. versionchanged :: 3.12
2023-10-17 09:59:34 -03:00
The collections now contain pseudo instructions and instrumented
instructions as well. These are opcodes with values `` >= MIN_PSEUDO_OPCODE ``
and `` >= MIN_INSTRUMENTED_OPCODE `` .
2022-07-01 11:33:35 -03:00
2013-05-06 10:59:20 -03:00
.. data :: opname
Sequence of operation names, indexable using the bytecode.
.. data :: opmap
Dictionary mapping operation names to bytecodes.
.. data :: cmp_op
Sequence of all compare operation names.
2022-07-01 11:33:35 -03:00
.. data :: hasarg
Sequence of bytecodes that use their argument.
2023-04-29 04:02:21 -03:00
.. versionadded :: 3.12
2022-07-01 11:33:35 -03:00
2013-05-06 10:59:20 -03:00
.. data :: hasconst
2018-09-17 09:15:03 -03:00
Sequence of bytecodes that access a constant.
2013-05-06 10:59:20 -03:00
.. data :: hasfree
2023-04-29 04:02:21 -03:00
Sequence of bytecodes that access a free variable. 'free' in this
2015-03-02 10:31:40 -04:00
context refers to names in the current scope that are referenced by inner
scopes or names in outer scopes that are referenced from this scope. It does
2023-04-29 04:02:21 -03:00
*not* include references to global or builtin scopes.
2013-05-06 10:59:20 -03:00
.. data :: hasname
Sequence of bytecodes that access an attribute by name.
2023-07-18 15:42:44 -03:00
.. data :: hasjump
2013-05-06 10:59:20 -03:00
2023-07-18 15:42:44 -03:00
Sequence of bytecodes that have a jump target. All jumps
are relative.
2013-05-06 10:59:20 -03:00
2023-07-18 15:42:44 -03:00
.. versionadded :: 3.13
2013-05-06 10:59:20 -03:00
.. data :: haslocal
Sequence of bytecodes that access a local variable.
.. data :: hascompare
Sequence of bytecodes of Boolean operations.
2022-07-01 11:33:35 -03:00
.. data :: hasexc
Sequence of bytecodes that set an exception handler.
2023-04-29 04:02:21 -03:00
.. versionadded :: 3.12
2023-07-18 15:42:44 -03:00
.. data :: hasjrel
Sequence of bytecodes that have a relative jump target.
.. deprecated :: 3.13
All jumps are now relative. Use :data: `hasjump` .
.. data :: hasjabs
Sequence of bytecodes that have an absolute jump target.
.. deprecated :: 3.13
All jumps are now relative. This list is empty.