summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-03-19 11:41:49 (GMT)
committerGitHub <noreply@github.com>2021-03-19 11:41:49 (GMT)
commit28ad12f8fe889a741661eb99daacebd9243cc1ba (patch)
tree0519e059d23700bc0d9fe9b1bd4601559e49dbb4 /Include
parent32eba61ea431c76f15a910c0a4eded7f5f8b9b34 (diff)
downloadcpython-28ad12f8fe889a741661eb99daacebd9243cc1ba.zip
cpython-28ad12f8fe889a741661eb99daacebd9243cc1ba.tar.gz
cpython-28ad12f8fe889a741661eb99daacebd9243cc1ba.tar.bz2
bpo-43244: Remove symtable.h header file (GH-24910)
Rename Include/symtable.h to to Include/internal/pycore_symtable.h, don't export symbols anymore (replace PyAPI_FUNC and PyAPI_DATA with extern) and rename functions: * PyST_GetScope() to _PyST_GetScope() * PySymtable_BuildObject() to _PySymtable_Build() * PySymtable_Free() to _PySymtable_Free() Remove PySymtable_Build(), Py_SymtableString() and Py_SymtableStringObject() functions. The Py_SymtableString() function was part the stable ABI by mistake but it could not be used, since the symtable.h header file was excluded from the limited C API. The Python symtable module remains available and is unchanged.
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/pythonrun.h11
-rw-r--r--Include/internal/pycore_symtable.h (renamed from Include/symtable.h)35
-rw-r--r--Include/pythonrun.h5
3 files changed, 18 insertions, 33 deletions
diff --git a/Include/cpython/pythonrun.h b/Include/cpython/pythonrun.h
index e396a67..ffca0e45 100644
--- a/Include/cpython/pythonrun.h
+++ b/Include/cpython/pythonrun.h
@@ -77,17 +77,6 @@ PyAPI_FUNC(const char *) _Py_SourceAsString(
PyCompilerFlags *cf,
PyObject **cmd_copy);
-PyAPI_FUNC(struct symtable *) Py_SymtableStringObject(
- const char *str,
- PyObject *filename,
- int start);
-
-PyAPI_FUNC(struct symtable *) _Py_SymtableStringObjectFlags(
- const char *str,
- PyObject *filename,
- int start,
- PyCompilerFlags *flags);
-
/* A function flavor is also exported by libpython. It is required when
libpython is accessed directly rather than using header files which defines
diff --git a/Include/symtable.h b/Include/internal/pycore_symtable.h
index 6f0b7cb..80d5fd1 100644
--- a/Include/symtable.h
+++ b/Include/internal/pycore_symtable.h
@@ -1,15 +1,14 @@
-#ifndef Py_LIMITED_API
-#ifndef Py_SYMTABLE_H
-#define Py_SYMTABLE_H
+#ifndef Py_INTERNAL_SYMTABLE_H
+#define Py_INTERNAL_SYMTABLE_H
#ifdef __cplusplus
extern "C" {
#endif
-#include "Python-ast.h" /* mod_ty */
+#ifndef Py_BUILD_CORE
+# error "this header requires Py_BUILD_CORE define"
+#endif
-/* XXX(ncoghlan): This is a weird mix of public names and interpreter internal
- * names.
- */
+#include "Python-ast.h" /* mod_ty */
typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock }
_Py_block_ty;
@@ -68,23 +67,19 @@ typedef struct _symtable_entry {
struct symtable *ste_table;
} PySTEntryObject;
-PyAPI_DATA(PyTypeObject) PySTEntry_Type;
+extern PyTypeObject PySTEntry_Type;
#define PySTEntry_Check(op) Py_IS_TYPE(op, &PySTEntry_Type)
-PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);
+extern int _PyST_GetScope(PySTEntryObject *, PyObject *);
-PyAPI_FUNC(struct symtable *) PySymtable_Build(
- mod_ty mod,
- const char *filename, /* decoded from the filesystem encoding */
- PyFutureFeatures *future);
-PyAPI_FUNC(struct symtable *) PySymtable_BuildObject(
+extern struct symtable* _PySymtable_Build(
mod_ty mod,
PyObject *filename,
PyFutureFeatures *future);
PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *);
-PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
+extern void _PySymtable_Free(struct symtable *);
/* Flags for def-use information */
@@ -117,8 +112,14 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
#define GENERATOR 1
#define GENERATOR_EXPRESSION 2
+// Used by symtablemodule.c
+extern struct symtable* _Py_SymtableStringObjectFlags(
+ const char *str,
+ PyObject *filename,
+ int start,
+ PyCompilerFlags *flags);
+
#ifdef __cplusplus
}
#endif
-#endif /* !Py_SYMTABLE_H */
-#endif /* !Py_LIMITED_API */
+#endif /* !Py_INTERNAL_SYMTABLE_H */
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index cc6c745..b87bc73 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -9,11 +9,6 @@ extern "C" {
PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
-PyAPI_FUNC(struct symtable *) Py_SymtableString(
- const char *str,
- const char *filename, /* decoded from the filesystem encoding */
- int start);
-
PyAPI_FUNC(void) PyErr_Print(void);
PyAPI_FUNC(void) PyErr_PrintEx(int);
PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);