[Python-checkins] bpo-43444: Move sqlite3 MODULE_NAME from setup.py to module.h (GH-24801)

berkerpeksag webhook-mailer at python.org
Sat Mar 13 10:33:47 EST 2021


https://github.com/python/cpython/commit/2256a2876b5214a5a7492bf78bd86cf8beb690bf
commit: 2256a2876b5214a5a7492bf78bd86cf8beb690bf
branch: master
author: Erlend Egeberg Aasland <erlend.aasland at innova.no>
committer: berkerpeksag <berker.peksag at gmail.com>
date: 2021-03-13T17:33:39+02:00
summary:

bpo-43444: Move sqlite3 MODULE_NAME from setup.py to module.h (GH-24801)

files:
M Modules/_sqlite/cache.h
M Modules/_sqlite/module.h
M Modules/_sqlite/prepare_protocol.h
M PCbuild/_sqlite3.vcxproj
M setup.py

diff --git a/Modules/_sqlite/cache.h b/Modules/_sqlite/cache.h
index 4a1977fcd2cd2..083356f93f9e4 100644
--- a/Modules/_sqlite/cache.h
+++ b/Modules/_sqlite/cache.h
@@ -23,8 +23,7 @@
 
 #ifndef PYSQLITE_CACHE_H
 #define PYSQLITE_CACHE_H
-#define PY_SSIZE_T_CLEAN
-#include "Python.h"
+#include "module.h"
 
 /* The LRU cache is implemented as a combination of a doubly-linked with a
  * dictionary. The list items are of type 'Node' and the dictionary has the
diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h
index 3185ec9788856..9aede92ea33c9 100644
--- a/Modules/_sqlite/module.h
+++ b/Modules/_sqlite/module.h
@@ -27,6 +27,7 @@
 #include "Python.h"
 
 #define PYSQLITE_VERSION "2.6.0"
+#define MODULE_NAME "sqlite3"
 
 extern PyObject* pysqlite_Error;
 extern PyObject* pysqlite_Warning;
diff --git a/Modules/_sqlite/prepare_protocol.h b/Modules/_sqlite/prepare_protocol.h
index 42d07cbe9f16f..593961331c90d 100644
--- a/Modules/_sqlite/prepare_protocol.h
+++ b/Modules/_sqlite/prepare_protocol.h
@@ -23,8 +23,7 @@
 
 #ifndef PYSQLITE_PREPARE_PROTOCOL_H
 #define PYSQLITE_PREPARE_PROTOCOL_H
-#define PY_SSIZE_T_CLEAN
-#include "Python.h"
+#include "module.h"
 
 typedef struct
 {
diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj
index 7e0062692b8f8..5eb8559d2925e 100644
--- a/PCbuild/_sqlite3.vcxproj
+++ b/PCbuild/_sqlite3.vcxproj
@@ -94,7 +94,6 @@
   <ItemDefinitionGroup>
     <ClCompile>
       <AdditionalIncludeDirectories>$(sqlite3Dir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>MODULE_NAME="sqlite3";%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
   </ItemDefinitionGroup>
   <ItemGroup>
diff --git a/setup.py b/setup.py
index 554772217785d..3467f559e5808 100644
--- a/setup.py
+++ b/setup.py
@@ -1571,12 +1571,7 @@ def detect_sqlite(self):
                 '_sqlite/row.c',
                 '_sqlite/statement.c',
                 '_sqlite/util.c', ]
-
             sqlite_defines = []
-            if not MS_WINDOWS:
-                sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
-            else:
-                sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
 
             # Enable support for loadable extensions in the sqlite3 module
             # if --enable-loadable-sqlite-extensions configure option is used.



More information about the Python-checkins mailing list