From 1b03fa2f74c3a740316e1b3e8cedd5ba8e4902f1 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 12 May 2020 01:25:03 +0200 Subject: [PATCH] bpo-40602: Rename hashtable.h to pycore_hashtable.h * 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. --- .../internal/pycore_hashtable.h | 17 ++++++++++++----- Makefile.pre.in | 2 ++ Modules/Setup | 2 +- Modules/_tracemalloc.c | 2 +- PCbuild/pythoncore.vcxproj | 3 ++- PCbuild/pythoncore.vcxproj.filters | 9 ++++++--- {Modules => Python}/hashtable.c | 2 +- Python/marshal.c | 2 +- 8 files changed, 26 insertions(+), 13 deletions(-) rename Modules/hashtable.h => Include/internal/pycore_hashtable.h (96%) rename {Modules => Python}/hashtable.c (99%) diff --git a/Modules/hashtable.h b/Include/internal/pycore_hashtable.h similarity index 96% rename from Modules/hashtable.h rename to Include/internal/pycore_hashtable.h index dbec23d2851872..585f76b51d7112 100644 --- a/Modules/hashtable.h +++ b/Include/internal/pycore_hashtable.h @@ -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 */ diff --git a/Makefile.pre.in b/Makefile.pre.in index 0d616d304484ce..d545a9efb3cd99 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -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 \ diff --git a/Modules/Setup b/Modules/Setup index 6bf142419de3d9..87e73bac78faec 100644 --- a/Modules/Setup +++ b/Modules/Setup @@ -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 diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index ea7e0127366ab0..f22338166d0dc1 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -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" diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 73274ac9acf557..b6b0cf3e991ba7 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -181,6 +181,7 @@ + @@ -335,7 +336,6 @@ - @@ -462,6 +462,7 @@ + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index 254c8fbbea5fb8..10dfffba6113e5 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -237,6 +237,9 @@ Include + + Include + Include @@ -1034,6 +1037,9 @@ Python + + Modules + Python @@ -1142,9 +1148,6 @@ Modules - - Modules - PC diff --git a/Modules/hashtable.c b/Python/hashtable.c similarity index 99% rename from Modules/hashtable.c rename to Python/hashtable.c index 4a36a1e71cdd05..22b84590105f9e 100644 --- a/Modules/hashtable.c +++ b/Python/hashtable.c @@ -45,7 +45,7 @@ */ #include "Python.h" -#include "hashtable.h" +#include "pycore_hashtable.h" #define HASHTABLE_MIN_SIZE 16 #define HASHTABLE_HIGH 0.50 diff --git a/Python/marshal.c b/Python/marshal.c index b4429aea502d3f..d2bff524f30dde 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy