gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private (#117412)

This commit is contained in:
Irit Katriel 2024-04-02 11:34:49 +01:00 committed by GitHub
parent 5fd1897ec5
commit 1d5479b236
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 49 additions and 42 deletions

View file

@ -1,11 +1,12 @@
#include "Python.h"
#include "pycore_ast.h" // _PyAST_GetDocString()
#include "pycore_symtable.h" // _PyFutureFeatures
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
#define UNDEFINED_FUTURE_FEATURE "future feature %.100s is not defined"
static int
future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
future_check_features(_PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
{
int i;
@ -53,7 +54,7 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
}
static int
future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
future_parse(_PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
{
if (!(mod->kind == Module_kind || mod->kind == Interactive_kind)) {
return 1;
@ -98,10 +99,10 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
int
_PyFuture_FromAST(mod_ty mod, PyObject *filename, PyFutureFeatures *ff)
_PyFuture_FromAST(mod_ty mod, PyObject *filename, _PyFutureFeatures *ff)
{
ff->ff_features = 0;
ff->ff_location = (_PyCompilerSrcLocation){-1, -1, -1, -1};
ff->ff_location = (_Py_SourceLocation){-1, -1, -1, -1};
if (!future_parse(ff, mod, filename)) {
return 0;