[Python-checkins] python/dist/src/Objects frameobject.c,2.63,2.64

mwh@users.sourceforge.net mwh@users.sourceforge.net
2002年8月15日 07:59:04 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv10908/Objects
Modified Files:
	frameobject.c 
Log Message:
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.
Index: frameobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v
retrieving revision 2.63
retrieving revision 2.64
diff -C2 -d -r2.63 -r2.64
*** frameobject.c	1 Aug 2002 18:50:33 -0000	2.63
--- frameobject.c	15 Aug 2002 14:59:02 -0000	2.64
***************
*** 17,21 ****
 	{"f_globals",	T_OBJECT,	OFF(f_globals),	RO},
 	{"f_lasti",	T_INT,		OFF(f_lasti),	RO},
- 	{"f_lineno",	T_INT,		OFF(f_lineno),	RO},
 	{"f_restricted",T_INT,		OFF(f_restricted),RO},
 	{"f_trace",	T_OBJECT,	OFF(f_trace)},
--- 17,20 ----
***************
*** 34,39 ****
--- 33,49 ----
 }
 
+ static PyObject *
+ frame_getlineno(PyFrameObject *f, void *closure)
+ {
+ 	int lineno;
+ 
+ 	lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
+ 
+ 	return PyInt_FromLong(lineno);
+ }
+ 
 static PyGetSetDef frame_getsetlist[] = {
 	{"f_locals",	(getter)frame_getlocals, NULL, NULL},
+ 	{"f_lineno",	(getter)frame_getlineno, NULL, NULL},
 	{0}
 };
***************
*** 307,311 ****
 	f->f_tstate = tstate;
 
! 	f->f_lasti = 0;
 	f->f_lineno = code->co_firstlineno;
 	f->f_restricted = (builtins != tstate->interp->builtins);
--- 317,321 ----
 	f->f_tstate = tstate;
 
! 	f->f_lasti = -1;
 	f->f_lineno = code->co_firstlineno;
 	f->f_restricted = (builtins != tstate->interp->builtins);

AltStyle によって変換されたページ (->オリジナル) /