Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.

Under Windows, add MS_DLL_ID and MS_DLL_VERSION_ID for Mark H.

Independent change: if Py_TRACE_REFS is defined, rename Py_InitModule4
so so linking with incompatible modules will create a link time error.

[Backing out of previous changes (also for modsupport.c) to test
the latter at runtime.]
This commit is contained in:
Guido van Rossum 1996-08-22 22:55:47 +00:00
parent 67d4ab0946
commit 2ea0b06498
1 changed files with 22 additions and 0 deletions

View File

@ -53,6 +53,7 @@ extern int PyArg_VaParse Py_PROTO((PyObject *, char *, va_list));
extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list));
#define PYTHON_API_VERSION 1005
#define PYTHON_API_STRING "1005"
/* The API version is maintained (independently from the Python version)
so we can detect mismatches between the interpreter and dynamically
loaded modules. These are diagnosticised by an error message but
@ -60,6 +61,9 @@ extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list));
after loading the module). The error message is intended to
explain the core dump a few seconds later.
The symbol PYTHON_API_STRING defines the same value as a string
literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
Please add a line or two to the top of this log for each API
version change:
@ -74,6 +78,24 @@ extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list));
9-Jan-1995 GvR Initial version (incompatible with older API)
*/
#ifdef MS_WINDOWS
/* Special defines for Windows versions. MS_DLL_ID is the key
used in the registry.
The full MS_DLL_VERSION_ID is imbedded in the core DLL, and
is so installers can determine incremental changes.
*/
#define MS_DLL_ID "1.4.0"
#define MS_DLL_VERSION_ID MS_DLL_ID "." PYTHON_API_STRING
#endif /* MS_WINDOWS */
#ifdef Py_TRACE_REFS
/* When we are tracing reference counts, rename Py_InitModule4 so
modules compiled with incompatible settings will generate a
link-time error. */
#define Py_InitModule4 Py_InitModule4TraceRefs
#endif
extern PyObject *Py_InitModule4 Py_PROTO((char *, PyMethodDef *,
char *, PyObject *, int));
#define Py_InitModule(name, methods) \