Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 5372:424922afc1bb legacy-trunk
Quickly renamed.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 29 Apr 1997 18:33:38 +0000 |
| parents | db673e98f28d |
| children | 09597a423227 |
comparison
equal
deleted
inserted
replaced
| 5371:493a34dca53e | 5372:424922afc1bb |
|---|---|
| 42 - path: module search path (list of strings) | 42 - path: module search path (list of strings) |
| 43 - argv: script arguments (list of strings) | 43 - argv: script arguments (list of strings) |
| 44 - ps1, ps2: optional primary and secondary prompts (strings) | 44 - ps1, ps2: optional primary and secondary prompts (strings) |
| 45 */ | 45 */ |
| 46 | 46 |
| 47 #include "allobjects.h" | 47 #include "Python.h" |
| 48 | 48 |
| 49 #include "sysmodule.h" | |
| 50 #include "import.h" | |
| 51 #include "modsupport.h" | |
| 52 #include "osdefs.h" | 49 #include "osdefs.h" |
| 53 | 50 |
| 54 object *sys_trace, *sys_profile; | 51 PyObject *_PySys_TraceFunc, *_PySys_ProfileFunc; |
| 55 int sys_checkinterval = 10; | 52 int _PySys_CheckInterval = 10; |
| 56 | 53 |
| 57 #if HAVE_UNISTD_H | 54 #if HAVE_UNISTD_H |
| 58 #include <unistd.h> | 55 #include <unistd.h> |
| 59 #endif | 56 #endif |
| 60 | 57 |
| 61 static object *sysdict; | 58 static PyObject *sysdict; |
| 62 | 59 |
| 63 #ifdef MS_COREDLL | 60 #ifdef MS_COREDLL |
| 64 extern void *PyWin_DLLhModule; | 61 extern void *PyWin_DLLhModule; |
| 65 #endif | 62 #endif |
| 66 | 63 |
| 67 object * | 64 PyObject * |
| 68 sysget(name) | 65 PySys_GetObject(name) |
| 69 char *name; | 66 char *name; |
| 70 { | 67 { |
| 71 return dictlookup(sysdict, name); | 68 return PyDict_GetItemString(sysdict, name); |
| 72 } | 69 } |
| 73 | 70 |
| 74 FILE * | 71 FILE * |
| 75 sysgetfile(name, def) | 72 PySys_GetFile(name, def) |
| 76 char *name; | 73 char *name; |
| 77 FILE *def; | 74 FILE *def; |
| 78 { | 75 { |
| 79 FILE *fp = NULL; | 76 FILE *fp = NULL; |
| 80 object *v = sysget(name); | 77 PyObject *v = PySys_GetObject(name); |
| 81 if (v != NULL && is_fileobject(v)) | 78 if (v != NULL && PyFile_Check(v)) |
| 82 fp = getfilefile(v); | 79 fp = PyFile_AsFile(v); |
| 83 if (fp == NULL) | 80 if (fp == NULL) |
| 84 fp = def; | 81 fp = def; |
| 85 return fp; | 82 return fp; |
| 86 } | 83 } |
| 87 | 84 |
| 88 int | 85 int |
| 89 sysset(name, v) | 86 PySys_SetObject(name, v) |
| 90 char *name; | 87 char *name; |
| 91 object *v; | 88 PyObject *v; |
| 92 { | 89 { |
| 93 if (v == NULL) { | 90 if (v == NULL) { |
| 94 if (dictlookup(sysdict, name) == NULL) | 91 if (PyDict_GetItemString(sysdict, name) == NULL) |
| 95 return 0; | 92 return 0; |
| 96 else | 93 else |
| 97 return dictremove(sysdict, name); | 94 return PyDict_DelItemString(sysdict, name); |
| 98 } | 95 } |
| 99 else | 96 else |
| 100 return dictinsert(sysdict, name, v); | 97 return PyDict_SetItemString(sysdict, name, v); |
| 101 } | 98 } |
| 102 | 99 |
| 103 static object * | 100 static PyObject * |
| 104 sys_exit(self, args) | 101 sys_exit(self, args) |
| 105 object *self; | 102 PyObject *self; |
| 106 object *args; | 103 PyObject *args; |
| 107 { | 104 { |
| 108 /* Raise SystemExit so callers may catch it or clean up. */ | 105 /* Raise SystemExit so callers may catch it or clean up. */ |
| 109 err_setval(SystemExit, args); | 106 PyErr_SetObject(PyExc_SystemExit, args); |
| 110 return NULL; | 107 return NULL; |
| 111 } | 108 } |
| 112 | 109 |
| 113 static object * | 110 static PyObject * |
| 114 sys_settrace(self, args) | 111 sys_settrace(self, args) |
| 115 object *self; | 112 PyObject *self; |
| 116 object *args; | 113 PyObject *args; |
| 117 { | 114 { |
| 118 if (args == None) | 115 if (args == Py_None) |
| 119 args = NULL; | 116 args = NULL; |
| 120 else | 117 else |
| 121 XINCREF(args); | 118 Py_XINCREF(args); |
| 122 XDECREF(sys_trace); | 119 Py_XDECREF(_PySys_TraceFunc); |
| 123 sys_trace = args; | 120 _PySys_TraceFunc = args; |
| 124 INCREF(None); | 121 Py_INCREF(Py_None); |
| 125 return None; | 122 return Py_None; |
| 126 } | 123 } |
| 127 | 124 |
| 128 static object * | 125 static PyObject * |
| 129 sys_setprofile(self, args) | 126 sys_setprofile(self, args) |
| 130 object *self; | 127 PyObject *self; |
| 131 object *args; | 128 PyObject *args; |
| 132 { | 129 { |
| 133 if (args == None) | 130 if (args == Py_None) |
| 134 args = NULL; | 131 args = NULL; |
| 135 else | 132 else |
| 136 XINCREF(args); | 133 Py_XINCREF(args); |
| 137 XDECREF(sys_profile); | 134 Py_XDECREF(_PySys_ProfileFunc); |
| 138 sys_profile = args; | 135 _PySys_ProfileFunc = args; |
| 139 INCREF(None); | 136 Py_INCREF(Py_None); |
| 140 return None; | 137 return Py_None; |
| 141 } | 138 } |
| 142 | 139 |
| 143 static object * | 140 static PyObject * |
| 144 sys_setcheckinterval(self, args) | 141 sys_setcheckinterval(self, args) |
| 145 object *self; | 142 PyObject *self; |
| 146 object *args; | 143 PyObject *args; |
| 147 { | 144 { |
| 148 if (!newgetargs(args, "i", &sys_checkinterval)) | 145 if (!PyArg_ParseTuple(args, "i", &_PySys_CheckInterval)) |
| 149 return NULL; | 146 return NULL; |
| 150 INCREF(None); | 147 Py_INCREF(Py_None); |
| 151 return None; | 148 return Py_None; |
| 152 } | 149 } |
| 153 | 150 |
| 154 #ifdef USE_MALLOPT | 151 #ifdef USE_MALLOPT |
| 155 /* Link with -lmalloc (or -lmpc) on an SGI */ | 152 /* Link with -lmalloc (or -lmpc) on an SGI */ |
| 156 #include <malloc.h> | 153 #include <malloc.h> |
| 157 | 154 |
| 158 static object * | 155 static PyObject * |
| 159 sys_mdebug(self, args) | 156 sys_mdebug(self, args) |
| 160 object *self; | 157 PyObject *self; |
| 161 object *args; | 158 PyObject *args; |
| 162 { | 159 { |
| 163 int flag; | 160 int flag; |
| 164 if (!getargs(args, "i", &flag)) | 161 if (!PyArg_Parse(args, "i", &flag)) |
| 165 return NULL; | 162 return NULL; |
| 166 mallopt(M_DEBUG, flag); | 163 mallopt(M_DEBUG, flag); |
| 167 INCREF(None); | 164 Py_INCREF(Py_None); |
| 168 return None; | 165 return Py_None; |
| 169 } | 166 } |
| 170 #endif /* USE_MALLOPT */ | 167 #endif /* USE_MALLOPT */ |
| 171 | 168 |
| 172 static object * | 169 static PyObject * |
| 173 sys_getrefcount(self, args) | 170 sys_getrefcount(self, args) |
| 174 object *self; | 171 PyObject *self; |
| 175 object *args; | 172 PyObject *args; |
| 176 { | 173 { |
| 177 object *arg; | 174 PyObject *arg; |
| 178 if (!getargs(args, "O", &arg)) | 175 if (!PyArg_Parse(args, "O", &arg)) |
| 179 return NULL; | 176 return NULL; |
| 180 return newintobject((long) arg->ob_refcnt); | 177 return PyInt_FromLong((long) arg->ob_refcnt); |
| 181 } | 178 } |
| 182 | 179 |
| 183 #ifdef COUNT_ALLOCS | 180 #ifdef COUNT_ALLOCS |
| 184 static PyObject * | 181 static PyObject * |
| 185 sys_getcounts(self, args) | 182 sys_getcounts(self, args) |
| 201 #ifdef DYNAMIC_EXECUTION_PROFILE | 198 #ifdef DYNAMIC_EXECUTION_PROFILE |
| 202 /* Defined in ceval.c because it uses static globals if that file */ | 199 /* Defined in ceval.c because it uses static globals if that file */ |
| 203 extern PyObject *_Py_GetDXProfile Py_PROTO((PyObject *, PyObject *)); | 200 extern PyObject *_Py_GetDXProfile Py_PROTO((PyObject *, PyObject *)); |
| 204 #endif | 201 #endif |
| 205 | 202 |
| 206 static struct methodlist sys_methods[] = { | 203 static PyMethodDef sys_methods[] = { |
| 207 /* Might as well keep this in alphabetic order */ | 204 /* Might as well keep this in alphabetic order */ |
| 208 {"exit", sys_exit, 0}, | 205 {"exit", sys_exit, 0}, |
| 209 #ifdef COUNT_ALLOCS | 206 #ifdef COUNT_ALLOCS |
| 210 {"getcounts", sys_getcounts, 0}, | 207 {"getcounts", sys_getcounts, 0}, |
| 211 #endif | 208 #endif |
| 223 {"setprofile", sys_setprofile, 0}, | 220 {"setprofile", sys_setprofile, 0}, |
| 224 {"settrace", sys_settrace, 0}, | 221 {"settrace", sys_settrace, 0}, |
| 225 {NULL, NULL} /* sentinel */ | 222 {NULL, NULL} /* sentinel */ |
| 226 }; | 223 }; |
| 227 | 224 |
| 228 static object *sysin, *sysout, *syserr; | 225 static PyObject *sysin, *sysout, *syserr; |
| 229 | 226 |
| 230 static object * | 227 static PyObject * |
| 231 list_builtin_module_names() | 228 list_builtin_module_names() |
| 232 { | 229 { |
| 233 object *list = newlistobject(0); | 230 PyObject *list = PyList_New(0); |
| 234 int i; | 231 int i; |
| 235 if (list == NULL) | 232 if (list == NULL) |
| 236 return NULL; | 233 return NULL; |
| 237 for (i = 0; inittab[i].name != NULL; i++) { | 234 for (i = 0; inittab[i].name != NULL; i++) { |
| 238 object *name = newstringobject(inittab[i].name); | 235 PyObject *name = PyString_FromString(inittab[i].name); |
| 239 if (name == NULL) | 236 if (name == NULL) |
| 240 break; | 237 break; |
| 241 addlistitem(list, name); | 238 PyList_Append(list, name); |
| 242 DECREF(name); | 239 Py_DECREF(name); |
| 243 } | 240 } |
| 244 if (sortlist(list) != 0) { | 241 if (PyList_Sort(list) != 0) { |
| 245 DECREF(list); | 242 Py_DECREF(list); |
| 246 list = NULL; | 243 list = NULL; |
| 247 } | 244 } |
| 248 if (list) { | 245 if (list) { |
| 249 object *v = listtuple(list); | 246 PyObject *v = PyList_AsTuple(list); |
| 250 DECREF(list); | 247 Py_DECREF(list); |
| 251 list = v; | 248 list = v; |
| 252 } | 249 } |
| 253 return list; | 250 return list; |
| 254 } | 251 } |
| 255 | 252 |
| 256 void | 253 void |
| 257 initsys() | 254 PySys_Init() |
| 258 { | 255 { |
| 259 extern long getmaxint PROTO((void)); | 256 extern long PyInt_GetMax Py_PROTO((void)); |
| 260 extern char *getversion PROTO((void)); | 257 extern char *Py_GetVersion Py_PROTO((void)); |
| 261 extern char *getcopyright PROTO((void)); | 258 extern char *Py_GetCopyright Py_PROTO((void)); |
| 262 extern char *getplatform PROTO((void)); | 259 extern char *Py_GetPlatform Py_PROTO((void)); |
| 263 extern char *Py_GetPrefix PROTO((void)); | 260 extern char *Py_GetPrefix Py_PROTO((void)); |
| 264 extern char *Py_GetExecPrefix PROTO((void)); | 261 extern char *Py_GetExecPrefix Py_PROTO((void)); |
| 265 extern int fclose PROTO((FILE *)); | 262 extern int fclose Py_PROTO((FILE *)); |
| 266 object *m = initmodule("sys", sys_methods); | 263 PyObject *m = Py_InitModule("sys", sys_methods); |
| 267 object *v; | 264 PyObject *v; |
| 268 sysdict = getmoduledict(m); | 265 sysdict = PyModule_GetDict(m); |
| 269 INCREF(sysdict); | 266 Py_INCREF(sysdict); |
| 270 /* NB keep an extra ref to the std files to avoid closing them | 267 /* NB keep an extra ref to the std files to avoid closing them |
| 271 when the user deletes them */ | 268 when the user deletes them */ |
| 272 sysin = newopenfileobject(stdin, "<stdin>", "r", fclose); | 269 sysin = PyFile_FromFile(stdin, "<stdin>", "r", fclose); |
| 273 sysout = newopenfileobject(stdout, "<stdout>", "w", fclose); | 270 sysout = PyFile_FromFile(stdout, "<stdout>", "w", fclose); |
| 274 syserr = newopenfileobject(stderr, "<stderr>", "w", fclose); | 271 syserr = PyFile_FromFile(stderr, "<stderr>", "w", fclose); |
| 275 if (err_occurred()) | 272 if (PyErr_Occurred()) |
| 276 fatal("can't initialize sys.std{in,out,err}"); | 273 Py_FatalError("can't initialize sys.std{in,out,err}"); |
| 277 dictinsert(sysdict, "stdin", sysin); | 274 PyDict_SetItemString(sysdict, "stdin", sysin); |
| 278 dictinsert(sysdict, "stdout", sysout); | 275 PyDict_SetItemString(sysdict, "stdout", sysout); |
| 279 dictinsert(sysdict, "stderr", syserr); | 276 PyDict_SetItemString(sysdict, "stderr", syserr); |
| 280 dictinsert(sysdict, "version", v = newstringobject(getversion())); | 277 PyDict_SetItemString(sysdict, "version", |
| 281 XDECREF(v); | 278 v = PyString_FromString(Py_GetVersion())); |
| 282 dictinsert(sysdict, "copyright", v = newstringobject(getcopyright())); | 279 Py_XDECREF(v); |
| 283 XDECREF(v); | 280 PyDict_SetItemString(sysdict, "copyright", |
| 284 dictinsert(sysdict, "platform", v = newstringobject(getplatform())); | 281 v = PyString_FromString(Py_GetCopyright())); |
| 285 XDECREF(v); | 282 Py_XDECREF(v); |
| 286 dictinsert(sysdict, "prefix", v = newstringobject(Py_GetPrefix())); | 283 PyDict_SetItemString(sysdict, "platform", |
| 287 XDECREF(v); | 284 v = PyString_FromString(Py_GetPlatform())); |
| 288 dictinsert(sysdict, "exec_prefix", | 285 Py_XDECREF(v); |
| 289 v = newstringobject(Py_GetExecPrefix())); | 286 PyDict_SetItemString(sysdict, "prefix", |
| 290 XDECREF(v); | 287 v = PyString_FromString(Py_GetPrefix())); |
| 291 dictinsert(sysdict, "maxint", v = newintobject(getmaxint())); | 288 Py_XDECREF(v); |
| 292 XDECREF(v); | 289 PyDict_SetItemString(sysdict, "exec_prefix", |
| 293 dictinsert(sysdict, "modules", get_modules()); | 290 v = PyString_FromString(Py_GetExecPrefix())); |
| 294 dictinsert(sysdict, "builtin_module_names", | 291 Py_XDECREF(v); |
| 292 PyDict_SetItemString(sysdict, "maxint", | |
| 293 v = PyInt_FromLong(PyInt_GetMax())); | |
| 294 Py_XDECREF(v); | |
| 295 PyDict_SetItemString(sysdict, "modules", PyImport_GetModuleDict()); | |
| 296 PyDict_SetItemString(sysdict, "builtin_module_names", | |
| 295 v = list_builtin_module_names()); | 297 v = list_builtin_module_names()); |
| 296 XDECREF(v); | 298 Py_XDECREF(v); |
| 297 #ifdef MS_COREDLL | 299 #ifdef MS_COREDLL |
| 298 dictinsert(sysdict, "dllhandle", v = newintobject((int)PyWin_DLLhModule)); | 300 PyDict_SetItemString(sysdict, "dllhandle", |
| 299 XDECREF(v); | 301 v = PyInt_FromLong((int)PyWin_DLLhModule)); |
| 300 dictinsert(sysdict, "winver", v = newstringobject(MS_DLL_ID)); | 302 Py_XDECREF(v); |
| 301 XDECREF(v); | 303 PyDict_SetItemString(sysdict, "winver", |
| 302 #endif | 304 v = PyString_FromString(MS_DLL_ID)); |
| 303 if (err_occurred()) | 305 Py_XDECREF(v); |
| 304 fatal("can't insert sys.* objects in sys dict"); | 306 #endif |
| 305 } | 307 if (PyErr_Occurred()) |
| 306 | 308 Py_FatalError("can't insert sys.* objects in sys dict"); |
| 307 static object * | 309 } |
| 310 | |
| 311 static PyObject * | |
| 308 makepathobject(path, delim) | 312 makepathobject(path, delim) |
| 309 char *path; | 313 char *path; |
| 310 int delim; | 314 int delim; |
| 311 { | 315 { |
| 312 int i, n; | 316 int i, n; |
| 313 char *p; | 317 char *p; |
| 314 object *v, *w; | 318 PyObject *v, *w; |
| 315 | 319 |
| 316 n = 1; | 320 n = 1; |
| 317 p = path; | 321 p = path; |
| 318 while ((p = strchr(p, delim)) != NULL) { | 322 while ((p = strchr(p, delim)) != NULL) { |
| 319 n++; | 323 n++; |
| 320 p++; | 324 p++; |
| 321 } | 325 } |
| 322 v = newlistobject(n); | 326 v = PyList_New(n); |
| 323 if (v == NULL) | 327 if (v == NULL) |
| 324 return NULL; | 328 return NULL; |
| 325 for (i = 0; ; i++) { | 329 for (i = 0; ; i++) { |
| 326 p = strchr(path, delim); | 330 p = strchr(path, delim); |
| 327 if (p == NULL) | 331 if (p == NULL) |
| 328 p = strchr(path, '\0'); /* End of string */ | 332 p = strchr(path, '\0'); /* End of string */ |
| 329 w = newsizedstringobject(path, (int) (p - path)); | 333 w = PyString_FromStringAndSize(path, (int) (p - path)); |
| 330 if (w == NULL) { | 334 if (w == NULL) { |
| 331 DECREF(v); | 335 Py_DECREF(v); |
| 332 return NULL; | 336 return NULL; |
| 333 } | 337 } |
| 334 setlistitem(v, i, w); | 338 PyList_SetItem(v, i, w); |
| 335 if (*p == '\0') | 339 if (*p == '\0') |
| 336 break; | 340 break; |
| 337 path = p+1; | 341 path = p+1; |
| 338 } | 342 } |
| 339 return v; | 343 return v; |
| 340 } | 344 } |
| 341 | 345 |
| 342 void | 346 void |
| 343 setpythonpath(path) | 347 PySys_SetPath(path) |
| 344 char *path; | 348 char *path; |
| 345 { | 349 { |
| 346 object *v; | 350 PyObject *v; |
| 347 if ((v = makepathobject(path, DELIM)) == NULL) | 351 if ((v = makepathobject(path, DELIM)) == NULL) |
| 348 fatal("can't create sys.path"); | 352 Py_FatalError("can't create sys.path"); |
| 349 if (sysset("path", v) != 0) | 353 if (PySys_SetObject("path", v) != 0) |
| 350 fatal("can't assign sys.path"); | 354 Py_FatalError("can't assign sys.path"); |
| 351 DECREF(v); | 355 Py_DECREF(v); |
| 352 } | 356 } |
| 353 | 357 |
| 354 static object * | 358 static PyObject * |
| 355 makeargvobject(argc, argv) | 359 makeargvobject(argc, argv) |
| 356 int argc; | 360 int argc; |
| 357 char **argv; | 361 char **argv; |
| 358 { | 362 { |
| 359 object *av; | 363 PyObject *av; |
| 360 if (argc <= 0 || argv == NULL) { | 364 if (argc <= 0 || argv == NULL) { |
| 361 /* Ensure at least one (empty) argument is seen */ | 365 /* Ensure at least one (empty) argument is seen */ |
| 362 static char *empty_argv[1] = {""}; | 366 static char *empty_argv[1] = {""}; |
| 363 argv = empty_argv; | 367 argv = empty_argv; |
| 364 argc = 1; | 368 argc = 1; |
| 365 } | 369 } |
| 366 av = newlistobject(argc); | 370 av = PyList_New(argc); |
| 367 if (av != NULL) { | 371 if (av != NULL) { |
| 368 int i; | 372 int i; |
| 369 for (i = 0; i < argc; i++) { | 373 for (i = 0; i < argc; i++) { |
| 370 object *v = newstringobject(argv[i]); | 374 PyObject *v = PyString_FromString(argv[i]); |
| 371 if (v == NULL) { | 375 if (v == NULL) { |
| 372 DECREF(av); | 376 Py_DECREF(av); |
| 373 av = NULL; | 377 av = NULL; |
| 374 break; | 378 break; |
| 375 } | 379 } |
| 376 setlistitem(av, i, v); | 380 PyList_SetItem(av, i, v); |
| 377 } | 381 } |
| 378 } | 382 } |
| 379 return av; | 383 return av; |
| 380 } | 384 } |
| 381 | 385 |
| 382 void | 386 void |
| 383 setpythonargv(argc, argv) | 387 PySys_SetArgv(argc, argv) |
| 384 int argc; | 388 int argc; |
| 385 char **argv; | 389 char **argv; |
| 386 { | 390 { |
| 387 object *av = makeargvobject(argc, argv); | 391 PyObject *av = makeargvobject(argc, argv); |
| 388 object *path = sysget("path"); | 392 PyObject *path = PySys_GetObject("path"); |
| 389 if (av == NULL) | 393 if (av == NULL) |
| 390 fatal("no mem for sys.argv"); | 394 Py_FatalError("no mem for sys.argv"); |
| 391 if (sysset("argv", av) != 0) | 395 if (PySys_SetObject("argv", av) != 0) |
| 392 fatal("can't assign sys.argv"); | 396 Py_FatalError("can't assign sys.argv"); |
| 393 if (path != NULL) { | 397 if (path != NULL) { |
| 394 char *argv0 = argv[0]; | 398 char *argv0 = argv[0]; |
| 395 char *p = NULL; | 399 char *p = NULL; |
| 396 int n = 0; | 400 int n = 0; |
| 397 object *a; | 401 PyObject *a; |
| 398 #ifdef HAVE_READLINK | 402 #ifdef HAVE_READLINK |
| 399 char link[MAXPATHLEN+1]; | 403 char link[MAXPATHLEN+1]; |
| 400 char argv0copy[2*MAXPATHLEN+1]; | 404 char argv0copy[2*MAXPATHLEN+1]; |
| 401 int nr = 0; | 405 int nr = 0; |
| 402 if (argc > 0 && argv0 != NULL) | 406 if (argc > 0 && argv0 != NULL) |
| 446 if (n > 1) | 450 if (n > 1) |
| 447 n--; /* Drop trailing separator */ | 451 n--; /* Drop trailing separator */ |
| 448 #endif /* Unix */ | 452 #endif /* Unix */ |
| 449 } | 453 } |
| 450 #endif /* All others */ | 454 #endif /* All others */ |
| 451 a = newsizedstringobject(argv0, n); | 455 a = PyString_FromStringAndSize(argv0, n); |
| 452 if (a == NULL) | 456 if (a == NULL) |
| 453 fatal("no mem for sys.path insertion"); | 457 Py_FatalError("no mem for sys.path insertion"); |
| 454 if (inslistitem(path, 0, a) < 0) | 458 if (PyList_Insert(path, 0, a) < 0) |
| 455 fatal("sys.path.insert(0) failed"); | 459 Py_FatalError("sys.path.insert(0) failed"); |
| 456 DECREF(a); | 460 Py_DECREF(a); |
| 457 } | 461 } |
| 458 DECREF(av); | 462 Py_DECREF(av); |
| 459 } | 463 } |
