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 guard aga
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
Paul Ollis added the comment:
Patch that fixes the issue.
--
Added file: http://bugs.python.org/file25216/patch01-code.diff
___
Python tracker
<http://bugs.python.org/issue14
Paul Ollis 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
<http://bugs.python.org/issue14
New submission from Paul Ollis :
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: Interpreter Core