mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Initialize __version__ to the correct version string regardless of
what RCS checkout options are used. Problem first diagnosed by Marc Lemburg.
This commit is contained in:
parent
06ba34c5d4
commit
f6e8316b01
1 changed files with 14 additions and 3 deletions
|
@ -3881,10 +3881,21 @@ init_stuff(PyObject *module, PyObject *module_dict) {
|
||||||
void
|
void
|
||||||
initcPickle() {
|
initcPickle() {
|
||||||
PyObject *m, *d, *v;
|
PyObject *m, *d, *v;
|
||||||
char *rev="$Revision$";
|
static char revbuf[] = "$Revision$";
|
||||||
|
char *rev = revbuf;
|
||||||
PyObject *format_version;
|
PyObject *format_version;
|
||||||
PyObject *compatible_formats;
|
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 */
|
/* Create the module and add the functions */
|
||||||
m = Py_InitModule4("cPickle", cPickle_methods,
|
m = Py_InitModule4("cPickle", cPickle_methods,
|
||||||
|
@ -3896,8 +3907,8 @@ initcPickle() {
|
||||||
|
|
||||||
/* Add some symbolic constants to the module */
|
/* Add some symbolic constants to the module */
|
||||||
d = PyModule_GetDict(m);
|
d = PyModule_GetDict(m);
|
||||||
PyDict_SetItemString(d,"__version__",
|
v = PyString_FromString(rev);
|
||||||
v = PyString_FromStringAndSize(rev+11,strlen(rev+11)-2));
|
PyDict_SetItemString(d,"__version__", v);
|
||||||
Py_XDECREF(v);
|
Py_XDECREF(v);
|
||||||
|
|
||||||
#ifdef FORMAT_1_3
|
#ifdef FORMAT_1_3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue