[issue35275] Reading umask (thread-safe)

2018-11-19 Thread STINNER Victor
STINNER Victor added the comment: Ok, let's move to bpo-35276: "Document thread safety". -- ___ Python tracker ___ ___

[issue35275] Reading umask (thread-safe)

2018-11-19 Thread STINNER Victor
STINNER Victor added the comment: My own (incomplete) list of "process-wide states": https://vstinner.readthedocs.io/threads.html#process-wide -- ___ Python tracker ___

[issue35275] Reading umask (thread-safe)

2018-11-19 Thread STINNER Victor
STINNER Victor added the comment: Maybe the Python documentation can be enhanced to document functions which are known to have a side-effect "process-wide" vs "thread-safe" functions. For example, signal.pthread_sigmark() affects the current thread, wheras locale.setlocale() is

[issue35275] Reading umask (thread-safe)

2018-11-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is no thread way to read the umask in C as well. The os module provides thin wrappers to the POSIX API. os.umask() acts exactly as a C function umask(). If thread safe method be added in the POSIX API we can expose it in the os module. --

[issue35275] Reading umask (thread-safe)

2018-11-19 Thread Thomas Guettler
New submission from Thomas Guettler : Up to now there is no thread way to read the umask in Python https://stackoverflow.com/questions/53227072/reading-umask-thread-safe You can use this pattern: current_umask = os.umask(0) # line1 os.umask(current_umask) # line2 return current_umask