mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853)
Change PyAPI_FUNC(type), PyAPI_DATA(type) and PyMODINIT_FUNC macros of pyport.h when Py_BUILD_CORE_MODULE is defined. The Py_BUILD_CORE_MODULE define must be now be used to build a C extension as a dynamic library accessing Python internals: export the PyInit_xxx() function in DLL exports on Windows. Changes: * Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE now imply Py_BUILD_CORE directy in pyport.h. * ceval.c compilation now fails with an error if Py_BUILD_CORE is not defined, just to ensure that Python is build with the correct defines. * setup.py now compiles _pickle.c with Py_BUILD_CORE_MODULE define. * setup.py compiles _json.c with Py_BUILD_CORE_MODULE define, rather than Py_BUILD_CORE_BUILTIN define * PCbuild/pythoncore.vcxproj: Add Py_BUILD_CORE_BUILTIN define.
This commit is contained in:
parent
3092d6b263
commit
5c75f37d47
26 changed files with 96 additions and 55 deletions
|
@ -1,8 +1,11 @@
|
|||
/* pickle accelerator C extensor: _pickle module.
|
||||
*
|
||||
* It is built as a built-in module (Py_BUILD_CORE_BUILTIN define) on Windows
|
||||
* and as an extension module (Py_BUILD_CORE_MODULE define) on other
|
||||
* platforms. */
|
||||
|
||||
/* Core extension modules are built-in on some platforms (e.g. Windows). */
|
||||
#ifdef Py_BUILD_CORE
|
||||
#define Py_BUILD_CORE_BUILTIN
|
||||
#undef Py_BUILD_CORE
|
||||
#if !defined(Py_BUILD_CORE_BUILTIN) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# error "Py_BUILD_CORE_BUILTIN or Py_BUILD_CORE_MODULE must be defined"
|
||||
#endif
|
||||
|
||||
#include "Python.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue