From 47f7f2f22d067813b1406f7aa9328b53f264aa6a Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 2 Aug 2016 22:51:21 +0300 Subject: Issue #22557: Now importing already imported modules is up to 2.5 times faster. --- Include/pystate.h | 1 + 1 file changed, 1 insertion(+) (limited to 'Include/pystate.h') diff --git a/Include/pystate.h b/Include/pystate.h index d69d4c9cf8..f08618cc00 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -41,6 +41,7 @@ typedef struct _is { #endif PyObject *builtins_copy; + PyObject *import_func; } PyInterpreterState; #endif -- cgit v1.2.1 From 0b77d53b22873d0be290d30321a03f4769489ddc Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Mon, 5 Sep 2016 15:33:46 -0700 Subject: Implement the frame evaluation API aspect of PEP 523. --- Include/pystate.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Include/pystate.h') diff --git a/Include/pystate.h b/Include/pystate.h index f08618cc00..5a067736e3 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -12,10 +12,13 @@ extern "C" { struct _ts; /* Forward */ struct _is; /* Forward */ +struct _frame; /* Forward declaration for PyFrameObject. */ #ifdef Py_LIMITED_API typedef struct _is PyInterpreterState; #else +typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int); + typedef struct _is { struct _is *next; @@ -42,14 +45,14 @@ typedef struct _is { PyObject *builtins_copy; PyObject *import_func; + /* Initialized to PyEval_EvalFrameDefault(). */ + _PyFrameEvalFunction eval_frame; } PyInterpreterState; #endif /* State unique per thread */ -struct _frame; /* Avoid including frameobject.h */ - #ifndef Py_LIMITED_API /* Py_tracefunc return -1 when raising an exception, or 0 for success. */ typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); -- cgit v1.2.1 From 7cbba2deb3fc49bd66e11b34f8e210371bac5913 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Wed, 7 Sep 2016 11:16:41 -0700 Subject: Add the co_extra field and accompanying APIs to code objects. This completes PEP 523. --- Include/pystate.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Include/pystate.h') diff --git a/Include/pystate.h b/Include/pystate.h index 5a067736e3..5ab5c985be 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -8,6 +8,10 @@ extern "C" { #endif +/* This limitation is for performance and simplicity. If needed it can be +removed (with effort). */ +#define MAX_CO_EXTRA_USERS 255 + /* State shared between threads */ struct _ts; /* Forward */ @@ -141,6 +145,9 @@ typedef struct _ts { PyObject *coroutine_wrapper; int in_coroutine_wrapper; + Py_ssize_t co_extra_user_count; + freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS]; + /* XXX signal handlers should also be here */ } PyThreadState; -- cgit v1.2.1 From 17668cfa5e0e6f50376cc233d9b063b908a19845 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 8 Sep 2016 22:01:51 -0700 Subject: Issue #28003: Implement PEP 525 -- Asynchronous Generators. --- Include/pystate.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Include/pystate.h') diff --git a/Include/pystate.h b/Include/pystate.h index 5ab5c985be..f1c9427869 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -148,6 +148,9 @@ typedef struct _ts { Py_ssize_t co_extra_user_count; freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS]; + PyObject *async_gen_firstiter; + PyObject *async_gen_finalizer; + /* XXX signal handlers should also be here */ } PyThreadState; -- cgit v1.2.1 From 831deb2ea3f31f273438acc797ae12d183a21422 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 9 Sep 2016 14:57:58 -0700 Subject: remove ceval timestamp support --- Include/pystate.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'Include/pystate.h') diff --git a/Include/pystate.h b/Include/pystate.h index f1c9427869..ff0d4fe6ba 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -43,9 +43,6 @@ typedef struct _is { #ifdef HAVE_DLOPEN int dlopenflags; #endif -#ifdef WITH_TSC - int tscdump; -#endif PyObject *builtins_copy; PyObject *import_func; -- cgit v1.2.1 From 97b3ef45e988a2ede5143dbf716991ca621a0914 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 11 Sep 2016 11:03:14 +0300 Subject: Issue #26900: Excluded underscored names and other private API from limited API. --- Include/pystate.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Include/pystate.h') diff --git a/Include/pystate.h b/Include/pystate.h index ff0d4fe6ba..afc3c0c6d1 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -157,7 +157,9 @@ typedef struct _ts { PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); +#ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyState_AddModule(PyObject*, struct PyModuleDef*); +#endif /* !Py_LIMITED_API */ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* New in 3.3 */ PyAPI_FUNC(int) PyState_AddModule(PyObject*, struct PyModuleDef*); @@ -169,14 +171,20 @@ PyAPI_FUNC(void) _PyState_ClearModules(void); #endif PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); +#ifndef Py_LIMITED_API PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *); PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *); +#endif /* !Py_LIMITED_API */ PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); +#ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyThreadState_DeleteExcept(PyThreadState *tstate); +#endif /* !Py_LIMITED_API */ #ifdef WITH_THREAD PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); +#ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyGILState_Reinit(void); +#endif /* !Py_LIMITED_API */ #endif /* Return the current thread state. The global interpreter lock must be held. @@ -184,9 +192,11 @@ PyAPI_FUNC(void) _PyGILState_Reinit(void); * the caller needn't check for NULL). */ PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); +#ifndef Py_LIMITED_API /* Similar to PyThreadState_Get(), but don't issue a fatal error * if it is NULL. */ PyAPI_FUNC(PyThreadState *) _PyThreadState_UncheckedGet(void); +#endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); -- cgit v1.2.1