[New-bugs-announce] [issue37294] ProcessPoolExecutor fails with super

Géry report at bugs.python.org
Sat Jun 15 13:49:58 EDT 2019


New submission from Géry <gery.ogam at gmail.com>:

The following code hangs forever instead of printing "called" 10 times:

    from concurrent.futures import ProcessPoolExecutor
    
    class A:
        def f(self):
            print("called")
    
    class B(A):
        def f(self):
            executor = ProcessPoolExecutor(max_workers=2)
            futures = [executor.submit(super(B, self).f)
                       for _ in range(10)]
    
    if __name__ == "__main__":
        B().f()

The same code with `super(B, self)` replaced with `super()` raises the following error:

> TypeError: super(type, obj): obj must be an instance or subtype of type

However, replacing `ProcessPoolExecutor` with `ThreadPoolExecutor` works  as expected, but only with `super(B, self)` (with `super()` it still raises the same error).

----------
components: Library (Lib)
messages: 345709
nosy: asvetlov, bquinlan, inada.naoki, lukasz.langa, maggyero, ned.deily, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: ProcessPoolExecutor fails with super
type: crash
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37294>
_______________________________________


More information about the New-bugs-announce mailing list