mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	This commit makes both APIs more consistent by doing the following: - Remove the `PyPegen_CodeObjectFrom*` functions, which weren't used and will probably not be needed. Functions like `Py_CompileStringObject` can be used instead. - Include a `const char *filename` parameter in `PyPegen_ASTFromString`. - Rename `PyPegen_ASTFromFile` to `PyPegen_ASTFromFilename`, because its signature is not the same with `PyParser_ASTFromFile`.
		
			
				
	
	
		
			46 lines
		
	
	
	
		
			953 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
	
		
			953 B
		
	
	
	
		
			C
		
	
	
	
	
	
#ifndef Py_PEGENINTERFACE
 | 
						|
#define Py_PEGENINTERFACE
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef Py_BUILD_CORE
 | 
						|
#  error "this header requires Py_BUILD_CORE define"
 | 
						|
#endif
 | 
						|
 | 
						|
#include "Python.h"
 | 
						|
#include "Python-ast.h"
 | 
						|
 | 
						|
PyAPI_FUNC(mod_ty) PyPegen_ASTFromString(
 | 
						|
    const char *str,
 | 
						|
    const char *filename,
 | 
						|
    int mode,
 | 
						|
    PyCompilerFlags *flags,
 | 
						|
    PyArena *arena);
 | 
						|
PyAPI_FUNC(mod_ty) PyPegen_ASTFromStringObject(
 | 
						|
    const char *str,
 | 
						|
    PyObject* filename,
 | 
						|
    int mode,
 | 
						|
    PyCompilerFlags *flags,
 | 
						|
    PyArena *arena);
 | 
						|
PyAPI_FUNC(mod_ty) PyPegen_ASTFromFileObject(
 | 
						|
    FILE *fp,
 | 
						|
    PyObject *filename_ob,
 | 
						|
    int mode,
 | 
						|
    const char *enc,
 | 
						|
    const char *ps1,
 | 
						|
    const char *ps2,
 | 
						|
    PyCompilerFlags *flags,
 | 
						|
    int *errcode,
 | 
						|
    PyArena *arena);
 | 
						|
PyAPI_FUNC(mod_ty) PyPegen_ASTFromFilename(
 | 
						|
    const char *filename,
 | 
						|
    int mode,
 | 
						|
    PyCompilerFlags *flags,
 | 
						|
    PyArena *arena);
 | 
						|
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
#endif /* !Py_PEGENINTERFACE*/
 |