Skip to content

Commit 75cd5bf

Browse files
authored
Remove unused args from two pylifecycle.c functions (GH-18867)
* Remove unused tstate argument from init_set_builtins_open() * Replace fd (int) with tstate (PyThreadState *) in in _Py_FatalError_PrintExc()
1 parent c7d2d69 commit 75cd5bf

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Python/pylifecycle.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extern grammar _PyParser_Grammar; /* From graminit.c */
6565
/* Forward declarations */
6666
static PyStatus add_main_module(PyInterpreterState *interp);
6767
static PyStatus init_import_site(void);
68-
static PyStatus init_set_builtins_open(PyThreadState *tstate);
68+
static PyStatus init_set_builtins_open(void);
6969
static PyStatus init_sys_streams(PyThreadState *tstate);
7070
static PyStatus init_signals(PyThreadState *tstate);
7171
static void call_py_exitfuncs(PyThreadState *tstate);
@@ -1025,7 +1025,7 @@ init_interp_main(PyThreadState *tstate)
10251025
return status;
10261026
}
10271027

1028-
status = init_set_builtins_open(tstate);
1028+
status = init_set_builtins_open();
10291029
if (_PyStatus_EXCEPTION(status)) {
10301030
return status;
10311031
}
@@ -1888,7 +1888,7 @@ create_stdio(const PyConfig *config, PyObject* io,
18881888

18891889
/* Set builtins.open to io.OpenWrapper */
18901890
static PyStatus
1891-
init_set_builtins_open(PyThreadState *tstate)
1891+
init_set_builtins_open(void)
18921892
{
18931893
PyObject *iomod = NULL, *wrapper;
18941894
PyObject *bimod = NULL;
@@ -2056,9 +2056,8 @@ _Py_FatalError_DumpTracebacks(int fd, PyInterpreterState *interp,
20562056
Return 1 if the traceback was displayed, 0 otherwise. */
20572057

20582058
static int
2059-
_Py_FatalError_PrintExc(int fd)
2059+
_Py_FatalError_PrintExc(PyThreadState *tstate)
20602060
{
2061-
PyThreadState *tstate = _PyThreadState_GET();
20622061
PyObject *ferr, *res;
20632062
PyObject *exception, *v, *tb;
20642063
int has_tb;
@@ -2220,7 +2219,7 @@ fatal_error(const char *prefix, const char *msg, int status)
22202219
int has_tstate_and_gil = (tss_tstate != NULL && tss_tstate == tstate);
22212220
if (has_tstate_and_gil) {
22222221
/* If an exception is set, print the exception with its traceback */
2223-
if (!_Py_FatalError_PrintExc(fd)) {
2222+
if (!_Py_FatalError_PrintExc(tss_tstate)) {
22242223
/* No exception is set, or an exception is set without traceback */
22252224
_Py_FatalError_DumpTracebacks(fd, interp, tss_tstate);
22262225
}

0 commit comments

Comments
 (0)