[issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does.

2014-07-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 379aad232000 by Victor Stinner in branch '3.4':
Issue #11453, #18174: Fix leak of file descriptor in test_asyncore
http://hg.python.org/cpython/rev/379aad232000

New changeset 0ced2d2325fb by Victor Stinner in branch 'default':
(Merge 3.4) Issue #11453, #18174: Fix leak of file descriptor in test_asyncore
http://hg.python.org/cpython/rev/0ced2d2325fb

--

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



[issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does.

2014-06-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ae12a926e680 by Victor Stinner in branch '3.4':
Issue #11453: asyncore: emit a ResourceWarning when an unclosed file_wrapper
http://hg.python.org/cpython/rev/ae12a926e680

--
nosy: +python-dev

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



[issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does.

2014-06-27 Thread STINNER Victor

STINNER Victor added the comment:

I fixed the issue in Python 3.4 and 3.5, thanks for the report.

In Python 3.4+, it's safe to add a destructor (__del__ method): even if the 
object is part of a reference cycle, it will be destroyed. It's not the case in 
Python 2.7. I prefer to leave Python 2.7 unchanged to limit the risk of 
regression.

--
nosy: +haypo
resolution:  - fixed
status: open - closed
versions: +Python 3.4, Python 3.5 -Python 2.7, Python 3.2, Python 3.3

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



[issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does.

2014-06-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7c9335d97628 by Victor Stinner in branch 'default':
(Merge 3.4) Issue #11453: asyncore: emit a ResourceWarning when an unclosed
http://hg.python.org/cpython/rev/7c9335d97628

--

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



[issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does.

2011-06-01 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
versions:  -Python 2.5, Python 2.6, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11453
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does.

2011-06-01 Thread Aldona Majorek

Aldona Majorek amajo...@google.com added the comment:

Adding __exit__ will not make asyncore.file_wrapper close file descriptor when 
garbage collected.

Here is clone of socket.py solution for the same problem.

  def close(self):
if self.fd:
  os.close(self.fd)
  self.fd = None # or maybe self.fd = 0 will be better

  def __del__(self):
try:
  self.close()
except:
  # close() may fail if __init__ didn't complete
  pass

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11453
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does.

2011-03-15 Thread Ben Hayden

Ben Hayden hayden...@gmail.com added the comment:

Adding a patch that adds an __exit__ function much like the one that 
socket.socket implements. Passes the test_asyncore  also doesn't raise a 
resource warning when I explicitly comment out some close() calls on file 
wrapper objects in the test.

--
keywords: +patch
nosy: +beardedp
Added file: http://bugs.python.org/file21236/issue11453.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11453
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does.

2011-03-10 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11453
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does.

2011-03-09 Thread Aldona Majorek

New submission from Aldona Majorek pyt...@ada.majorek.org:

asyncore.file_wrapper duplicates file descriptor of given file and closes it in 
it's close method.

But unlike socket.socket class it does not automatically call close when object 
is garbage collected.

Users of regular sockets and asyncore.dispatcher do not experience resource 
leaks when they forget to call self.close() in handle_close().

But people using file_dispatcher do loose file descriptor every time 
file_wrapper object is garbage collected without calling self.close() first.

--
components: Library (Lib)
messages: 130458
nosy: amajorek
priority: normal
severity: normal
status: open
title: asyncore.file_wrapper should implement __del__ and call close there to 
prevent resource leaks and behave like socket.socket does.
type: resource usage
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11453
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com