GeezerVison is showing github.com — Merge in the new GIL. · python/cpython@074e5ed
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Include/ceval.h +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -112,10 +112,6 @@ PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); | 112 | 112 | PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *); | 113 | 113 | PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); | 114 | 114 |
| 115 | | -/* this used to be handled on a per-thread basis - now just two globals */ | 116 | | -PyAPI_DATA(volatile int) _Py_Ticker; | 117 | | -PyAPI_DATA(int) _Py_CheckInterval; | 118 | | - | 119 | 115 | /* Interface for threads. | 120 | 116 |
| 121 | 117 | A module that plans to do a blocking system call (or something else | @@ -174,6 +170,9 @@ PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); | 174 | 170 | PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); | 175 | 171 | PyAPI_FUNC(void) PyEval_ReInitThreads(void); | 176 | 172 |
| | 173 | +PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds); | | 174 | +PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); | | 175 | + | 177 | 176 | #define Py_BEGIN_ALLOW_THREADS { \ | 178 | 177 | PyThreadState *_save; \ | 179 | 178 | _save = PyEval_SaveThread(); | @@ -192,6 +191,7 @@ PyAPI_FUNC(void) PyEval_ReInitThreads(void); | 192 | 191 | #endif /* !WITH_THREAD */ | 193 | 192 |
| 194 | 193 | PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); | | 194 | +PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void); | 195 | 195 |
| 196 | 196 |
| 197 | 197 | #ifdef __cplusplus | |
Collapse file Copy file name to clipboardExpand all lines: Include/pystate.h +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -88,6 +88,8 @@ typedef struct _ts { | 88 | 88 |
| 89 | 89 | PyObject *dict; /* Stores per-thread state */ | 90 | 90 |
| | 91 | + /* XXX doesn't mean anything anymore (the comment below is obsolete) | | 92 | + => deprecate or remove? */ | 91 | 93 | /* tick_counter is incremented whenever the check_interval ticker | 92 | 94 | * reaches zero. The purpose is to give a useful measure of the number | 93 | 95 | * of interpreted bytecode instructions in a given thread. This | |
Collapse file Copy file name to clipboardExpand all lines: Include/sysmodule.h -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,6 @@ PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) | 18 | 18 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); | 19 | 19 |
| 20 | 20 | PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; | 21 | | -PyAPI_DATA(int) _PySys_CheckInterval; | 22 | 21 |
| 23 | 22 | PyAPI_FUNC(void) PySys_ResetWarnOptions(void); | 24 | 23 | PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *); | |
Collapse file Copy file name to clipboardExpand all lines: Lib/test/test_sys.py +15Lines changed: 15 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -154,6 +154,21 @@ def test_setcheckinterval(self): | 154 | 154 | sys.setcheckinterval(n) | 155 | 155 | self.assertEquals(sys.getcheckinterval(), n) | 156 | 156 |
| | 157 | + def test_switchinterval(self): | | 158 | + self.assertRaises(TypeError, sys.setswitchinterval) | | 159 | + self.assertRaises(TypeError, sys.setswitchinterval, "a") | | 160 | + self.assertRaises(ValueError, sys.setswitchinterval, -1.0) | | 161 | + self.assertRaises(ValueError, sys.setswitchinterval, 0.0) | | 162 | + orig = sys.getswitchinterval() | | 163 | + # sanity check | | 164 | + self.assertTrue(orig < 0.5, orig) | | 165 | + try: | | 166 | + for n in 0.00001, 0.05, 3.0, orig: | | 167 | + sys.setswitchinterval(n) | | 168 | + self.assertAlmostEquals(sys.getswitchinterval(), n) | | 169 | + finally: | | 170 | + sys.setswitchinterval(orig) | | 171 | + | 157 | 172 | def test_recursionlimit(self): | 158 | 173 | self.assertRaises(TypeError, sys.getrecursionlimit, 42) | 159 | 174 | oldlimit = sys.getrecursionlimit() | |
Collapse file Copy file name to clipboardExpand all lines: Makefile.pre.in +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -596,7 +596,7 @@ Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \ | 596 | 596 | $(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES) | 597 | 597 | $(OPCODETARGETGEN) $(OPCODETARGETS_H) | 598 | 598 |
| 599 | | -Python/ceval.o: $(OPCODETARGETS_H) | | 599 | +Python/ceval.o: $(OPCODETARGETS_H) Python/ceval_gil.h | 600 | 600 |
| 601 | 601 | Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \ | 602 | 602 | $(BYTESTR_DEPS) \ | |
Collapse file Copy file name to clipboardExpand all lines: Objects/longobject.c +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -96,10 +96,7 @@ maybe_small_long(PyLongObject *v) | 96 | 96 | #define MIN(x, y) ((x) > (y) ? (y) : (x)) | 97 | 97 |
| 98 | 98 | #define SIGCHECK(PyTryBlock) \ | 99 | | - if (--_Py_Ticker < 0) { \ | 100 | | - _Py_Ticker = _Py_CheckInterval; \ | 101 | | - if (PyErr_CheckSignals()) PyTryBlock \ | 102 | | - } | | 99 | + if (PyErr_CheckSignals()) PyTryBlock \ | 103 | 100 |
| 104 | 101 | /* forward declaration */ | 105 | 102 | static int bits_in_digit(digit d); | |
|