Skip to content

Commit 6a76772

Browse files
committed
Do not call openlog while calling syslog
1 parent c916872 commit 6a76772

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

Modules/syslogmodule.c

+1-12
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,6 @@ 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);
217206
#ifdef __APPLE__
218207
// gh-98178: On macOS, libc syslog() is not thread-safe
219208
syslog(priority, "%s", message);
@@ -222,7 +211,7 @@ syslog_syslog_impl(PyObject *module, int group_left_1, int priority,
222211
syslog(priority, "%s", message);
223212
Py_END_ALLOW_THREADS;
224213
#endif
225-
Py_XDECREF(ident);
214+
state->S_log_open = 1;
226215
Py_RETURN_NONE;
227216
}
228217

0 commit comments

Comments
 (0)