Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 87ecb52

Browse files
author
Anselm Kruis
committed
Merge branch main into main-slp
The outcome of this merge does not compile.
2 parents cf45a4a + 438a12d commit 87ecb52

File tree

11 files changed

+565
-407
lines changed

11 files changed

+565
-407
lines changed

Include/internal/pycore_ceval.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ PyAPI_FUNC(void) _PyEval_FiniThreads(
1919
PyAPI_FUNC(void) _PyEval_SignalReceived(
2020
struct _ceval_runtime_state *ceval);
2121
PyAPI_FUNC(int) _PyEval_AddPendingCall(
22+
PyThreadState *tstate,
2223
struct _ceval_runtime_state *ceval,
2324
int (*func)(void *),
2425
void *arg);

Include/internal/pycore_pyerrors.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#ifndef Py_INTERNAL_PYERRORS_H
2+
#define Py_INTERNAL_PYERRORS_H
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#ifndef Py_BUILD_CORE
8+
# error "this header requires Py_BUILD_CORE define"
9+
#endif
10+
11+
static inline PyObject* _PyErr_Occurred(PyThreadState *tstate)
12+
{
13+
return tstate == NULL ? NULL : tstate->curexc_type;
14+
}
15+
16+
17+
PyAPI_FUNC(void) _PyErr_Fetch(
18+
PyThreadState *tstate,
19+
PyObject **type,
20+
PyObject **value,
21+
PyObject **traceback);
22+
23+
PyAPI_FUNC(int) _PyErr_ExceptionMatches(
24+
PyThreadState *tstate,
25+
PyObject *exc);
26+
27+
PyAPI_FUNC(void) _PyErr_Restore(
28+
PyThreadState *tstate,
29+
PyObject *type,
30+
PyObject *value,
31+
PyObject *traceback);
32+
33+
PyAPI_FUNC(void) _PyErr_SetObject(
34+
PyThreadState *tstate,
35+
PyObject *type,
36+
PyObject *value);
37+
38+
PyAPI_FUNC(void) _PyErr_Clear(PyThreadState *tstate);
39+
40+
PyAPI_FUNC(void) _PyErr_SetNone(PyThreadState *tstate, PyObject *exception);
41+
42+
PyAPI_FUNC(void) _PyErr_SetString(
43+
PyThreadState *tstate,
44+
PyObject *exception,
45+
const char *string);
46+
47+
PyAPI_FUNC(PyObject *) _PyErr_Format(
48+
PyThreadState *tstate,
49+
PyObject *exception,
50+
const char *format,
51+
...);
52+
53+
PyAPI_FUNC(void) _PyErr_NormalizeException(
54+
PyThreadState *tstate,
55+
PyObject **exc,
56+
PyObject **val,
57+
PyObject **tb);
58+
59+
#ifdef __cplusplus
60+
}
61+
#endif
62+
#endif /* !Py_INTERNAL_PYERRORS_H */

Include/internal/pycore_pylifecycle.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p);
106106

107107
PyAPI_FUNC(PyObject*) _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable);
108108

109+
PyAPI_FUNC(void) _PyErr_Print(PyThreadState *tstate);
110+
109111
#ifdef __cplusplus
110112
}
111113
#endif

Include/internal/pycore_pymem.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef Py_INTERNAL_MEM_H
2-
#define Py_INTERNAL_MEM_H
1+
#ifndef Py_INTERNAL_PYMEM_H
2+
#define Py_INTERNAL_PYMEM_H
33
#ifdef __cplusplus
44
extern "C" {
55
#endif
@@ -191,4 +191,4 @@ PyAPI_FUNC(int) _PyMem_SetupAllocators(PyMemAllocatorName allocator);
191191
#ifdef __cplusplus
192192
}
193193
#endif
194-
#endif /* !Py_INTERNAL_MEM_H */
194+
#endif /* !Py_INTERNAL_PYMEM_H */

Makefile.pre.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,7 @@ PYTHON_HEADERS= \
11291129
$(srcdir)/Include/internal/pycore_hamt.h \
11301130
$(srcdir)/Include/internal/pycore_object.h \
11311131
$(srcdir)/Include/internal/pycore_pathconfig.h \
1132+
$(srcdir)/Include/internal/pycore_pyerrors.h \
11321133
$(srcdir)/Include/internal/pycore_pyhash.h \
11331134
$(srcdir)/Include/internal/pycore_pylifecycle.h \
11341135
$(srcdir)/Include/internal/pycore_pymem.h \

Modules/signalmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ trip_signal(int sig_num)
258258

259259
/* Notify ceval.c */
260260
_PyRuntimeState *runtime = &_PyRuntime;
261+
PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
261262
_PyEval_SignalReceived(&runtime->ceval);
262263

263264
/* And then write to the wakeup fd *after* setting all the globals and
@@ -298,7 +299,7 @@ trip_signal(int sig_num)
298299
{
299300
/* Py_AddPendingCall() isn't signal-safe, but we
300301
still use it for this exceptional case. */
301-
_PyEval_AddPendingCall(&runtime->ceval,
302+
_PyEval_AddPendingCall(tstate, &runtime->ceval,
302303
report_wakeup_send_error,
303304
(void *)(intptr_t) last_error);
304305
}
@@ -317,7 +318,7 @@ trip_signal(int sig_num)
317318
{
318319
/* Py_AddPendingCall() isn't signal-safe, but we
319320
still use it for this exceptional case. */
320-
_PyEval_AddPendingCall(&runtime->ceval,
321+
_PyEval_AddPendingCall(tstate, &runtime->ceval,
321322
report_wakeup_write_error,
322323
(void *)(intptr_t)errno);
323324
}

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
<ClInclude Include="..\Include\internal\pycore_hamt.h" />
175175
<ClInclude Include="..\Include\internal\pycore_object.h" />
176176
<ClInclude Include="..\Include\internal\pycore_pathconfig.h" />
177+
<ClInclude Include="..\Include\internal\pycore_pyerrors.h" />
177178
<ClInclude Include="..\Include\internal\pycore_pyhash.h" />
178179
<ClInclude Include="..\Include\internal\pycore_pylifecycle.h" />
179180
<ClInclude Include="..\Include\internal\pycore_pymem.h" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@
222222
<ClInclude Include="..\Include\internal\pycore_pathconfig.h">
223223
<Filter>Include</Filter>
224224
</ClInclude>
225+
<ClInclude Include="..\Include\internal\pycore_pyerrors.h">
226+
<Filter>Include</Filter>
227+
</ClInclude>
225228
<ClInclude Include="..\Include\internal\pycore_pyhash.h">
226229
<Filter>Include</Filter>
227230
</ClInclude>

0 commit comments

Comments
 (0)