[issue15805] Add stdout redirection tool to contextlib

2012-08-28 Thread Alex Gaynor
Alex Gaynor added the comment: Sounds like a special case of a small part of mock. Not sure that this observation is significant though. -- nosy: +alex ___ Python tracker ___ __

[issue15806] Add context manager for the "try: ... except: pass" pattern

2012-08-28 Thread Alex Gaynor
Changes by Alex Gaynor : -- nosy: +alex ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/

[issue15805] Add stdout redirection tool to contextlib

2012-08-28 Thread Nick Coghlan
Nick Coghlan added the comment: Sure, but by targeting a specific use case you can make it really trivial to use. -- ___ Python tracker ___ _

[issue15806] Add context manager for the "try: ... except: pass" pattern

2012-08-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: Hmm, the __exit__ method was doing exact matches by exception type, so KeyError wouldn't match LookupError or Exception. There are probably a number of ways to fix this, but it may be easiest to use the builtin exception catching mechanisms: class Ignore:

[issue15806] Add context manager for the "try: ... except: pass" pattern

2012-08-28 Thread Alex Gaynor
Alex Gaynor added the comment: Why not just: issubclass(exctype, self.exception_types)? -- ___ Python tracker ___ ___ Python-bugs-list

[issue15806] Add context manager for the "try: ... except: pass" pattern

2012-08-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: Yes, something along those lines would be *much* better: class Ignore: ''' Context manager to ignore particular exceptions''' def __init__(self, *ignored_exceptions): self.ignored_exceptions = ignored_exceptions def __enter__(self):

[issue15806] Add context manager for the "try: ... except: pass" pattern

2012-08-28 Thread Nick Coghlan
Nick Coghlan added the comment: I'd just write it with @contextmanager. Making it easier to cleanly factor out exception handling is one of the main reasons that exists. @contextmanager def ignored(*exceptions): """Context manager to ignore particular exceptions""" try: yiel

[issue15806] Add context manager for the "try: ... except: pass" pattern

2012-08-28 Thread Chris Jerdonek
Changes by Chris Jerdonek : -- nosy: +cjerdonek ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyt

[issue15804] Feature request, implicit "except : pass"

2012-08-28 Thread Ezio Melotti
Changes by Ezio Melotti : -- stage: -> committed/rejected ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue15798] subprocess.Popen() fails if 0, 1 or 2 descriptor is closed

2012-08-28 Thread Ross Lagerwall
Ross Lagerwall added the comment: It's caused by the following check in _posixsubprocess.c: if (close_fds && errpipe_write < 3) { /* precondition */ PyErr_SetString(PyExc_ValueError, "errpipe_write must be >= 3"); return NULL; } which was written by Gregory P. Smith in 2

<    1   2