Commit Graph

51 Commits

Author SHA1 Message Date
Benjamin Peterson
76a23c17bc fix dis on new style classes #8310 2010-04-04 23:23:22 +00:00
Benjamin Peterson
e1577fb20f use isinstance 2009-05-10 14:16:47 +00:00
Georg Brandl
775c307068 #4222: document dis.findlabels() and dis.findlinestarts() and
put them into dis.__all__.
2009-01-01 12:09:40 +00:00
Walter Dörwald
70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Armin Rigo
9c8f7eafca Fixed dis.disassemble_string().
Added dis.findlinestarts().
SF bug 811294
2003-10-28 12:17:25 +00:00
Tim Peters
669454e9dc Whitespace normalization. 2003-03-07 17:30:48 +00:00
Skip Montanaro
19c6ba3664 * separate opcode definitions into opcode.py
* add disassemble_string
* allow classes and strings containing bytecode to be disassembled
2003-02-27 21:29:27 +00:00
Michael W. Hudson
53d58bb369 Further SET_LINENO reomval fixes. See comments in patch #587933.
Use a slightly different strategy to determine when not to call the line
trace function.  This removes the need for the RETURN_NONE opcode, so
that's gone again.  Update docs and comments to match.

Thanks to Neal and Armin!

Also add a test suite.  This should have come with the original patch...
2002-08-30 13:09:51 +00:00
Tim Peters
280488b9a3 Whitespace normalization. 2002-08-23 18:19:30 +00:00
Michael W. Hudson
dd32a91cc0 This is my patch
[ 587993 ] SET_LINENO killer

Remove SET_LINENO.  Tracing is now supported by inspecting co_lnotab.

Many sundry changes to document and adapt to this change.
2002-08-15 14:59:02 +00:00
Guido van Rossum
fea59e7f76 The opcode FOR_LOOP no longer exists. 2002-06-13 17:59:51 +00:00
Guido van Rossum
9f709bf9a1 The opcode YIELD_STMT was accidentally called YIELD_VALUE here. 2002-06-11 21:17:35 +00:00
Raymond Hettinger
0f4940c0a8 Replaced boolean test with 'is None' 2002-06-01 00:57:55 +00:00
Neal Norwitz
aa38aa5435 SF #515009, delete global variable that was apparently used only
in a for loop.
2002-02-11 18:14:22 +00:00
Jeremy Hylton
96d68d57be Add opcodes for floor division and true division (PEP 238) 2001-08-29 18:02:21 +00:00
Jeremy Hylton
318e167e98 FOR_ITER is a jrel_op() not a plain old def_op() 2001-08-28 15:32:48 +00:00
Tim Peters
5ca576ed0a Merging the gen-branch into the main line, at Guido's direction. Yay!
Bugfix candidate in inspect.py:  it was referencing "self" outside of
a method.
2001-06-18 22:08:13 +00:00
Guido van Rossum
59d1d2b434 Iterators phase 1. This comprises:
new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER
new C API PyObject_GetIter(), calls tp_iter
new builtin iter(), with two forms: iter(obj), and iter(function, sentinel)
new internal object types iterobject and calliterobject
new exception StopIteration
new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py)
new magic number for .pyc files
new special method for instances: __iter__() returns an iterator
iteration over dictionaries: "for x in dict" iterates over the keys
iteration over files: "for x in file" iterates over lines

TODO:

documentation
test suite
decide whether to use a different way to spell iter(function, sentinal)
decide whether "for key in dict" is a good idea
use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?)
speed tuning (make next() a slot tp_next???)
2001-04-20 19:13:02 +00:00
Eric S. Raymond
373c55e510 String method conversion. 2001-02-09 08:25:29 +00:00
Jeremy Hylton
3faa52ecc4 Allow 'continue' inside 'try' clause
SF patch 102989 by Thomas Wouters
2001-02-01 22:48:12 +00:00
Jeremy Hylton
a39414b15c PEP 227 implementation
Track changes to new opcodes.  Add hasfree list that applies to all
ops that use the closure.
2001-01-25 20:08:47 +00:00
Skip Montanaro
e99d5ea25b added __all__ lists to a number of Python modules
added test script and expected output file as well
this closes patch 103297.
__all__ attributes will be added to other modules without first submitting
a patch, just adding the necessary line to the test script to verify
more-or-less correct implementation.
2001-01-20 19:54:20 +00:00
Guido van Rossum
fc53c13dd5 Checking in a slight variation of Barry's patch 103303. 2001-01-19 02:41:41 +00:00
Tim Peters
88869f9787 Whitespace normalization. 2001-01-14 23:36:06 +00:00
Thomas Wouters
6af3b37021 Add missing opcodes. Thanx to jeremy for reminding me ;) 2000-08-24 22:44:53 +00:00