Skip to content
Merged
Show file tree
Hide file tree
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
Apply suggestions from code review
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
  • Loading branch information
corona10 and ericsnowcurrently authored Nov 18, 2022
commit e8dce888766f52834b1d6fc5b943a58bdf7482af
21 changes: 15 additions & 6 deletions Doc/library/syslog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ The module defines the following functions:
implementation to call ``openlog()``.

.. versionchanged:: 3.12
Subinterpreters are allowed to call only if the main interpreter already called :func:`openlog`.
If not, it will raise :exc:`RuntimeError`.
This function is restricted in subinterpreters.
(Only code that runs in multiple interpreters is affected and
the restriction is not relevant for most users.)
:func:`openlog` must be called in the main interpreter before :func:`syslog` may be used
in a subinterpreter. Otherwise it will raise :exc:`RuntimeError`.


.. function:: openlog([ident[, logoption[, facility]]])
Expand All @@ -65,8 +68,11 @@ The module defines the following functions:
required.

.. versionchanged:: 3.12
Only the main interpreter is allowed to call. It will raise :exc:`RuntimeError`
if subinterpreters call :func:`openlog`.
This function is restricted in subinterpreters.
(Only code that runs in multiple interpreters is affected and
the restriction is not relevant for most users.)
This may only be called in the main interpreter.
It will raise :exc:`RuntimeError` if called in a subinterpreter.


.. function:: closelog()
Expand All @@ -81,8 +87,11 @@ The module defines the following functions:
.. audit-event:: syslog.closelog "" syslog.closelog

.. versionchanged:: 3.12
Only the main interpreter is allowed to call. It will raise :exc:`RuntimeError`
if subinterpreters call :func:`closelog`.
This function is restricted in subinterpreters.
(Only code that runs in multiple interpreters is affected and
the restriction is not relevant for most users.)
This may only be called in the main interpreter.
It will raise :exc:`RuntimeError` if called in a subinterpreter.


.. function:: setlogmask(maskpri)
Expand Down
9 changes: 7 additions & 2 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,13 @@ Changes in the Python API
:class:`bytes` type is accepted for bytes strings.
(Contributed by Victor Stinner in :gh:`98393`.)

* :func:`syslog.openlog` and :func:`syslog.closelog` are only available from the main interpreter not subinterpreter.
:func:`syslog.syslog` is only available to subinterpreters if :func:`syslog.openlog` was already called from the main interpreter.
* :func:`syslog.openlog` and :func:`syslog.closelog` now fail if used in subinterpreters.
:func:`syslog.syslog` may still be used in subinterpreters,
but now only if :func:`syslog.openlog` has already been called in the main interpreter.
These new restrictions do not apply to the main interpreter,
so only a very small set of users might be affected.
This change helps with interpreter isolation. Furthermore, :mod:`syslog` is a wrapper
around process-global resources, which are best managed from the main interpreter.
(Contributed by Dong-hee Na in :gh:`99127`.)


Expand Down