mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
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.
This commit is contained in:
parent
32eba61ea4
commit
28ad12f8fe
15 changed files with 100 additions and 115 deletions
|
@ -23,7 +23,6 @@
|
|||
#include "token.h" // INDENT
|
||||
#include "errcode.h" // E_EOF
|
||||
#include "code.h" // PyCodeObject
|
||||
#include "symtable.h" // PySymtable_BuildObject()
|
||||
#include "marshal.h" // PyMarshal_ReadLongFromFile()
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
|
@ -1369,48 +1368,6 @@ _Py_SourceAsString(PyObject *cmd, const char *funcname, const char *what, PyComp
|
|||
return str;
|
||||
}
|
||||
|
||||
struct symtable *
|
||||
Py_SymtableStringObject(const char *str, PyObject *filename, int start)
|
||||
{
|
||||
PyCompilerFlags flags = _PyCompilerFlags_INIT;
|
||||
return _Py_SymtableStringObjectFlags(str, filename, start, &flags);
|
||||
}
|
||||
|
||||
struct symtable *
|
||||
_Py_SymtableStringObjectFlags(const char *str, PyObject *filename, int start, PyCompilerFlags *flags)
|
||||
{
|
||||
struct symtable *st;
|
||||
mod_ty mod;
|
||||
PyArena *arena;
|
||||
|
||||
arena = PyArena_New();
|
||||
if (arena == NULL)
|
||||
return NULL;
|
||||
|
||||
mod = PyParser_ASTFromStringObject(str, filename, start, flags, arena);
|
||||
if (mod == NULL) {
|
||||
PyArena_Free(arena);
|
||||
return NULL;
|
||||
}
|
||||
st = PySymtable_BuildObject(mod, filename, 0);
|
||||
PyArena_Free(arena);
|
||||
return st;
|
||||
}
|
||||
|
||||
struct symtable *
|
||||
Py_SymtableString(const char *str, const char *filename_str, int start)
|
||||
{
|
||||
PyObject *filename;
|
||||
struct symtable *st;
|
||||
|
||||
filename = PyUnicode_DecodeFSDefault(filename_str);
|
||||
if (filename == NULL)
|
||||
return NULL;
|
||||
st = Py_SymtableStringObject(str, filename, start);
|
||||
Py_DECREF(filename);
|
||||
return st;
|
||||
}
|
||||
|
||||
#if defined(USE_STACKCHECK)
|
||||
#if defined(WIN32) && defined(_MSC_VER)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue