Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 1 | #ifndef Py_CEVAL_H |
| 2 | #define Py_CEVAL_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 7 | |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 8 | /* Interface to random parts in ceval.c */ |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 9 | |
INADA Naoki | aa289a5 | 2017-03-14 18:00:59 +0900 | [diff] [blame] | 10 | /* PyEval_CallObjectWithKeywords(), PyEval_CallObject(), PyEval_CallFunction |
| 11 | * and PyEval_CallMethod are kept for backward compatibility: PyObject_Call(), |
| 12 | * PyObject_CallFunction() and PyObject_CallMethod() are recommended to call |
| 13 | * a callable object. |
| 14 | */ |
| 15 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 16 | PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( |
Victor Stinner | 2d0eb65 | 2016-12-06 16:27:24 +0100 | [diff] [blame] | 17 | PyObject *callable, |
| 18 | PyObject *args, |
| 19 | PyObject *kwargs); |
Guido van Rossum | a049031 | 1991-07-27 21:33:03 +0000 | [diff] [blame] | 20 | |
Guido van Rossum | d7ed683 | 1997-08-30 15:02:50 +0000 | [diff] [blame] | 21 | /* Inline this */ |
Victor Stinner | 2d0eb65 | 2016-12-06 16:27:24 +0100 | [diff] [blame] | 22 | #define PyEval_CallObject(callable, arg) \ |
| 23 | PyEval_CallObjectWithKeywords(callable, arg, (PyObject *)NULL) |
Guido van Rossum | d7ed683 | 1997-08-30 15:02:50 +0000 | [diff] [blame] | 24 | |
Victor Stinner | 2d0eb65 | 2016-12-06 16:27:24 +0100 | [diff] [blame] | 25 | PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *callable, |
Jeremy Hylton | af68c87 | 2005-12-10 18:50:16 +0000 | [diff] [blame] | 26 | const char *format, ...); |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 27 | PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, |
Victor Stinner | 2d0eb65 | 2016-12-06 16:27:24 +0100 | [diff] [blame] | 28 | const char *name, |
Jeremy Hylton | af68c87 | 2005-12-10 18:50:16 +0000 | [diff] [blame] | 29 | const char *format, ...); |
Guido van Rossum | 3d109a0 | 1998-08-08 20:53:36 +0000 | [diff] [blame] | 30 | |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 31 | #ifndef Py_LIMITED_API |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 32 | PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); |
| 33 | PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); |
Nathaniel J. Smith | fc2f407 | 2018-01-21 06:44:07 -0800 | [diff] [blame] | 34 | PyAPI_FUNC(void) _PyEval_SetCoroutineOriginTrackingDepth(int new_depth); |
| 35 | PyAPI_FUNC(int) _PyEval_GetCoroutineOriginTrackingDepth(void); |
Yury Selivanov | aab3c4a | 2015-06-02 18:43:51 -0400 | [diff] [blame] | 36 | PyAPI_FUNC(void) _PyEval_SetCoroutineWrapper(PyObject *); |
Yury Selivanov | d8cf382 | 2015-06-01 12:15:23 -0400 | [diff] [blame] | 37 | PyAPI_FUNC(PyObject *) _PyEval_GetCoroutineWrapper(void); |
Yury Selivanov | eb63645 | 2016-09-08 22:01:51 -0700 | [diff] [blame] | 38 | PyAPI_FUNC(void) _PyEval_SetAsyncGenFirstiter(PyObject *); |
| 39 | PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void); |
| 40 | PyAPI_FUNC(void) _PyEval_SetAsyncGenFinalizer(PyObject *); |
| 41 | PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFinalizer(void); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 42 | #endif |
Fred Drake | 55fb6e0 | 2001-06-27 19:18:03 +0000 | [diff] [blame] | 43 | |
Guido van Rossum | 6297a7a | 2003-02-19 15:53:17 +0000 | [diff] [blame] | 44 | struct _frame; /* Avoid including frameobject.h */ |
| 45 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 46 | PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void); |
| 47 | PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void); |
| 48 | PyAPI_FUNC(PyObject *) PyEval_GetLocals(void); |
Guido van Rossum | 6297a7a | 2003-02-19 15:53:17 +0000 | [diff] [blame] | 49 | PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void); |
Tim Peters | 5ba5866 | 2001-07-16 02:29:45 +0000 | [diff] [blame] | 50 | |
Serhiy Storchaka | bb86bf4 | 2018-12-11 08:28:18 +0200 | [diff] [blame] | 51 | #ifndef Py_LIMITED_API |
| 52 | /* Helper to look up a builtin object */ |
| 53 | PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *); |
Tim Peters | 5ba5866 | 2001-07-16 02:29:45 +0000 | [diff] [blame] | 54 | /* Look at the current frame's (if any) code's co_flags, and turn on |
| 55 | the corresponding compiler flags in cf->cf_flags. Return 1 if any |
| 56 | flag was set, else return 0. */ |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 57 | PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 58 | #endif |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 59 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 60 | PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg); |
Antoine Pitrou | c08177a | 2017-06-28 23:29:29 +0200 | [diff] [blame] | 61 | PyAPI_FUNC(void) _PyEval_SignalReceived(void); |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 62 | PyAPI_FUNC(int) Py_MakePendingCalls(void); |
Guido van Rossum | 9566408 | 1994-09-14 13:23:36 +0000 | [diff] [blame] | 63 | |
Antoine Pitrou | 658fad8 | 2008-09-03 18:34:34 +0000 | [diff] [blame] | 64 | /* Protection against deeply nested recursive calls |
| 65 | |
| 66 | In Python 3.0, this protection has two levels: |
| 67 | * normal anti-recursion protection is triggered when the recursion level |
Yury Selivanov | f488fb4 | 2015-07-03 01:04:23 -0400 | [diff] [blame] | 68 | exceeds the current recursion limit. It raises a RecursionError, and sets |
Antoine Pitrou | 658fad8 | 2008-09-03 18:34:34 +0000 | [diff] [blame] | 69 | the "overflowed" flag in the thread state structure. This flag |
| 70 | temporarily *disables* the normal protection; this allows cleanup code |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 71 | to potentially outgrow the recursion limit while processing the |
Yury Selivanov | f488fb4 | 2015-07-03 01:04:23 -0400 | [diff] [blame] | 72 | RecursionError. |
Antoine Pitrou | 658fad8 | 2008-09-03 18:34:34 +0000 | [diff] [blame] | 73 | * "last chance" anti-recursion protection is triggered when the recursion |
| 74 | level exceeds "current recursion limit + 50". By construction, this |
| 75 | protection can only be triggered when the "overflowed" flag is set. It |
| 76 | means the cleanup code has itself gone into an infinite loop, or the |
Yury Selivanov | f488fb4 | 2015-07-03 01:04:23 -0400 | [diff] [blame] | 77 | RecursionError has been mistakingly ignored. When this protection is |
Antoine Pitrou | 658fad8 | 2008-09-03 18:34:34 +0000 | [diff] [blame] | 78 | triggered, the interpreter aborts with a Fatal Error. |
| 79 | |
| 80 | In addition, the "overflowed" flag is automatically reset when the |
| 81 | recursion level drops below "current recursion limit - 50". This heuristic |
| 82 | is meant to ensure that the normal anti-recursion protection doesn't get |
| 83 | disabled too long. |
| 84 | |
| 85 | Please note: this scheme has its own limitations. See: |
| 86 | http://mail.python.org/pipermail/python-dev/2008-August/082106.html |
| 87 | for some observations. |
| 88 | */ |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 89 | PyAPI_FUNC(void) Py_SetRecursionLimit(int); |
| 90 | PyAPI_FUNC(int) Py_GetRecursionLimit(void); |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 91 | |
Antoine Pitrou | 658fad8 | 2008-09-03 18:34:34 +0000 | [diff] [blame] | 92 | #define Py_EnterRecursiveCall(where) \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 93 | (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ |
| 94 | _Py_CheckRecursiveCall(where)) |
| 95 | #define Py_LeaveRecursiveCall() \ |
Antoine Pitrou | 658fad8 | 2008-09-03 18:34:34 +0000 | [diff] [blame] | 96 | do{ if(_Py_MakeEndRecCheck(PyThreadState_GET()->recursion_depth)) \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 97 | PyThreadState_GET()->overflowed = 0; \ |
| 98 | } while(0) |
Serhiy Storchaka | 5fa22fc | 2015-06-21 16:26:28 +0300 | [diff] [blame] | 99 | PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where); |
pdox | 1896793 | 2017-10-25 23:03:01 -0700 | [diff] [blame] | 100 | |
| 101 | /* Due to the macros in which it's used, _Py_CheckRecursionLimit is in |
| 102 | the stable ABI. It should be removed therefrom when possible. |
Eric Snow | 2ebc5ce | 2017-09-07 23:51:28 -0600 | [diff] [blame] | 103 | */ |
Eric Snow | 05351c1 | 2017-09-05 21:43:08 -0700 | [diff] [blame] | 104 | PyAPI_DATA(int) _Py_CheckRecursionLimit; |
Antoine Pitrou | 658fad8 | 2008-09-03 18:34:34 +0000 | [diff] [blame] | 105 | |
Armin Rigo | 2b3eb40 | 2003-10-28 12:05:48 +0000 | [diff] [blame] | 106 | #ifdef USE_STACKCHECK |
pdox | 1896793 | 2017-10-25 23:03:01 -0700 | [diff] [blame] | 107 | /* With USE_STACKCHECK, trigger stack checks in _Py_CheckRecursiveCall() |
| 108 | on every 64th call to Py_EnterRecursiveCall. |
Antoine Pitrou | 658fad8 | 2008-09-03 18:34:34 +0000 | [diff] [blame] | 109 | */ |
| 110 | # define _Py_MakeRecCheck(x) \ |
pdox | 1896793 | 2017-10-25 23:03:01 -0700 | [diff] [blame] | 111 | (++(x) > _Py_CheckRecursionLimit || \ |
| 112 | ++(PyThreadState_GET()->stackcheck_counter) > 64) |
Armin Rigo | 2b3eb40 | 2003-10-28 12:05:48 +0000 | [diff] [blame] | 113 | #else |
| 114 | # define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit) |
| 115 | #endif |
| 116 | |
Victor Stinner | 50856d5 | 2015-10-13 00:11:21 +0200 | [diff] [blame] | 117 | /* Compute the "lower-water mark" for a recursion limit. When |
| 118 | * Py_LeaveRecursiveCall() is called with a recursion depth below this mark, |
| 119 | * the overflowed flag is reset to 0. */ |
| 120 | #define _Py_RecursionLimitLowerWaterMark(limit) \ |
| 121 | (((limit) > 200) \ |
| 122 | ? ((limit) - 50) \ |
| 123 | : (3 * ((limit) >> 2))) |
| 124 | |
Antoine Pitrou | 652e707 | 2009-03-13 19:25:20 +0000 | [diff] [blame] | 125 | #define _Py_MakeEndRecCheck(x) \ |
Victor Stinner | 50856d5 | 2015-10-13 00:11:21 +0200 | [diff] [blame] | 126 | (--(x) < _Py_RecursionLimitLowerWaterMark(_Py_CheckRecursionLimit)) |
Antoine Pitrou | 658fad8 | 2008-09-03 18:34:34 +0000 | [diff] [blame] | 127 | |
Martin v. Löwis | 5b22213 | 2007-06-10 09:51:05 +0000 | [diff] [blame] | 128 | #define Py_ALLOW_RECURSION \ |
| 129 | do { unsigned char _old = PyThreadState_GET()->recursion_critical;\ |
| 130 | PyThreadState_GET()->recursion_critical = 1; |
| 131 | |
| 132 | #define Py_END_ALLOW_RECURSION \ |
| 133 | PyThreadState_GET()->recursion_critical = _old; \ |
| 134 | } while(0); |
| 135 | |
Jeremy Hylton | af68c87 | 2005-12-10 18:50:16 +0000 | [diff] [blame] | 136 | PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *); |
| 137 | PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *); |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 138 | |
Martin v. Löwis | 8d97e33 | 2004-06-27 15:43:12 +0000 | [diff] [blame] | 139 | PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *); |
Phillip J. Eby | 0d6615f | 2005-08-02 00:46:46 +0000 | [diff] [blame] | 140 | PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); |
Brett Cannon | 3cebf93 | 2016-09-05 15:33:46 -0700 | [diff] [blame] | 141 | #ifndef Py_LIMITED_API |
| 142 | PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(struct _frame *f, int exc); |
| 143 | #endif |
Jeremy Hylton | 985eba5 | 2003-02-05 23:13:00 +0000 | [diff] [blame] | 144 | |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 145 | /* Interface for threads. |
| 146 | |
| 147 | A module that plans to do a blocking system call (or something else |
| 148 | that lasts a long time and doesn't touch Python data) can allow other |
| 149 | threads to run as follows: |
| 150 | |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 151 | ...preparations here... |
| 152 | Py_BEGIN_ALLOW_THREADS |
| 153 | ...blocking system call here... |
| 154 | Py_END_ALLOW_THREADS |
| 155 | ...interpret result here... |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 156 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 157 | The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a |
| 158 | {}-surrounded block. |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 159 | To leave the block in the middle (e.g., with return), you must insert |
Skip Montanaro | 682c25a | 2000-09-15 18:19:27 +0000 | [diff] [blame] | 160 | a line containing Py_BLOCK_THREADS before the return, e.g. |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 161 | |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 162 | if (...premature_exit...) { |
| 163 | Py_BLOCK_THREADS |
Serhiy Storchaka | 55fe1ae | 2017-04-16 10:46:38 +0300 | [diff] [blame] | 164 | PyErr_SetFromErrno(PyExc_OSError); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 165 | return NULL; |
| 166 | } |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 167 | |
| 168 | An alternative is: |
| 169 | |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 170 | Py_BLOCK_THREADS |
| 171 | if (...premature_exit...) { |
Serhiy Storchaka | 55fe1ae | 2017-04-16 10:46:38 +0300 | [diff] [blame] | 172 | PyErr_SetFromErrno(PyExc_OSError); |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 173 | return NULL; |
| 174 | } |
| 175 | Py_UNBLOCK_THREADS |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 176 | |
| 177 | For convenience, that the value of 'errno' is restored across |
Skip Montanaro | 682c25a | 2000-09-15 18:19:27 +0000 | [diff] [blame] | 178 | Py_END_ALLOW_THREADS and Py_BLOCK_THREADS. |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 179 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 180 | WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND |
| 181 | Py_END_ALLOW_THREADS!!! |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 182 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 183 | The function PyEval_InitThreads() should be called only from |
Georg Brandl | 2067bfd | 2008-05-25 13:05:15 +0000 | [diff] [blame] | 184 | init_thread() in "_threadmodule.c". |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 185 | |
| 186 | Note that not yet all candidates have been converted to use this |
| 187 | mechanism! |
| 188 | */ |
| 189 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 190 | PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void); |
| 191 | PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *); |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 192 | |
Tim Peters | 7f468f2 | 2004-10-11 02:40:51 +0000 | [diff] [blame] | 193 | PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 194 | PyAPI_FUNC(void) PyEval_InitThreads(void); |
Serhiy Storchaka | 9fab79b | 2016-09-11 11:03:14 +0300 | [diff] [blame] | 195 | #ifndef Py_LIMITED_API |
Antoine Pitrou | 1df1536 | 2010-09-13 14:16:46 +0000 | [diff] [blame] | 196 | PyAPI_FUNC(void) _PyEval_FiniThreads(void); |
Serhiy Storchaka | 9fab79b | 2016-09-11 11:03:14 +0300 | [diff] [blame] | 197 | #endif /* !Py_LIMITED_API */ |
Serhiy Storchaka | 460bd0d | 2016-11-20 12:16:46 +0200 | [diff] [blame] | 198 | PyAPI_FUNC(void) PyEval_AcquireLock(void) Py_DEPRECATED(3.2); |
| 199 | PyAPI_FUNC(void) PyEval_ReleaseLock(void) /* Py_DEPRECATED(3.2) */; |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 200 | PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); |
| 201 | PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); |
| 202 | PyAPI_FUNC(void) PyEval_ReInitThreads(void); |
Guido van Rossum | 2fca21f7 | 1997-07-18 23:56:58 +0000 | [diff] [blame] | 203 | |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 204 | #ifndef Py_LIMITED_API |
Antoine Pitrou | 074e5ed | 2009-11-10 19:50:40 +0000 | [diff] [blame] | 205 | PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds); |
| 206 | PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 207 | #endif |
Antoine Pitrou | 074e5ed | 2009-11-10 19:50:40 +0000 | [diff] [blame] | 208 | |
Brett Cannon | 5c4de28 | 2016-09-07 11:16:41 -0700 | [diff] [blame] | 209 | #ifndef Py_LIMITED_API |
| 210 | PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc); |
| 211 | #endif |
| 212 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 213 | #define Py_BEGIN_ALLOW_THREADS { \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 214 | PyThreadState *_save; \ |
| 215 | _save = PyEval_SaveThread(); |
| 216 | #define Py_BLOCK_THREADS PyEval_RestoreThread(_save); |
| 217 | #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); |
| 218 | #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ |
| 219 | } |
Guido van Rossum | ff4949e | 1992-08-05 19:58:53 +0000 | [diff] [blame] | 220 | |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 221 | #ifndef Py_LIMITED_API |
Martin v. Löwis | 18e1655 | 2006-02-15 17:27:45 +0000 | [diff] [blame] | 222 | PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); |
Serhiy Storchaka | d4edfc9 | 2017-03-30 18:29:23 +0300 | [diff] [blame] | 223 | PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *); |
Antoine Pitrou | 074e5ed | 2009-11-10 19:50:40 +0000 | [diff] [blame] | 224 | PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 225 | #endif |
Guido van Rossum | 7c36ada | 2000-05-08 14:04:54 +0000 | [diff] [blame] | 226 | |
Eric V. Smith | a78c795 | 2015-11-03 12:45:05 -0500 | [diff] [blame] | 227 | /* Masks and values used by FORMAT_VALUE opcode. */ |
| 228 | #define FVC_MASK 0x3 |
| 229 | #define FVC_NONE 0x0 |
| 230 | #define FVC_STR 0x1 |
| 231 | #define FVC_REPR 0x2 |
| 232 | #define FVC_ASCII 0x3 |
| 233 | #define FVS_MASK 0x4 |
| 234 | #define FVS_HAVE_SPEC 0x4 |
Guido van Rossum | 7c36ada | 2000-05-08 14:04:54 +0000 | [diff] [blame] | 235 | |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 236 | #ifdef __cplusplus |
| 237 | } |
| 238 | #endif |
| 239 | #endif /* !Py_CEVAL_H */ |