Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-43244: Add pycore_ast.h header file#24908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 1 commit intopython:masterfromvstinner:internal_ast2
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-43244: Add pycore_ast.h header file
Move _PyAST_GetDocString() and _PyAST_ExprAsUnicode() functions theinternal C API: from Include/ast.h to a newInclude/internal/pycore_ast.h header file. Don't export thesefunctions anymore: replace PyAPI_FUNC() with extern.Remove also unused includes.
  • Loading branch information
@vstinner
vstinner committedMar 17, 2021
commit3aaf2a7fd420aa260b0fdd1b37b0bdbd5795102a
8 changes: 0 additions & 8 deletionsInclude/ast.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,14 +9,6 @@ extern "C" {

PyAPI_FUNC(int) PyAST_Validate(mod_ty);

/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
PyAPI_FUNC(PyObject *) _PyAST_ExprAsUnicode(expr_ty);

/* Return the borrowed reference to the first literal string in the
sequence of statements or NULL if it doesn't start from a literal string.
Doesn't set exception. */
PyAPI_FUNC(PyObject *) _PyAST_GetDocString(asdl_stmt_seq *);

#ifdef __cplusplus
}
#endif
Expand Down
25 changes: 25 additions & 0 deletionsInclude/internal/pycore_ast.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
#ifndef Py_INTERNAL_AST_H
#define Py_INTERNAL_AST_H
#ifdef __cplusplus
extern "C" {
#endif

#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif

#include "Python-ast.h" // expr_ty

/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */
extern PyObject* _PyAST_ExprAsUnicode(expr_ty);

/* Return the borrowed reference to the first literal string in the
sequence of statements or NULL if it doesn't start from a literal string.
Doesn't set exception. */
extern PyObject* _PyAST_GetDocString(asdl_stmt_seq *);

#ifdef __cplusplus
}
#endif
#endif /* !Py_INTERNAL_AST_H */

1 change: 1 addition & 0 deletionsMakefile.pre.in
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1135,6 +1135,7 @@ PYTHON_HEADERS= \
\
$(srcdir)/Include/internal/pycore_abstract.h \
$(srcdir)/Include/internal/pycore_accu.h \
$(srcdir)/Include/internal/pycore_ast.h \
$(srcdir)/Include/internal/pycore_ast_state.h \
$(srcdir)/Include/internal/pycore_atomic.h \
$(srcdir)/Include/internal/pycore_atomic_funcs.h \
Expand Down
1 change: 1 addition & 0 deletionsPCbuild/pythoncore.vcxproj
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -175,6 +175,7 @@
<ClInclude Include="..\Include\import.h" />
<ClInclude Include="..\Include\internal\pycore_abstract.h" />
<ClInclude Include="..\Include\internal\pycore_accu.h" />
<ClInclude Include="..\Include\internal\pycore_ast.h" />
<ClInclude Include="..\Include\internal\pycore_ast_state.h" />
<ClInclude Include="..\Include\internal\pycore_atomic.h" />
<ClInclude Include="..\Include\internal\pycore_atomic_funcs.h" />
Expand Down
3 changes: 3 additions & 0 deletionsPCbuild/pythoncore.vcxproj.filters
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -486,6 +486,9 @@
<ClInclude Include="..\Include\internal\pycore_accu.h">
<Filter>Include\internal</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_ast.h">
<Filter>Include\internal</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_ast_state.h">
<Filter>Include\internal</Filter>
</ClInclude>
Expand Down
3 changes: 1 addition & 2 deletionsPython/ast_opt.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
/* AST Optimizer */
#include "Python.h"
#include "Python-ast.h"
#include "ast.h"
#include "pycore_ast.h" // _PyAST_GetDocString()


static int
Expand Down
11 changes: 5 additions & 6 deletionsPython/compile.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,16 +22,15 @@
*/

#include "Python.h"
#include "pycore_ast.h" // _PyAST_GetDocString()
#include "pycore_pymem.h" // _PyMem_IsPtrFreed()
#include "pycore_long.h" // _PyLong_GetZero()

#include "Python-ast.h"
#include "ast.h"
#include "code.h"
#include "symtable.h"
#include "symtable.h" // struct symtable
#define NEED_OPCODE_JUMP_TABLES
#include "opcode.h"
#include "wordcode_helpers.h"
#include "opcode.h" // EXTENDED_ARG
#include "wordcode_helpers.h" // instrsize()


#define DEFAULT_BLOCK_SIZE 16
#define DEFAULT_BLOCKS 8
Expand Down
6 changes: 1 addition & 5 deletionsPython/future.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
#include "Python.h"
#include "Python-ast.h"
#include "token.h"
#include "code.h"
#include "symtable.h"
#include "ast.h"
#include "pycore_ast.h" // _PyAST_GetDocString()

#define UNDEFINED_FUTURE_FEATURE "future feature %.100s is not defined"
#define ERR_LATE_FUTURE \
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp