[Python-checkins] r86994 - in python/branches/pep-0384: Include/modsupport.h Objects/moduleobject.c Python/dynload_shlib.c

martin.v.loewis python-checkins at python.org
Fri Dec 3 20:53:40 CET 2010


Author: martin.v.loewis
Date: Fri Dec  3 20:53:40 2010
New Revision: 86994

Log:
Incorporate suggestions from PEP 3149:
- define PYTHON_ABI_VERSION
- recognize abi3 as a tag.


Modified:
   python/branches/pep-0384/Include/modsupport.h
   python/branches/pep-0384/Objects/moduleobject.c
   python/branches/pep-0384/Python/dynload_shlib.c

Modified: python/branches/pep-0384/Include/modsupport.h
==============================================================================
--- python/branches/pep-0384/Include/modsupport.h	(original)
+++ python/branches/pep-0384/Include/modsupport.h	Fri Dec  3 20:53:40 2010
@@ -94,6 +94,12 @@
    9-Jan-1995	GvR	Initial version (incompatible with older API)
 */
 
+/* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of
+   Python 3, it will stay at the value of 3; changes to the limited API
+   must be performed in a strictly backwards-compatible manner. */
+#define PYTHON_ABI_VERSION 3
+#define PYTHON_ABI_STRING "3"
+
 #ifdef Py_TRACE_REFS
  /* When we are tracing reference counts, rename PyModule_Create2 so
     modules compiled with incompatible settings will generate a
@@ -104,8 +110,13 @@
 PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*,
                                      int apiver);
 
+#ifdef Py_LIMITED_API
+#define PyModule_Create(module) \
+	PyModule_Create2(module, PYTHON_ABI_VERSION)
+#else
 #define PyModule_Create(module) \
 	PyModule_Create2(module, PYTHON_API_VERSION)
+#endif
 
 #ifndef Py_LIMITED_API
 PyAPI_DATA(char *) _Py_PackageContext;

Modified: python/branches/pep-0384/Objects/moduleobject.c
==============================================================================
--- python/branches/pep-0384/Objects/moduleobject.c	(original)
+++ python/branches/pep-0384/Objects/moduleobject.c	Fri Dec  3 20:53:40 2010
@@ -74,7 +74,7 @@
         module->m_base.m_index = max_module_number;
     }
     name = module->m_name;
-    if (module_api_version != PYTHON_API_VERSION) {
+    if (module_api_version != PYTHON_API_VERSION && module_api_version != PYTHON_ABI_VERSION) {
         int err;
         err = PyErr_WarnFormat(PyExc_RuntimeWarning, 1,
             "Python C API version mismatch for module %.100s: "

Modified: python/branches/pep-0384/Python/dynload_shlib.c
==============================================================================
--- python/branches/pep-0384/Python/dynload_shlib.c	(original)
+++ python/branches/pep-0384/Python/dynload_shlib.c	Fri Dec  3 20:53:40 2010
@@ -53,6 +53,8 @@
 #else  /* !__VMS */
     {"." SOABI ".so", "rb", C_EXTENSION},
     {"module." SOABI ".so", "rb", C_EXTENSION},
+    {".abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION},
+    {"module.abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION},
     {".so", "rb", C_EXTENSION},
     {"module.so", "rb", C_EXTENSION},
 #endif  /* __VMS */


More information about the Python-checkins mailing list