mirror of
https://github.com/python/cpython.git
synced 2025-09-25 17:59:57 +00:00

f_fastlocals in a traceback object (this is a core dump hazard if there are <nil> entries), but instead eval_code() merges the fast locals back into the locals dictionary if it looks like the local variables will be retained. Also, the merge routines save exceptions since this is sometimes needed (alas!). * Added id() to bltinmodule.c, which returns an object's address (identity). Useful to walk arbitrary data structures containing cycles. * Added compile() to bltinmodule.c and compile_string() to pythonrun.[ch]: support to exec/eval arbitrary code objects. The code that defaults globals and locals is moved from run_node in pythonrun.c (which is now identical to eval_node) to eval_code in ceval.c. [XXX For elegance a clean-up session is necessary.]
49 lines
2 KiB
C
49 lines
2 KiB
C
/***********************************************************
|
|
Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
|
|
Amsterdam, The Netherlands.
|
|
|
|
All Rights Reserved
|
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
documentation for any purpose and without fee is hereby granted,
|
|
provided that the above copyright notice appear in all copies and that
|
|
both that copyright notice and this permission notice appear in
|
|
supporting documentation, and that the names of Stichting Mathematisch
|
|
Centrum or CWI not be used in advertising or publicity pertaining to
|
|
distribution of the software without specific, written prior permission.
|
|
|
|
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
|
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
|
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
|
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
******************************************************************/
|
|
|
|
/* Interfaces to parse and execute pieces of python code */
|
|
|
|
void initall PROTO((void));
|
|
|
|
int run PROTO((FILE *, char *));
|
|
|
|
int run_script PROTO((FILE *, char *));
|
|
int run_tty_1 PROTO((FILE *, char *));
|
|
int run_tty_loop PROTO((FILE *, char *));
|
|
|
|
int parse_string PROTO((char *, int, struct _node **));
|
|
int parse_file PROTO((FILE *, char *, int, struct _node **));
|
|
|
|
object *eval_node PROTO((struct _node *, char *, object *, object *));
|
|
|
|
object *run_string PROTO((char *, int, object *, object *));
|
|
object *run_file PROTO((FILE *, char *, int, object *, object *));
|
|
object *run_err_node PROTO((int, struct _node *, char *, object *, object *));
|
|
object *run_node PROTO((struct _node *, char *, object *, object *));
|
|
|
|
object *compile_string PROTO((char *, char *, int));
|
|
|
|
void print_error PROTO((void));
|
|
|
|
void goaway PROTO((int));
|