Commit Graph

49 Commits

Author SHA1 Message Date
Benjamin Peterson 51e7ad3b04 Merged revisions 79769 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79769 | benjamin.peterson | 2010-04-04 18:23:22 -0500 (Sun, 04 Apr 2010) | 1 line

  fix dis on new style classes #8310
........
2010-04-04 23:27:35 +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
Thomas Wouters 104a7bcc28 Support for augmented assignment in the UserList, UserDict, UserString and
rfc822 (Addresslist) modules. Also a preliminary testcase for augmented
assignment, which should actually be merged with the test_class testcase I
added last week.
2000-08-24 20:14:10 +00:00
Fred Drake ef8ace3a6f Charles G. Waldman <cgw@fnal.gov>:
Add the EXTENDED_ARG opcode to the virtual machine, allowing 32-bit
arguments to opcodes instead of being forced to stick to the 16-bit
limit.  This is especially useful for machine-generated code, which
can be too long for the SET_LINENO parameter to fit into 16 bits.

This closes the implementation portion of SourceForge patch #100893.
2000-08-24 00:32:09 +00:00
Barry Warsaw 203da6dfe4 Add the new PRINT_ITEM_TO and PRINT_NEWLINE_TO opcodes. 2000-08-21 17:18:40 +00:00
Thomas Wouters 5215225ea1 Apply SF patch #101135, adding 'import module as m' and 'from module import
name as n'. By doing some twists and turns, "as" is not a reserved word.

There is a slight change in semantics for 'from module import name' (it will
now honour the 'global' keyword) but only in cases that are explicitly
undocumented.
2000-08-17 22:55:00 +00:00
Thomas Wouters 0be5aab04d Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since they
did the same anyway.

I'm not sure what to do with Tools/compiler/compiler/* -- that isn't part of
distutils, is it ? Should it try to be compatible with old bytecode version ?
2000-08-11 22:15:52 +00:00
Guido van Rossum d30dedca27 Michael Hudson: With the (cool!) new call syntax, the longest opcode
name is much longer, which fouls up dis's formatting slightly; this is
a "fix" for that.
2000-03-30 15:02:11 +00:00
Jeremy Hylton 7690151c7e slightly modified version of Greg Ewing's extended call syntax patch
executive summary:
Instead of typing 'apply(f, args, kwargs)' you can type 'f(*arg, **kwargs)'.
Some file-by-file details follow.

Grammar/Grammar:
    simplify varargslist, replacing '*' '*' with '**'
    add * & ** options to arglist

Include/opcode.h & Lib/dis.py:
    define three new opcodes
        CALL_FUNCTION_VAR
        CALL_FUNCTION_KW
        CALL_FUNCTION_VAR_KW

Python/ceval.c:
    extend TypeError "keyword parameter redefined" message to include
        the name of the offending keyword
    reindent CALL_FUNCTION using four spaces
    add handling of sequences and dictionaries using extend calls
    fix function import_from to use PyErr_Format
2000-03-28 23:49:17 +00:00
Guido van Rossum 1fdae12c93 Added a simple test program to disassemble a file, invoked as __main__. 2000-02-04 17:47:55 +00:00
Guido van Rossum 1cc2b9de35 Clarify why we define disco. Suggested by Andrew Dalke. 1999-05-03 18:09:53 +00:00
Guido van Rossum 9d865e1a30 Get rid of some obsolete opcodes. 1998-07-07 14:58:39 +00:00
Guido van Rossum 421c224044 Added docstrings (contributed by Martin von Loewis). 1997-11-18 15:47:55 +00:00
Guido van Rossum d0f2372cb9 Modernized for 1.5 1997-05-09 03:21:44 +00:00
Guido van Rossum 18aef3c102 Support disassembly of a variety of objects through dis.dis(). 1997-03-14 04:15:43 +00:00
Guido van Rossum 00f86e6086 Of course, when the type of the argument to dis() is unsupported, it
should raise TypeError, not ValueError...
1997-01-17 20:08:18 +00:00
Guido van Rossum bd30795192 More user friedly interface:
dis() still disassembles the last frame of the lats stack trace.

dis(x) disassembles x, which may be a code object, function, or method.

disassemble(co, [lasti]) disassembles a code object; the lasti
argument is now optional.

disco(...) is an alias for disassemble(...), for backward compatibility.
1997-01-17 20:05:04 +00:00
Guido van Rossum d0bc9cb869 Merge several mods:
- add opcodes BINARY_LSHIFT ... BINARY_OR

- remove RESERVE_FAST

- Skip M's suggestion for displaying which comparison operator is meant
1997-01-16 18:52:24 +00:00
Guido van Rossum 934a4cea85 Show names of locals in disco (Ka-Ping Yee) 1996-09-12 17:39:36 +00:00
Guido van Rossum 151fcfd101 Zapped obsolete opcode LOAD_GLOBALS. 1996-09-10 18:26:36 +00:00
Guido van Rossum 56a733856e Added BUILD_SLICE opcode. 1996-07-30 16:26:07 +00:00
Guido van Rossum 6e21cebfbb New opcodes BINARY_POWER, RAISE_VARARGS, CALL_FUNCTION, MAKE_FUNCTION 1996-07-21 02:16:53 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum e65cce5eec * string.py: added rindex(), rfind(); changed index() to interpret
negative start indices starting from the right.
* ftplib.py: debug() -> set_debuglevel(); change demo to use __init__().
* os.py: added execl, execlp, and execvp.
* lambda.py: removed (now that we have built-in map, reduce, bagof, lambda)
* test_b{1,2}.py, testall.out: added tests for bagof, lambda, map, reduce
* commands.py: use os, not posix
* test_grammar.py: make it easy to disable non-portable int overflow tests
* dis.py: don't abuse range()
1993-11-08 15:05:21 +00:00
Guido van Rossum 8379ed5f02 Updated because of new opcodes introduced for "fast" local variables. 1993-03-30 19:13:03 +00:00
Guido van Rossum bdfcfccbe5 New == syntax 1992-01-01 19:35:13 +00:00
Guido van Rossum a594fabbfa New opcodes: UNPACK_ARG, STORE_GLOBAL, DELETE_GLOBAL, LOAD_LOCAL, LOAD_GLOBAL 1991-12-16 13:09:28 +00:00
Guido van Rossum 217a5fa3c3 Initial revision 1990-12-26 15:40:07 +00:00