Skip to content

Commit 9333a09

Browse files
committed
Do not call openlog while calling syslog
1 parent c916872 commit 9333a09

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

Modules/syslogmodule.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,7 @@ syslog_syslog_impl(PyObject *module, int group_left_1, int priority,
203203
}
204204

205205
_syslog_state *state = get_syslog_state(module);
206-
PyObject *openlog_ret = syslog_openlog_impl(module, NULL, 0, LOG_USER);
207-
if (openlog_ret == NULL) {
208-
return NULL;
209-
}
210-
Py_DECREF(openlog_ret);
211-
212-
/* Incref ident, because it can be decrefed if syslog.openlog() is
213-
* called when the GIL is released.
214-
*/
215-
PyObject *ident = state->S_ident_o;
216-
Py_XINCREF(ident);
206+
state->S_log_open = 1;
217207
#ifdef __APPLE__
218208
// gh-98178: On macOS, libc syslog() is not thread-safe
219209
syslog(priority, "%s", message);
@@ -222,7 +212,6 @@ syslog_syslog_impl(PyObject *module, int group_left_1, int priority,
222212
syslog(priority, "%s", message);
223213
Py_END_ALLOW_THREADS;
224214
#endif
225-
Py_XDECREF(ident);
226215
Py_RETURN_NONE;
227216
}
228217

0 commit comments

Comments
 (0)