comparison Python/sysmodule.c @ 710:bc5c77fa8006 legacy-trunk

Added settrace() and setprofile().
author Guido van Rossum <guido@python.org>
date Mon, 23 Mar 1992 18:20:18 +0000
parents f5a2bc39e10e
children ba4ec13c0f9f
comparison
equal deleted inserted replaced
709:7236e02c4563 710:bc5c77fa8006
40 #include "allobjects.h" 40 #include "allobjects.h"
41 41
42 #include "sysmodule.h" 42 #include "sysmodule.h"
43 #include "import.h" 43 #include "import.h"
44 #include "modsupport.h" 44 #include "modsupport.h"
45 45 #include "osdefs.h"
46 /* Define delimiter used in $PYTHONPATH */ 46
47 47 object *sys_trace, *sys_profile;
48 #ifdef macintosh
49 #define DELIM ' '
50 #endif
51
52 #ifdef MSDOS
53 #define DELIM ';'
54 #endif
55
56 #ifndef DELIM
57 #define DELIM ':'
58 #endif
59 48
60 static object *sysdict; 49 static object *sysdict;
61 50
62 object * 51 object *
63 sysget(name) 52 sysget(name)
103 /* Raise SystemExit so callers may catch it or clean up. */ 92 /* Raise SystemExit so callers may catch it or clean up. */
104 err_setval(SystemExit, args); 93 err_setval(SystemExit, args);
105 return NULL; 94 return NULL;
106 } 95 }
107 96
97 static object *
98 sys_settrace(self, args)
99 object *self;
100 object *args;
101 {
102 if (args == None)
103 args = NULL;
104 XINCREF(args);
105 sys_trace = args;
106 INCREF(None);
107 return None;
108 }
109
110 static object *
111 sys_setprofile(self, args)
112 object *self;
113 object *args;
114 {
115 if (args == None)
116 args = NULL;
117 XINCREF(args);
118 sys_profile = args;
119 INCREF(None);
120 return None;
121 }
122
108 static struct methodlist sys_methods[] = { 123 static struct methodlist sys_methods[] = {
109 {"exit", sys_exit}, 124 {"exit", sys_exit},
125 {"setprofile", sys_setprofile},
126 {"settrace", sys_settrace},
110 {NULL, NULL} /* sentinel */ 127 {NULL, NULL} /* sentinel */
111 }; 128 };
112 129
113 static object *sysin, *sysout, *syserr; 130 static object *sysin, *sysout, *syserr;
114 131