summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-01 15:57:40 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-01 15:57:40 (GMT)
commitf6e8316b019c9e12fea293ac56efaed0a9e0498b (patch)
tree99e65825fdfe6de702ce3db00f9fbcf9d286a97b /Modules
parent06ba34c5d47751f9a5ae8e16bf1a7cf12c871609 (diff)
downloadcpython-f6e8316b019c9e12fea293ac56efaed0a9e0498b.zip
cpython-f6e8316b019c9e12fea293ac56efaed0a9e0498b.tar.gz
cpython-f6e8316b019c9e12fea293ac56efaed0a9e0498b.tar.bz2
Initialize __version__ to the correct version string regardless of
what RCS checkout options are used. Problem first diagnosed by Marc Lemburg.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cPickle.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 6021a03..1f8ed9d 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -3881,10 +3881,21 @@ init_stuff(PyObject *module, PyObject *module_dict) {
void
initcPickle() {
PyObject *m, *d, *v;
- char *rev="$Revision$";
+ static char revbuf[] = "$Revision$";
+ char *rev = revbuf;
PyObject *format_version;
PyObject *compatible_formats;
+ /* Fix up the revision number */
+ if (rev[0] == '$') {
+ char *p = strchr(rev, ' ');
+ if (p) {
+ rev = p+1;
+ p = strrchr(rev, ' ');
+ if (p)
+ *p = '\0';
+ }
+ }
/* Create the module and add the functions */
m = Py_InitModule4("cPickle", cPickle_methods,
@@ -3896,8 +3907,8 @@ initcPickle() {
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
- PyDict_SetItemString(d,"__version__",
- v = PyString_FromStringAndSize(rev+11,strlen(rev+11)-2));
+ v = PyString_FromString(rev);
+ PyDict_SetItemString(d,"__version__", v);
Py_XDECREF(v);
#ifdef FORMAT_1_3