-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-99127: Allow some features of syslog to the main interpreter only #99128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ced41bc
8beb461
d8acc8b
11d9228
e7408a8
69ac18a
3a784f6
f5cf63a
fc85827
f40d953
35bbac2
525a32b
741baf0
779a3d2
557578f
01334e8
4ad2b8f
696196d
5eeade5
fb81c1e
140366b
c961709
e8dce88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,6 +295,13 @@ sys | |
| with contributions from Gregory P. Smith [Google] and Mark Shannon | ||
| in :gh:`96123`.) | ||
|
|
||
| syslog | ||
| ------ | ||
|
|
||
| * :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. | ||
| (Contributed by Dong-hee Na in :gh:`99127`.) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hum, I think that the "Porting to Python 3.12" is a better section for these changes. The "syslog" section is more for new features.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can syslog.syslog only be used when the main interpreter has called syslog.openlog? That's a restriction that is not present in the underlying library.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ronaldoussoren cc @ericsnowcurrently
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Calling openlog (and closelog) is optional in syslog(3) with sensible defaults. There is no need to call openlog at all unless a program wants to change some of the default settings, and that could be done outside of the Python world. For a use-case like embedding Python in a web server (like mod_python it is more likely that the embedding program does the syslog setup than that this is done in Python code.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In summary for your suggestion might be:
But if the subinterpreter calls
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two factors here:
Regarding the first one, this is perhaps something that we need not be so strict about. In Python, "app" means the Regarding the second factor, we have been (and still are) working hard to get interpreters isolated from one another, especially to avoid problems that arise when they step on each others' toes. [1] (Isolation also provides new implementation opportunities.) For example, an object created in one interpreter should never be modified (even just the refcount) by another interpreter. [2] In the case of syslog, the object in the static variable (set in
Obviously we went with the simplest form of the first one. On top of the existing isolation concerns, there are additional ones that become more complicated under a per-interpreter GIL due to thread-safety. These are a non-issue if we restrict to a per-interpreter GIL. [1] Such problems would be amplified by a per-interpreter GIL (see PEP 684, which has not been accepted yet), but they still exist even now.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regardless, if the concern is backward compatibility, we can easily apply the restriction only if the subinterpreter was created via
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
FWIW, both concerns are valid, but pre-date this PR. |
||
|
|
||
|
|
||
| Optimizations | ||
| ============= | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.