summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-25 22:56:17 (GMT)
committerGitHub <noreply@github.com>2018-11-25 22:56:17 (GMT)
commitec13b9322d95a651606219469fc7b7e9c977f248 (patch)
tree3fe923cfef5fafe9b5cba193b9dc54b8fd3c7bc2
parent8ac6539d85b481fc6b5e9145446b07e591b2caba (diff)
downloadcpython-ec13b9322d95a651606219469fc7b7e9c977f248.zip
cpython-ec13b9322d95a651606219469fc7b7e9c977f248.tar.gz
cpython-ec13b9322d95a651606219469fc7b7e9c977f248.tar.bz2
bpo-35081: Add Include/internal/pycore_tupleobject.h (GH-10705)
Move _PyTuple_ITEMS() to a new header file: Include/internal/pycore_tupleobject.h
-rw-r--r--Include/internal/pycore_tupleobject.h18
-rw-r--r--Include/tupleobject.h4
-rw-r--r--Makefile.pre.in1
-rw-r--r--Modules/_functoolsmodule.c2
-rw-r--r--Objects/call.c1
-rw-r--r--Objects/codeobject.c1
-rw-r--r--Objects/descrobject.c1
-rw-r--r--Objects/funcobject.c1
-rw-r--r--PCbuild/pythoncore.vcxproj1
-rw-r--r--PCbuild/pythoncore.vcxproj.filters3
-rw-r--r--Python/ceval.c1
-rw-r--r--Python/getargs.c1
12 files changed, 30 insertions, 5 deletions
diff --git a/Include/internal/pycore_tupleobject.h b/Include/internal/pycore_tupleobject.h
new file mode 100644
index 0000000..fdd7414
--- /dev/null
+++ b/Include/internal/pycore_tupleobject.h
@@ -0,0 +1,18 @@
+#ifndef Py_INTERNAL_TUPLEOBJECT_H
+#define Py_INTERNAL_TUPLEOBJECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
+# error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_BUILTIN define"
+#endif
+
+#include "tupleobject.h"
+
+#define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item)
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_TUPLEOBJECT_H */
diff --git a/Include/tupleobject.h b/Include/tupleobject.h
index a150d07..eec2d98 100644
--- a/Include/tupleobject.h
+++ b/Include/tupleobject.h
@@ -61,10 +61,6 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
#define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i])
#define PyTuple_GET_SIZE(op) (assert(PyTuple_Check(op)), Py_SIZE(op))
-#ifdef Py_BUILD_CORE
-# define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item)
-#endif
-
/* Macro, *only* to be used to fill in brand new tuples */
#define PyTuple_SET_ITEM(op, i, v) (_PyTuple_CAST(op)->ob_item[i] = v)
#endif
diff --git a/Makefile.pre.in b/Makefile.pre.in
index d0e915a..2c92db2 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1043,6 +1043,7 @@ PYTHON_HEADERS= \
$(srcdir)/Include/internal/pycore_pylifecycle.h \
$(srcdir)/Include/internal/pycore_pymem.h \
$(srcdir)/Include/internal/pycore_pystate.h \
+ $(srcdir)/Include/internal/pycore_tupleobject.h \
$(srcdir)/Include/internal/pycore_warnings.h \
$(DTRACE_HEADERS)
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 773102b..8701f6c 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -1,7 +1,7 @@
-
#include "Python.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
+#include "pycore_tupleobject.h"
#include "structmember.h"
/* _functools module written and maintained
diff --git a/Objects/call.c b/Objects/call.c
index ce346c2..ba2ddcb 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -1,6 +1,7 @@
#include "Python.h"
#include "pycore_object.h"
#include "pycore_pystate.h"
+#include "pycore_tupleobject.h"
#include "frameobject.h"
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index a2efa7e..09182d6 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -4,6 +4,7 @@
#include "code.h"
#include "structmember.h"
#include "pycore_pystate.h"
+#include "pycore_tupleobject.h"
/* Holder for co_extra information */
typedef struct {
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index dd3c501..23d4b1a 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -3,6 +3,7 @@
#include "Python.h"
#include "pycore_object.h"
#include "pycore_pystate.h"
+#include "pycore_tupleobject.h"
#include "structmember.h" /* Why is this not included in Python.h? */
/*[clinic input]
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 982df54..c77e4e9 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -5,6 +5,7 @@
#include "pycore_object.h"
#include "pycore_pymem.h"
#include "pycore_pystate.h"
+#include "pycore_tupleobject.h"
#include "code.h"
#include "structmember.h"
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index 34cd379..8aa4c06 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -127,6 +127,7 @@
<ClInclude Include="..\Include\internal\pycore_pylifecycle.h" />
<ClInclude Include="..\Include\internal\pycore_pymem.h" />
<ClInclude Include="..\Include\internal\pycore_pystate.h" />
+ <ClInclude Include="..\Include\internal\pycore_tupleobject.h" />
<ClInclude Include="..\Include\internal\pycore_warnings.h" />
<ClInclude Include="..\Include\intrcheck.h" />
<ClInclude Include="..\Include\iterobject.h" />
diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters
index ebe5e8a..021a67e 100644
--- a/PCbuild/pythoncore.vcxproj.filters
+++ b/PCbuild/pythoncore.vcxproj.filters
@@ -180,6 +180,9 @@
<ClInclude Include="..\Include\internal\pycore_pystate.h">
<Filter>Include</Filter>
</ClInclude>
+ <ClInclude Include="..\Include\internal\pycore_tupleobject.h">
+ <Filter>Include</Filter>
+ </ClInclude>
<ClInclude Include="..\Include\internal\pycore_warnings.h">
<Filter>Include</Filter>
</ClInclude>
diff --git a/Python/ceval.c b/Python/ceval.c
index 7b24655..a4273ad 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -12,6 +12,7 @@
#include "Python.h"
#include "pycore_object.h"
#include "pycore_pystate.h"
+#include "pycore_tupleobject.h"
#include "code.h"
#include "dictobject.h"
diff --git a/Python/getargs.c b/Python/getargs.c
index 89df29e..ac8bac3 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -2,6 +2,7 @@
/* New getargs implementation */
#include "Python.h"
+#include "pycore_tupleobject.h"
#include <ctype.h>
#include <float.h>