[issue39318] NamedTemporaryFile could cause double-close on an fd if _TemporaryFileWrapper throws

2020-01-16 Thread Paul Ollis
Paul Ollis added the comment: > I thought that if this raises a (normal) exception, it always means that it > did not have overtaken the `fd`, i.e. never results in an unreferenced file > object which has taken ownership of `fd`. The current CPython implementation does not guar

[issue39318] NamedTemporaryFile could cause double-close on an fd if _TemporaryFileWrapper throws

2020-01-15 Thread Paul Ollis
Paul Ollis added the comment: I think it is worth pointing out that the semantics of f = ``open(fd, closefd=True)`` are broken (IMHO) because an exception can result in an unreferenced file object that has taken over reponsibility for closing the fd, but it can also fail without

[issue14580] imp.reload can fail for sub-modules

2012-04-14 Thread Paul Ollis
New submission from Paul Ollis pyt...@ollis.me.uk: Code like this:: import collections.abc imp.reload(collections.abc) Raises the following exception: SystemError: Negative size passed to PyUnicode_New This occurs on the latest mercurial checkout (76302). -- components

[issue14580] imp.reload can fail for sub-modules

2012-04-14 Thread Paul Ollis
Paul Ollis pyt...@ollis.me.uk added the comment: Patch adding a test to reproduce the issue. -- keywords: +patch Added file: http://bugs.python.org/file25215/patch01-tests.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue14580] imp.reload can fail for sub-modules

2012-04-14 Thread Paul Ollis
Paul Ollis pyt...@ollis.me.uk added the comment: Patch that fixes the issue. -- Added file: http://bugs.python.org/file25216/patch01-code.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14580