Skip to content

Commit

Permalink
Do not call openlog while calling syslog
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed Nov 5, 2022
1 parent c916872 commit 6a76772
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions Modules/syslogmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,6 @@ syslog_syslog_impl(PyObject *module, int group_left_1, int priority,
}

_syslog_state *state = get_syslog_state(module);
PyObject *openlog_ret = syslog_openlog_impl(module, NULL, 0, LOG_USER);
if (openlog_ret == NULL) {
return NULL;
}
Py_DECREF(openlog_ret);

/* Incref ident, because it can be decrefed if syslog.openlog() is
* called when the GIL is released.
*/
PyObject *ident = state->S_ident_o;
Py_XINCREF(ident);
#ifdef __APPLE__
// gh-98178: On macOS, libc syslog() is not thread-safe
syslog(priority, "%s", message);
Expand All @@ -222,7 +211,7 @@ syslog_syslog_impl(PyObject *module, int group_left_1, int priority,
syslog(priority, "%s", message);
Py_END_ALLOW_THREADS;
#endif
Py_XDECREF(ident);
state->S_log_open = 1;
Py_RETURN_NONE;
}

Expand Down

0 comments on commit 6a76772

Please sign in to comment.