mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
Define sys.prefix and sys.exec_prefix (see Modules/getpath.c; from Makefile).
This commit is contained in:
parent
529c963d36
commit
8fa9b6f932
@ -235,6 +235,8 @@ initsys()
|
||||
extern char *getversion PROTO((void));
|
||||
extern char *getcopyright PROTO((void));
|
||||
extern char *getplatform PROTO((void));
|
||||
extern char *Py_GetPrefix PROTO((void));
|
||||
extern char *Py_GetExecPrefix PROTO((void));
|
||||
extern int fclose PROTO((FILE *));
|
||||
object *m = initmodule("sys", sys_methods);
|
||||
object *v;
|
||||
@ -256,6 +258,11 @@ initsys()
|
||||
XDECREF(v);
|
||||
dictinsert(sysdict, "platform", v = newstringobject(getplatform()));
|
||||
XDECREF(v);
|
||||
dictinsert(sysdict, "prefix", v = newstringobject(Py_GetPrefix()));
|
||||
XDECREF(v);
|
||||
dictinsert(sysdict, "exec_prefix",
|
||||
v = newstringobject(Py_GetExecPrefix()));
|
||||
XDECREF(v);
|
||||
dictinsert(sysdict, "maxint", v = newintobject(getmaxint()));
|
||||
XDECREF(v);
|
||||
dictinsert(sysdict, "modules", get_modules());
|
||||
|
Loading…
Reference in New Issue
Block a user