New submission from Ole Streicher: On Debian Hurd, there is no sem_open implementation. When I try there to create a Queue, I get different errors, depending on the Python version:
import multiprocessing q = multiprocessing.Queue() gives on Python 2.7.9: maxsize = 0 def Queue(maxsize=0): ''' Returns a queue object ''' > from multiprocessing.queues import Queue /usr/lib/python2.7/multiprocessing/__init__.py:217: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __all__ = ['Queue', 'SimpleQueue', 'JoinableQueue'] import sys import os import threading import collections import time import atexit import weakref from Queue import Empty, Full import _multiprocessing from multiprocessing import Pipe > from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, > Condition /usr/lib/python2.7/multiprocessing/queues.py:48: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event' ] import threading import os import sys from time import time as _time, sleep as _sleep import _multiprocessing from multiprocessing.process import current_process from multiprocessing.util import Finalize, register_after_fork, debug from multiprocessing.forking import assert_spawning, Popen # Try to import the mp.synchronize module cleanly, if it fails # raise ImportError for platforms lacking a working sem_open implementation. # See issue 3770 try: from _multiprocessing import SemLock except (ImportError): raise ImportError("This platform lacks a functioning sem_open" + " implementation, therefore, the required" + " synchronization primitives needed will not" + > " function, see issue 3770.") E ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770. /usr/lib/python2.7/multiprocessing/synchronize.py:59: ImportError and on 3.4.2: self = <multiprocessing.context.DefaultContext object at 0x1449b0c>, maxsize = 0 def Queue(self, maxsize=0): '''Returns a queue object''' from .queues import Queue > return Queue(maxsize, ctx=self.get_context()) /usr/lib/python3.4/multiprocessing/context.py:101: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <multiprocessing.queues.Queue object at 0x511e8cc>, maxsize = 0 def __init__(self, maxsize=0, *, ctx): if maxsize <= 0: > maxsize = _multiprocessing.SemLock.SEM_VALUE_MAX E AttributeError: 'module' object has no attribute 'SemLock' /usr/lib/python3.4/multiprocessing/queues.py:38: AttributeError Both traces are actually copied from Debian build logs: 2.7.9: https://buildd.debian.org/status/fetch.php?pkg=python-astropy&arch=hurd-i386&ver=1.0~rc1-1&stamp=1422724845 3.4.2: https://buildd.debian.org/status/fetch.php?pkg=python-astropy&arch=hurd-i386&ver=1.0~rc1-2&stamp=1423153281 Neither for 2.7.9 nor for 3.4.2 this behaviour is documented. Also, I would expect to have a NotImplementedError and not an ImportError or an AttributeError in such a case. Please: * document the behaviour of multiprocessing.Queue() in the case of an absent sem_open for both Python2 and Python3 * Consider raising NotImplementedError or being consistent in some other way. ---------- components: Library (Lib) messages: 235474 nosy: olebole priority: normal severity: normal status: open title: Inconsistent behaviour of multiprocessing.Queue() if sem_open is not implemented type: behavior versions: Python 2.7, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23400> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com