New submission from Anand B Pillai:

multiprocessing.Manager seems to have an inconsistency in 
behaviour/documentation or both.

The behaviour inconsistency is documented in the attached test script which 
should run for both Python2 and Python3. 

Briefly, multiprocessing.managers.BaseManager class starts a Python subprocess 
only after a call to its "start" method. Whereas its subclass, 
multiprocessing.managers.SyncManager does at the time of object creation. This 
is undocumented and against the base classe's documented behaviour.

Also, the SyncManager is more commonly advertised via the facade 
multiprocessing.Manager() which is again at odds with the BaseManager's 
interface in that,

1. It takes no arguments (Python2) and different arguments (Python 3).
2. You can't call "start" on it but you can call "start" if you initialize it 
via multiprocessing.managers.SyncManager directly (!)
3. Even if you can't call a start on it, apparently you can shut it down via a 
call to "shutdown"
4. When you try to start such a manager you get a strange AssertionError 
complaining the state is not INITIAL. A better error is required here.

Please find the attached file for all the sequence of tests done.

Suggested changes are,

1. Fix the inconsistency in documented behaviour between SyncManager and its 
base class. Either don't start the child process upon object creation or 
document it.
2. Fix the inconsistency in SyncManager object creation interface and behaviour 
via "mulitprocessing.Manager()" and directly via 
"multiprocessing.managers.SyncManager(...)" . One should be able to start both 
objects cleanly. And the former should also take the address argument. If not 
document it properly.
3. The AssertionError when trying to start the SyncManager object obtained via 
a call to "multiprocessing.Manager()" looks like a bug. It should be fixed - 
otherwise a bette error should be raised and documentation updated.

----------
assignee: docs@python
components: Documentation, Library (Lib)
files: mp_test.py
messages: 238379
nosy: docs@python, pythonhacker
priority: normal
severity: normal
status: open
title: Fix documentation for multiprocessing.Manager
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file38537/mp_test.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23698>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to