[Python-checkins] python/dist/src/Modules parsermodule.c,2.73,2.74

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
2002年12月31日 10:17:46 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv3342/Modules
Modified Files:
	parsermodule.c 
Log Message:
SF patch [ 597919 ] compiler package and SET_LINENO
A variety of changes from Michael Hudson to get the compiler working
with 2.3. The primary change is the handling of SET_LINENO:
# The set_lineno() function and the explicit emit() calls for
# SET_LINENO below are only used to generate the line number table.
# As of Python 2.3, the interpreter does not have a SET_LINENO
# instruction. pyassem treats SET_LINENO opcodes as a special case.
A few other small changes:
 - Remove unused code from pycodegen and pyassem.
 - Fix error handling in parsermodule. When PyParser_SimplerParseString()
 fails, it sets an exception with detailed info. The parsermodule
 was clobbering that exception and replacing it was a generic
 "could not parse string" exception. Keep the original exception.
Index: parsermodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v
retrieving revision 2.73
retrieving revision 2.74
diff -C2 -d -r2.73 -r2.74
*** parsermodule.c	13 Aug 2002 22:20:40 -0000	2.73
--- parsermodule.c	31 Dec 2002 18:17:43 -0000	2.74
***************
*** 90,94 ****
 PyObject *w;
 
! v = mkseq(1 + NCH(n));
 if (v == NULL)
 return (v);
--- 90,94 ----
 PyObject *w;
 
! v = mkseq(1 + NCH(n) + (TYPE(n) == encoding_decl));
 if (v == NULL)
 return (v);
***************
*** 107,110 ****
--- 107,113 ----
 (void) addelem(v, i+1, w);
 }
+ 	
+ if (TYPE(n) == encoding_decl)
+ (void) addelem(v, i+1, PyString_FromString(STR(n)));
 return (v);
 }
***************
*** 479,483 ****
 *
 * Internal function to actually execute the parse and return the result if
! * successful, or set an exception if not.
 *
 */
--- 482,486 ----
 *
 * Internal function to actually execute the parse and return the result if
! * successful or set an exception if not.
 *
 */
***************
*** 495,502 ****
 ? eval_input : file_input);
 
! if (n != 0)
! res = parser_newstobject(n, type);
! else
! err_string("could not parse string");
 }
 return (res);
--- 498,503 ----
 ? eval_input : file_input);
 
! 	if (n)
! 	 res = parser_newstobject(n, type);
 }
 return (res);

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