[issue5001] Remove assertion-based checking in multiprocessing

Jesse Noller report at bugs.python.org
Mon Jan 19 17:32:42 CET 2009


New submission from Jesse Noller <jnoller at gmail.com>:

Right now, the multiprocessing code is littered with statements like:

        assert self._popen is None, 'cannot start a process twice'
        assert self._parent_pid == os.getpid(), \
               'can only start a process object created by current 
process'
        assert not _current_process._daemonic, \
               'daemonic processes are not allowed to have children'

These will obviously be stripped out if running in optimized mode - 
however its not cool to rely on these anyway, the code should be 
refactored to proper checks, e.g.:

    if not hasattr(lock, 'acquire'):
        raise AttributeError("'%r' has no method 'acquire'" % lock)

----------
assignee: jnoller
components: Library (Lib)
messages: 80192
nosy: jnoller
priority: normal
severity: normal
status: open
title: Remove assertion-based checking in multiprocessing
versions: Python 2.7, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5001>
_______________________________________


More information about the Python-bugs-list mailing list