summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-12-10 14:00:21 (GMT)
committerGuido van Rossum <guido@python.org>1991-12-10 14:00:21 (GMT)
commit7177657bf2dae89cff8c7d4b2b636ee4287ad6f5 (patch)
treef1afd6e771b08dc04844f78d97a558bb0d550bd2 /Python/sysmodule.c
parent87e7ea72a6ef9232be9db06038943044c747971b (diff)
downloadcpython-7177657bf2dae89cff8c7d4b2b636ee4287ad6f5.zip
cpython-7177657bf2dae89cff8c7d4b2b636ee4287ad6f5.tar.gz
cpython-7177657bf2dae89cff8c7d4b2b636ee4287ad6f5.tar.bz2
Added sys.version object.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 69489c8..ef93d20 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -115,6 +115,8 @@ void
initsys()
{
extern int fclose PROTO((FILE *));
+ extern char version[];
+ object *v = newstringobject(version);
object *m = initmodule("sys", sys_methods);
sysdict = getmoduledict(m);
INCREF(sysdict);
@@ -124,13 +126,15 @@ initsys()
sysout = newopenfileobject(stdout, "<stdout>", "w", fclose);
syserr = newopenfileobject(stderr, "<stderr>", "w", fclose);
if (err_occurred())
- fatal("can't create sys.std* file objects");
+ fatal("can't create sys.* objects");
dictinsert(sysdict, "stdin", sysin);
dictinsert(sysdict, "stdout", sysout);
dictinsert(sysdict, "stderr", syserr);
+ dictinsert(sysdict, "version", v);
dictinsert(sysdict, "modules", get_modules());
if (err_occurred())
fatal("can't insert sys.* objects in sys dict");
+ DECREF(v);
}
static object *