From 7177657bf2dae89cff8c7d4b2b636ee4287ad6f5 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 10 Dec 1991 14:00:21 +0000 Subject: [PATCH] Added sys.version object. --- Python/sysmodule.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 69489c84f67..ef93d2095f9 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, "", "w", fclose); syserr = newopenfileobject(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 *