[issue24763] asyncio.BaseSubprocessTransport triggers an unavoidable ResourceWarning if process doesn't start

2015-08-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 26483248 by Yury Selivanov in branch '3.4':
Issue #24763: Fix asyncio test on Windows (fix reverted change)
https://hg.python.org/cpython/rev/26483248

New changeset aa527ee0d27f by Yury Selivanov in branch '3.5':
Merge 3.4 (issues #24835, #24763)
https://hg.python.org/cpython/rev/aa527ee0d27f

New changeset f304ba9425a3 by Yury Selivanov in branch 'default':
Merge 3.5 (issues #24835, #24763)
https://hg.python.org/cpython/rev/f304ba9425a3

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24763] asyncio.BaseSubprocessTransport triggers an unavoidable ResourceWarning if process doesn't start

2015-07-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6703ac68bf49 by Victor Stinner in branch '3.4':
Issue #24763: Fix asyncio test on Windows
https://hg.python.org/cpython/rev/6703ac68bf49

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24763] asyncio.BaseSubprocessTransport triggers an unavoidable ResourceWarning if process doesn't start

2015-07-31 Thread STINNER Victor

STINNER Victor added the comment:

I applied your patch + my patch to Python 3.4, 3.5 and 3.6 and asyncio at 
Github. Thanks for the report and the patch Martin!

--
resolution:  -> fixed
status: open -> closed
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24763] asyncio.BaseSubprocessTransport triggers an unavoidable ResourceWarning if process doesn't start

2015-07-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f6b8a0c6b8c9 by Victor Stinner in branch '3.4':
Fix ResourceWarning in asyncio.BaseSubprocessTransport
https://hg.python.org/cpython/rev/f6b8a0c6b8c9

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24763] asyncio.BaseSubprocessTransport triggers an unavoidable ResourceWarning if process doesn't start

2015-07-31 Thread STINNER Victor

STINNER Victor added the comment:

popen_error_close.patch: I put more code in the try block to ensure that the 
transport is close on any kind of error, and I added an unit test.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24763] asyncio.BaseSubprocessTransport triggers an unavoidable ResourceWarning if process doesn't start

2015-07-31 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file40083/popen_error_close.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24763] asyncio.BaseSubprocessTransport triggers an unavoidable ResourceWarning if process doesn't start

2015-07-31 Thread Martin Richard

New submission from Martin Richard:

An exception can be raised in SubprocessTransport.__init__() from 
SubprocessTransport._start() - for instance because an exception is raised in 
the preexec_fn callback.

In this case, the calling function never gets a reference to the transport 
object, and cannot close the transport. Hence, when the object is deleted, an 
"unclosed transport" ResourceWarning is always triggered.

Here is a test case showing this behavior:
import asyncio

loop = asyncio.get_event_loop()
try:
loop.run_until_complete(asyncio.create_subprocess_exec('/doesntexist'))
except FileNotFoundError:
pass
finally:
loop.close()


I propose the attached patch as a solution, which call 
SubprocessTransport.close() when an exception is raised in 
SubprocessTransport._start() in the constructor.

--
components: asyncio
files: transport_close_when_exception_init.patch
keywords: patch
messages: 247746
nosy: gvanrossum, haypo, martius, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.BaseSubprocessTransport triggers an unavoidable ResourceWarning 
if process doesn't start
type: resource usage
versions: Python 3.4, Python 3.5
Added file: 
http://bugs.python.org/file40082/transport_close_when_exception_init.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com