]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40602: Rename hashtable.h to pycore_hashtable.h (GH-20044)
authorVictor Stinner <vstinner@python.org>
Tue, 12 May 2020 00:42:19 +0000 (02:42 +0200)
committerGitHub <noreply@github.com>
Tue, 12 May 2020 00:42:19 +0000 (02:42 +0200)
* Move Modules/hashtable.h to Include/internal/pycore_hashtable.h
* Move Modules/hashtable.c to Python/hashtable.c
* Python is now linked to hashtable.c. _tracemalloc is no longer
  linked to hashtable.c. Previously, marshal.c got hashtable.c via
  _tracemalloc.c which is built as a builtin module.

Include/internal/pycore_hashtable.h [moved from Modules/hashtable.h with 96% similarity]
Makefile.pre.in
Modules/Setup
Modules/_tracemalloc.c
PCbuild/pythoncore.vcxproj
PCbuild/pythoncore.vcxproj.filters
Python/hashtable.c [moved from Modules/hashtable.c with 99% similarity]
Python/marshal.c

similarity index 96%
rename from Modules/hashtable.h
rename to Include/internal/pycore_hashtable.h
index dbec23d28518729a8d5632449f884ccf86d29447..585f76b51d7112de872e6bf085f2c8ed2feebacc 100644 (file)
@@ -1,7 +1,12 @@
-#ifndef Py_HASHTABLE_H
-#define Py_HASHTABLE_H
-/* The whole API is private */
-#ifndef Py_LIMITED_API
+#ifndef Py_INTERNAL_HASHTABLE_H
+#define Py_INTERNAL_HASHTABLE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+#  error "this header requires Py_BUILD_CORE define"
+#endif
 
 /* Single linked list */
 
@@ -207,5 +212,7 @@ PyAPI_FUNC(int) _Py_hashtable_pop(
     _Py_hashtable_pop(TABLE, sizeof(KEY), &(KEY), sizeof(DATA), &(DATA))
 
 
-#endif   /* Py_LIMITED_API */
+#ifdef __cplusplus
+}
 #endif
+#endif   /* !Py_INTERNAL_HASHTABLE_H */
index 0d616d304484ce41e3a17c2b6611caf7329f7cde..d545a9efb3cd99f04101c97d204afbde01782505 100644 (file)
@@ -351,6 +351,7 @@ PYTHON_OBJS=        \
                Python/getversion.o \
                Python/graminit.o \
                Python/hamt.o \
+               Python/hashtable.o \
                Python/import.o \
                Python/importdl.o \
                Python/initconfig.o \
@@ -1131,6 +1132,7 @@ PYTHON_HEADERS= \
                $(srcdir)/Include/internal/pycore_getopt.h \
                $(srcdir)/Include/internal/pycore_gil.h \
                $(srcdir)/Include/internal/pycore_hamt.h \
+               $(srcdir)/Include/internal/pycore_hashtable.h \
                $(srcdir)/Include/internal/pycore_import.h \
                $(srcdir)/Include/internal/pycore_initconfig.h \
                $(srcdir)/Include/internal/pycore_interp.h \
index 6bf142419de3d92779d29c4fc68b9c923934b710..87e73bac78faec96ceeb9eecf74f899f9019b62e 100644 (file)
@@ -132,7 +132,7 @@ faulthandler faulthandler.c
 #
 # bpo-35053: The module must be builtin since _Py_NewReference()
 # can call _PyTraceMalloc_NewReference().
-_tracemalloc _tracemalloc.c hashtable.c
+_tracemalloc _tracemalloc.c
 
 # PEG-based parser module -- slated to be *the* parser
 _peg_parser _peg_parser.c
index ea7e0127366ab0a04313b72dff38dacade636c52..f22338166d0dc135eca40ae0db01d39e6de2e68d 100644 (file)
@@ -2,7 +2,7 @@
 #include "pycore_gc.h"            // PyGC_Head
 #include "pycore_pymem.h"         // _Py_tracemalloc_config
 #include "pycore_traceback.h"
-#include "hashtable.h"
+#include "pycore_hashtable.h"
 #include "frameobject.h"          // PyFrame_GetBack()
 
 #include "clinic/_tracemalloc.c.h"
index 73274ac9acf557216869bd19d099a300d8db84e3..b6b0cf3e991ba722cd0b3a44f5fb8c6da94144ff 100644 (file)
     <ClInclude Include="..\Include\internal\pycore_getopt.h" />
     <ClInclude Include="..\Include\internal\pycore_gil.h" />
     <ClInclude Include="..\Include\internal\pycore_hamt.h" />
+    <ClInclude Include="..\Include\internal\pycore_hashtable.h" />
     <ClInclude Include="..\Include\internal\pycore_import.h" />
     <ClInclude Include="..\Include\internal\pycore_initconfig.h" />
     <ClInclude Include="..\Include\internal\pycore_interp.h" />
     <ClCompile Include="..\Modules\errnomodule.c" />
     <ClCompile Include="..\Modules\faulthandler.c" />
     <ClCompile Include="..\Modules\gcmodule.c" />
-    <ClCompile Include="..\Modules\hashtable.c" />
     <ClCompile Include="..\Modules\itertoolsmodule.c" />
     <ClCompile Include="..\Modules\main.c" />
     <ClCompile Include="..\Modules\mathmodule.c" />
     <ClCompile Include="..\Python\getversion.c" />
     <ClCompile Include="..\Python\graminit.c" />
     <ClCompile Include="..\Python\hamt.c" />
+    <ClCompile Include="..\Python\hashtable.c" />
     <ClCompile Include="..\Python\import.c" />
     <ClCompile Include="..\Python\importdl.c" />
     <ClCompile Include="..\Python\initconfig.c" />
index 254c8fbbea5fb8314434c2eacf9329df2f0309ce..10dfffba6113e52805a7571b4d451b6be53e1118 100644 (file)
     <ClInclude Include="..\Include\internal\pycore_hamt.h">
       <Filter>Include</Filter>
     </ClInclude>
+    <ClInclude Include="..\Include\internal\pycore_hashtable.h">
+      <Filter>Include</Filter>
+    </ClInclude>
     <ClInclude Include="..\Include\internal\pycore_import.h">
       <Filter>Include</Filter>
     </ClInclude>
     <ClCompile Include="..\Python\hamt.h">
       <Filter>Python</Filter>
     </ClCompile>
+    <ClCompile Include="..\Python\hashtable.c">
+      <Filter>Modules</Filter>
+    </ClCompile>
     <ClCompile Include="..\Python\import.c">
       <Filter>Python</Filter>
     </ClCompile>
     <ClCompile Include="..\Modules\_tracemalloc.c">
       <Filter>Modules</Filter>
     </ClCompile>
-    <ClCompile Include="..\Modules\hashtable.c">
-      <Filter>Modules</Filter>
-    </ClCompile>
     <ClCompile Include="..\PC\invalid_parameter_handler.c">
       <Filter>PC</Filter>
     </ClCompile>
similarity index 99%
rename from Modules/hashtable.c
rename to Python/hashtable.c
index 4a36a1e71cdd05518403662cc3985abc666b911c..22b84590105f9e6380e9a5436eb6ec86b8202e52 100644 (file)
@@ -45,7 +45,7 @@
 */
 
 #include "Python.h"
-#include "hashtable.h"
+#include "pycore_hashtable.h"
 
 #define HASHTABLE_MIN_SIZE 16
 #define HASHTABLE_HIGH 0.50
index b4429aea502d3fcfe29e1f77296ed4a721736915..d2bff524f30dde66bbe940546d265b3643f89c03 100644 (file)
@@ -12,7 +12,7 @@
 #include "longintrepr.h"
 #include "code.h"
 #include "marshal.h"
-#include "../Modules/hashtable.h"
+#include "pycore_hashtable.h"
 
 /*[clinic input]
 module marshal