mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-22257: Small changes for PEP 432. (#1728)
PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.
This commit is contained in:
parent
f9169ce6b4
commit
6b4be195cd
19 changed files with 2221 additions and 2006 deletions
|
@ -112,6 +112,7 @@
|
|||
|
||||
#include "pyarena.h"
|
||||
#include "modsupport.h"
|
||||
#include "compile.h"
|
||||
#include "pythonrun.h"
|
||||
#include "pylifecycle.h"
|
||||
#include "ceval.h"
|
||||
|
@ -123,7 +124,6 @@
|
|||
#include "abstract.h"
|
||||
#include "bltinmodule.h"
|
||||
|
||||
#include "compile.h"
|
||||
#include "eval.h"
|
||||
|
||||
#include "pyctype.h"
|
||||
|
|
|
@ -11,6 +11,23 @@ extern "C" {
|
|||
/* Public interface */
|
||||
struct _node; /* Declare the existence of this type */
|
||||
PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
|
||||
/* XXX (ncoghlan): Unprefixed type name in a public API! */
|
||||
|
||||
#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
|
||||
CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
|
||||
CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
|
||||
CO_FUTURE_GENERATOR_STOP)
|
||||
#define PyCF_MASK_OBSOLETE (CO_NESTED)
|
||||
#define PyCF_SOURCE_IS_UTF8 0x0100
|
||||
#define PyCF_DONT_IMPLY_DEDENT 0x0200
|
||||
#define PyCF_ONLY_AST 0x0400
|
||||
#define PyCF_IGNORE_COOKIE 0x0800
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
typedef struct {
|
||||
int cf_flags; /* bitmask of CO_xxx flags relevant to future */
|
||||
} PyCompilerFlags;
|
||||
#endif
|
||||
|
||||
/* Future feature support */
|
||||
|
||||
|
|
|
@ -77,14 +77,15 @@ PyAPI_FUNC(const char *) _Py_gitversion(void);
|
|||
/* Internal -- various one-time initializations */
|
||||
#ifndef Py_LIMITED_API
|
||||
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
|
||||
PyAPI_FUNC(PyObject *) _PySys_Init(void);
|
||||
PyAPI_FUNC(PyObject *) _PySys_BeginInit(void);
|
||||
PyAPI_FUNC(int) _PySys_EndInit(PyObject *sysdict);
|
||||
PyAPI_FUNC(void) _PyImport_Init(void);
|
||||
PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod);
|
||||
PyAPI_FUNC(void) _PyImportHooks_Init(void);
|
||||
PyAPI_FUNC(int) _PyFrame_Init(void);
|
||||
PyAPI_FUNC(int) _PyFloat_Init(void);
|
||||
PyAPI_FUNC(int) PyByteArray_Init(void);
|
||||
PyAPI_FUNC(void) _PyRandom_Init(void);
|
||||
PyAPI_FUNC(void) _Py_HashRandomization_Init(void);
|
||||
#endif
|
||||
|
||||
/* Various internal finalizers */
|
||||
|
@ -106,7 +107,7 @@ PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
|
|||
PyAPI_FUNC(void) _PyGC_Fini(void);
|
||||
PyAPI_FUNC(void) PySlice_Fini(void);
|
||||
PyAPI_FUNC(void) _PyType_Fini(void);
|
||||
PyAPI_FUNC(void) _PyRandom_Fini(void);
|
||||
PyAPI_FUNC(void) _Py_HashRandomization_Fini(void);
|
||||
PyAPI_FUNC(void) PyAsyncGen_Fini(void);
|
||||
|
||||
PyAPI_DATA(PyThreadState *) _Py_Finalizing;
|
||||
|
|
|
@ -302,6 +302,7 @@ PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void);
|
|||
/* Routines for advanced debuggers, requested by David Beazley.
|
||||
Don't use unless you know what you are doing! */
|
||||
#ifndef Py_LIMITED_API
|
||||
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void);
|
||||
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
|
||||
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *);
|
||||
PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
|
||||
|
|
|
@ -7,22 +7,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
|
||||
CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
|
||||
CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
|
||||
CO_FUTURE_GENERATOR_STOP)
|
||||
#define PyCF_MASK_OBSOLETE (CO_NESTED)
|
||||
#define PyCF_SOURCE_IS_UTF8 0x0100
|
||||
#define PyCF_DONT_IMPLY_DEDENT 0x0200
|
||||
#define PyCF_ONLY_AST 0x0400
|
||||
#define PyCF_IGNORE_COOKIE 0x0800
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
typedef struct {
|
||||
int cf_flags; /* bitmask of CO_xxx flags relevant to future */
|
||||
} PyCompilerFlags;
|
||||
#endif
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
|
||||
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue