[Tutor] ReadableInt
eryk sun
eryksun at gmail.com
Fri Dec 30 12:31:52 EST 2016
On Fri, Dec 30, 2016 at 4:46 PM, Albert-Jan Roskam
<sjeik_appie at hotmail.com> wrote:
>
> Remember I only intend to use it while debugging the given script.
Have you tried hooking sys.displayhook?
> Why does the call to str() below return '1' and not 'one'? Should I implement __new__
> because int is immutable?
You can't reliably replace a built-int type with a late binding. The
concrete C API (in this case PyLong_FromLong) is called directly by
the compiler:
>>> str(1)
Breakpoint 0 hit
python35_d!PyAST_FromNodeObject:
00000000`5ea92ad0 4c894c2420 mov qword ptr [rsp+20h],r9
ss:00000021`b39ef2d8=
{python35_d!_PyParser_Grammar
(00000000`5ed84ad8)}
0:000> bp python35_d!PyLong_FromLong
0:000> g
Breakpoint 1 hit
python35_d!PyLong_FromLong:
00000000`5e95fee0 894c2408 mov dword ptr [rsp+8],ecx
ss:00000021`b39ee9e0=c19956a8
0:000> kc 0n15
Call Site
python35_d!PyLong_FromLong
python35_d!parsenumber
python35_d!ast_for_atom
python35_d!ast_for_atom_expr
python35_d!ast_for_power
python35_d!ast_for_expr
python35_d!ast_for_call
python35_d!ast_for_trailer
python35_d!ast_for_atom_expr
python35_d!ast_for_power
python35_d!ast_for_expr
python35_d!ast_for_testlist
python35_d!ast_for_expr_stmt
python35_d!ast_for_stmt
python35_d!PyAST_FromNodeObject
0:000> r rcx
rcx=0000000000000001
0:000> bd 0-1; g
'1'
More information about the Tutor
mailing list