Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_dis Namespace Reference

Classes

class  DisTests
class  CodeInfoTests

Functions

def _f
def bug708901
def bug1333982
def tricky
def test_main

Variables

string dis_f
string dis_bug708901
string dis_bug1333982
string _BIG_LINENO_FORMAT
string dis_module_expected_results
string expr_str = "x + 1"
string dis_expr_str
string simple_stmt_str = "x = x + 1"
string dis_simple_stmt_str
string compound_stmt_str
string dis_compound_stmt_str
string code_info_code_info
string code_info_tricky
list co_tricky_nested_f = tricky.__func__.__code__.co_consts[1]
string code_info_tricky_nested_f
string code_info_expr_str
string code_info_simple_stmt_str
string code_info_compound_stmt_str

Function Documentation

def test.test_dis._f (   a) [private]

Definition at line 10 of file test_dis.py.

00010 
00011 def _f(a):
00012     print(a)
00013     return 1

def test.test_dis.bug1333982 (   x = [])

Definition at line 51 of file test_dis.py.

00051 
00052 def bug1333982(x=[]):
00053     assert 0, ([s for s in x] +
00054               1)
00055     pass

Definition at line 26 of file test_dis.py.

00026 
00027 def bug708901():
00028     for res in range(1,
00029                      10):
00030         pass

Definition at line 366 of file test_dis.py.

00366 
00367 def test_main():
00368     run_unittest(DisTests, CodeInfoTests)

Here is the call graph for this function:

def test.test_dis.tricky (   x,
  y,
  z = True,
  args,
  c,
  d,
  e = [],
  kwds 
) [static]

Definition at line 245 of file test_dis.py.

00245 
00246 def tricky(x, y, z=True, *args, c, d, e=[], **kwds):
00247     def f(c=c):
00248         print(x, y, z, c, d, e, f)
00249     yield x, y, z, c, d, e, f


Variable Documentation

Initial value:
00001 """\
00002 %3d           0 LOAD_GLOBAL              0 (spam)
00003               3 POP_TOP
00004               4 LOAD_CONST               0 (None)
00005               7 RETURN_VALUE
00006 """

Definition at line 81 of file test_dis.py.

list test.test_dis.co_tricky_nested_f = tricky.__func__.__code__.co_consts[1]

Definition at line 278 of file test_dis.py.

Initial value:
00001 """\
00002 Name:              code_info
00003 Filename:          (.*)
00004 Argument count:    1
00005 Kw-only arguments: 0
00006 Number of locals:  1
00007 Stack size:        4
00008 Flags:             OPTIMIZED, NEWLOCALS, NOFREE
00009 Constants:
00010    0: %r
00011    1: '__func__'
00012    2: '__code__'
00013    3: '<code_info>'
00014    4: 'co_code'
00015    5: "don't know how to disassemble %%s objects"
00016 %sNames:
00017    0: hasattr
00018    1: __func__
00019    2: __code__
00020    3: isinstance
00021    4: str
00022    5: _try_compile
00023    6: _format_code_info
00024    7: TypeError
00025    8: type
00026    9: __name__
00027 Variable names:
00028    0: x"""

Definition at line 214 of file test_dis.py.

Initial value:
00001 """\
00002 Name:              <module>
00003 Filename:          <code_info>
00004 Argument count:    0
00005 Kw-only arguments: 0
00006 Number of locals:  0
00007 Stack size:        2
00008 Flags:             NOFREE
00009 Constants:
00010    0: 0
00011    1: 1
00012    2: None
00013 Names:
00014    0: x"""

Definition at line 329 of file test_dis.py.

Initial value:
00001 """\
00002 Name:              <module>
00003 Filename:          <code_info>
00004 Argument count:    0
00005 Kw-only arguments: 0
00006 Number of locals:  0
00007 Stack size:        2
00008 Flags:             NOFREE
00009 Constants:
00010    0: 1
00011 Names:
00012    0: x"""

Definition at line 302 of file test_dis.py.

Initial value:
00001 """\
00002 Name:              <module>
00003 Filename:          <code_info>
00004 Argument count:    0
00005 Kw-only arguments: 0
00006 Number of locals:  0
00007 Stack size:        2
00008 Flags:             NOFREE
00009 Constants:
00010    0: 1
00011    1: None
00012 Names:
00013    0: x"""

Definition at line 315 of file test_dis.py.

Initial value:
00001 """\
00002 Name:              tricky
00003 Filename:          (.*)
00004 Argument count:    3
00005 Kw-only arguments: 3
00006 Number of locals:  8
00007 Stack size:        7
00008 Flags:             OPTIMIZED, NEWLOCALS, VARARGS, VARKEYWORDS, GENERATOR
00009 Constants:
00010    0: None
00011    1: <code object f at (.*), file "(.*)", line (.*)>
00012 Variable names:
00013    0: x
00014    1: y
00015    2: z
00016    3: c
00017    4: d
00018    5: e
00019    6: args
00020    7: kwds
00021 Cell variables:
00022    0: e
00023    1: d
00024    2: f
00025    3: y
00026    4: x
00027    5: z"""

Definition at line 250 of file test_dis.py.

Initial value:
00001 """\
00002 Name:              f
00003 Filename:          (.*)
00004 Argument count:    1
00005 Kw-only arguments: 0
00006 Number of locals:  1
00007 Stack size:        8
00008 Flags:             OPTIMIZED, NEWLOCALS, NESTED
00009 Constants:
00010    0: None
00011 Names:
00012    0: print
00013 Variable names:
00014    0: c
00015 Free variables:
00016    0: e
00017    1: d
00018    2: f
00019    3: y
00020    4: x
00021    5: z"""

Definition at line 280 of file test_dis.py.

Initial value:
00001 """\
00002 x = 0
00003 while 1:
00004     x += 1"""

Definition at line 119 of file test_dis.py.

Initial value:
00001 """\
00002  %-4d         0 LOAD_CONST               1 (0)
00003               3 JUMP_IF_TRUE            33 (to 39)
00004               6 POP_TOP
00005               7 LOAD_GLOBAL              0 (AssertionError)
00006              10 BUILD_LIST               0
00007              13 LOAD_FAST                0 (x)
00008              16 GET_ITER
00009         >>   17 FOR_ITER                12 (to 32)
00010              20 STORE_FAST               1 (s)
00011              23 LOAD_FAST                1 (s)
00012              26 LIST_APPEND              2
00013              29 JUMP_ABSOLUTE           17
00014 
00015  %-4d   >>   32 LOAD_CONST               2 (1)
00016              35 BINARY_ADD
00017              36 RAISE_VARARGS            2
00018         >>   39 POP_TOP
00019 
00020  %-4d        40 LOAD_CONST               0 (None)
00021              43 RETURN_VALUE
00022 """

Definition at line 56 of file test_dis.py.

Initial value:
00001 """\
00002  %-4d         0 SETUP_LOOP              23 (to 26)
00003               3 LOAD_GLOBAL              0 (range)
00004               6 LOAD_CONST               1 (1)
00005 
00006  %-4d         9 LOAD_CONST               2 (10)
00007              12 CALL_FUNCTION            2
00008              15 GET_ITER
00009         >>   16 FOR_ITER                 6 (to 25)
00010              19 STORE_FAST               0 (res)
00011 
00012  %-4d        22 JUMP_ABSOLUTE           16
00013         >>   25 POP_BLOCK
00014         >>   26 LOAD_CONST               0 (None)
00015              29 RETURN_VALUE
00016 """

Definition at line 31 of file test_dis.py.

Initial value:
00001 """\
00002   1           0 LOAD_CONST               0 (0)
00003               3 STORE_NAME               0 (x)
00004 
00005   2           6 SETUP_LOOP              13 (to 22)
00006 
00007   3     >>    9 LOAD_NAME                0 (x)
00008              12 LOAD_CONST               1 (1)
00009              15 INPLACE_ADD
00010              16 STORE_NAME               0 (x)
00011              19 JUMP_ABSOLUTE            9
00012         >>   22 LOAD_CONST               2 (None)
00013              25 RETURN_VALUE
00014 """

Definition at line 125 of file test_dis.py.

Initial value:
00001 """\
00002   1           0 LOAD_NAME                0 (x)
00003               3 LOAD_CONST               0 (1)
00004               6 BINARY_ADD
00005               7 RETURN_VALUE
00006 """

Definition at line 101 of file test_dis.py.

Initial value:
00001 """\
00002  %-4d         0 LOAD_GLOBAL              0 (print)
00003               3 LOAD_FAST                0 (a)
00004               6 CALL_FUNCTION            1
00005               9 POP_TOP
00006 
00007  %-4d        10 LOAD_CONST               1 (1)
00008              13 RETURN_VALUE
00009 """

Definition at line 14 of file test_dis.py.

Initial value:
00001 """\
00002 Disassembly of f:
00003   4           0 LOAD_CONST               0 (None)
00004               3 RETURN_VALUE
00005 
00006 Disassembly of g:
00007   5           0 LOAD_CONST               0 (None)
00008               3 RETURN_VALUE
00009 
00010 """

Definition at line 88 of file test_dis.py.

Initial value:
00001 """\
00002   1           0 LOAD_NAME                0 (x)
00003               3 LOAD_CONST               0 (1)
00004               6 BINARY_ADD
00005               7 STORE_NAME               0 (x)
00006              10 LOAD_CONST               1 (None)
00007              13 RETURN_VALUE
00008 """

Definition at line 110 of file test_dis.py.

Definition at line 99 of file test_dis.py.

Definition at line 108 of file test_dis.py.