[issue22367] Please add F_OFD_SETLK, etc support to fcntl.lockf
New submission from Andrew Lutomirski: Linux 3.15 and newer support a vastly superior API for file locking, in which locks are owned by open file descriptions instead of by processes. This is how everyone seems to expect POSIX locks to work, but now they can finally work that way. Please add some interface to these locks to fcntl.lockf. One option would be to use them by default and to fall back to standard POSIX locks if they're not available. I don't know whether this would break existing code. See http://man7.org/linux/man-pages/man2/fcntl.2.html for details. -- components: Library (Lib) messages: 226610 nosy: Andrew.Lutomirski priority: normal severity: normal status: open title: Please add F_OFD_SETLK, etc support to fcntl.lockf type: enhancement versions: Python 2.7, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22367 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20371] datetime.datetime.replace bypasses a subclass's __new__
New submission from Andrew Lutomirski: I'll admit that what I'm doing is possibly unhealthy. Nonetheless, I find this behavior *extremely* surprising. This code: --- start code --- import datetime class my_dt(datetime.datetime): def __new__(cls, *args, **kwargs): print('In my_dt.__new__') return datetime.datetime.__new__(cls, *args, **kwargs) def __init__(self, *args, **kwargs): print('In my_dt.__init__') super(my_dt, self).__init__() dt = datetime.datetime.now() print('Create a my_dt') t = my_dt(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond, dt.tzinfo) print('Calling replace') t2 = t.replace(tzinfo=None) print('Got a %r' % type(t2)) --- end code --- results in: Create a my_dt In my_dt.__new__ In my_dt.__init__ Calling replace Got a class '__main__.my_dt' So datetime.datetime.replace will create an object of type my_dt *without calling __new__ or __init__*. This should (AFAIK) be impossible. I think that datetime.datetime.replace should either return an actual datetime object or that it should invoke __new__ and probably __init__. -- components: Library (Lib) messages: 208980 nosy: Andrew.Lutomirski priority: normal severity: normal status: open title: datetime.datetime.replace bypasses a subclass's __new__ versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20371 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20318] subprocess.Popen can hang in threaded applications
New submission from Andrew Lutomirski: Running python python_thread_bug.py -j4 often results in one of the threads failing to start until another thread finishes. The bug appears to be that subprocess's pipe_cloexec function is racy: if another thread forks between os.pipe() and _set_cloexec_flag, then the resulting process could hang on to the write end of the pipe. That will cause the Popen call that got rudely interrupted to wait until the whole resulting process tree dies. -- components: Library (Lib) files: python_thread_bug.py messages: 208577 nosy: Andrew.Lutomirski priority: normal severity: normal status: open title: subprocess.Popen can hang in threaded applications type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file33571/python_thread_bug.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20318 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20318] subprocess.Popen can hang in threaded applications
Andrew Lutomirski added the comment: Would it be worth adding something to the Python 2.7 subprocess docs indicating that subprocess is known to be broken? -- resolution: wont fix - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20318 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20318] subprocess.Popen can hang in threaded applications
Andrew Lutomirski added the comment: FWIW, sticking a mutex in Popen.__init__ (wrapping the whole thing) seems to work around this issue (for programs that aren't using multiprocessing or fork, for example). This might be a good-enough fix and be safe enough to stick in the standard library. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20318 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17246] cgitb fails when frame arguments are deleted (due to inspect bug I think)
New submission from Andrew Lutomirski: inspect.formatargvalues assumes (incorrectly) that every argument in args is a key in values. This isn't very hard to break -- see the attachment for a complete example. -- components: Library (Lib) files: test_cgitb.py messages: 182446 nosy: Andrew.Lutomirski priority: normal severity: normal status: open title: cgitb fails when frame arguments are deleted (due to inspect bug I think) versions: Python 2.7 Added file: http://bugs.python.org/file29125/test_cgitb.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17246 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com