summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2005-12-18 01:27:35 (GMT)
committerBarry Warsaw <barry@python.org>2005-12-18 01:27:35 (GMT)
commit2a38a86c1c48adbf9cf76d485c515002f042fd56 (patch)
tree728b60b9fdc895f23a1a18dca41d49ce38a5ce62 /Python
parent11ca77e6deb795a697ce00849c2f081e9bdbabb7 (diff)
downloadcpython-2a38a86c1c48adbf9cf76d485c515002f042fd56.zip
cpython-2a38a86c1c48adbf9cf76d485c515002f042fd56.tar.gz
cpython-2a38a86c1c48adbf9cf76d485c515002f042fd56.tar.bz2
Expose Subversion revision number (calculated via "svnversion .") to Python.
Add C API function Py_GetBuildNumber(), add it to the interactive prompt banner (i.e. Py_GetBuildInfo()), and add it as the sys.build_number attribute. The build number is a string instead of an int because it may contain a trailing 'M' if there are local modifications.
Diffstat (limited to 'Python')
-rw-r--r--Python/sysmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index d9f1337..f97a56d 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1003,6 +1003,9 @@ _PySys_Init(void)
PyDict_SetItemString(sysdict, "hexversion",
v = PyInt_FromLong(PY_VERSION_HEX));
Py_XDECREF(v);
+ PyDict_SetItemString(sysdict, "build_number",
+ v = PyString_FromString(Py_GetBuildNumber()));
+ Py_XDECREF(v);
/*
* These release level checks are mutually exclusive and cover
* the field, so don't get too fancy with the pre-processor!