Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert some logic
  • Loading branch information
corona10 committed Nov 12, 2022
commit 557578f85b2082256b13dbf6499d98cb8f3f45d1
8 changes: 7 additions & 1 deletion Modules/syslogmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ syslog_syslog_impl(PyObject *module, int group_left_1, int priority,
}
Py_DECREF(openlog_ret);
}

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

Expand Down