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
os.O_SHLOCK and os.O_EXLOCK are not available on Linux #67294
Comments
From the documentation: "
" But os.O_SHLOCK and os.O_EXLOCK are not available on my system (Linux 3.16.7-ckt1 x86_64): sworddragon@ubuntu:~$ python3
Python 3.4.2 (default, Dec 4 2014, 09:34:20)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.O_SHLOCK
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'O_SHLOCK'
>>> os.O_EXLOCK
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'O_EXLOCK'
>>> exit() |
The documentation says "Some of them are not available on all platforms. For descriptions of their availability and use, consult the open(2) manual page on Unix or the MSDN on Windows.". The important bit there being "consult the open(2) manual page on Unix" for availability. That said, since the options are grouped and labeled with per-platform availability...but with a slightly different meaning of the word platform...I think the docs could be clarified. Do you have a suggestion for rewording that sentence to make it clearer? |
I have missed the first part of the documentation and am not sure if something needs really to be changed. But if you think so maybe comments like "These constants are only available on Unix." could be extended by the word "commonly" like "These constants are commonly only available on Unix.". |
If you read the documentation from glibc-2.24, these options are only available on BSD and not on Linux. """ Macro: int O_SHLOCK If O_CREAT is specified, the locking is done atomically when creating the file. You are guaranteed that no other process will get the lock on the new file first. Macro: int O_EXLOCK With my fedora 24, and glibc 2.23 I don't find any reference to these macros. |
Link to the documentation of glibc: http://www.gnu.org/software/libc/manual/html_node/Open_002dtime-Flags.html |
I am working on it. |
patch for 3.6 with the comment of Sworddragon. |
If we decide to word it this way eventually the sentence for "Windows only" needs to be updated too. Not sure about the other sentences as they sound a bit if they would guarantee what they say. Maybe somebody else knows more. |
Which sentence with "Windows only" ? Thanks |
Maybe it sounded a bit confusing but this text was not to be meant as a direct match against the documentation. |
The existing docs have a section "These constants are GNU extensions and not present if they are not defined by the C library." There could be a corresponding section for BSD extensions to which O_EXLOCK and O_SHLOCK are moved, or the word "GNU" can removed from the existing section and these two flags moved to it. How does that sound? My preference would be for the latter. |
New changeset 5ca4c545dfe4 by Vinay Sajip in branch '2.7': New changeset f1427491a8a5 by Vinay Sajip in branch '3.5': New changeset 64610bcd326f by Vinay Sajip in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: