classification
Title: Use context manager protocol for more multiprocessing types
Type: enhancement Stage: resolved
Components: Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: dan.oreilly, ned.deily, python-dev, sbt, tshepang
Priority: normal Keywords:

Created on 2012-06-14 12:13 by sbt, last changed 2015-04-28 01:38 by ned.deily. This issue is now closed.

Messages (5)
msg162776 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-06-14 12:13
There are some types which should support the context manager protocol:

- connection objects
- listener objects
- pool objects
msg163107 - (view) Author: Roundup Robot (python-dev) Date: 2012-06-18 16:55
New changeset 6d2a773d8e00 by Richard Oudkerk in branch 'default':
Issue #15064: Implement context manager protocol for multiprocessing types
http://hg.python.org/cpython/rev/6d2a773d8e00
msg163119 - (view) Author: Roundup Robot (python-dev) Date: 2012-06-18 20:31
New changeset 198382b4bcd0 by Richard Oudkerk in branch 'default':
Issue #15064: Make BaseManager.__enter__() start server if necessary.
http://hg.python.org/cpython/rev/198382b4bcd0

New changeset 836d712461b3 by Richard Oudkerk in branch 'default':
Issue #15064: Use with-blocks for some examples in docs.
http://hg.python.org/cpython/rev/836d712461b3
msg242120 - (view) Author: Dan O'Reilly (dan.oreilly) * Date: 2015-04-27 15:07
It's probably too late to do anything about this now, but wouldn't it make more sense for `Pool.__exit__` to call `close`, rather than `terminate`? The vast majority of the time, that's probably what the user of the `Pool` would want to run. It also would make the behavior consistent with `concurrent.futures.ProcessPoolExecutor`, which will always wait for pending tasks to complete before exiting the `with` block.
msg242162 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-04-28 01:38
Dan, this issue was closed and the code associated with it released a few years ago.  Comments here will likely be ignored.  If you want to pursue your suggestion, please open a new issue for it.
History
Date User Action Args
2015-04-28 01:38:05ned.deilysetnosy: + ned.deily
messages: + msg242162
2015-04-27 15:07:10dan.oreillysetnosy: + dan.oreilly
messages: + msg242120
2012-06-19 13:20:14sbtsetstatus: open -> closed
title: multiprocessing should use more context manager -> Use context manager protocol for more multiprocessing types
resolution: fixed
stage: needs patch -> resolved
2012-06-18 20:31:54python-devsetmessages: + msg163119
2012-06-18 16:55:39python-devsetnosy: + python-dev
messages: + msg163107
2012-06-15 16:27:03tshepangsetnosy: + tshepang
2012-06-14 12:13:45sbtcreate