[New-bugs-announce] [issue15966] concurrent.futures: Executor.submit keyword arguments may not be called 'fn' (or 'self')
report at bugs.python.org
Tue Sep 18 17:32:48 CEST 2012
New submission from Mark Dickinson:
The submit methods of concurrent.futures.ThreadPoolExecutor and concurrent.futures.ProcessPoolExectutor raise TypeError when submitting a callable with a keyword argument named 'fn' or 'self':
Python 3.3.0rc2+ (default:3a880d640981, Sep 18 2012, 16:29:28)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import concurrent.futures
>>> def awkward(*, fn): return fn * 1729
>>> with concurrent.futures.ThreadPoolExecutor(1) as e:
... e.submit(awkward, fn=3)
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: submit() got multiple values for argument 'fn'
An obvious solution is to change the declarations of the submit methods from:
def submit(self, fn, *args, **kwargs):
def submit(*args, **kwargs):
self, fn, *args = args
I don't think this is quite good enough, since it'll introduce a regression for anyone who was doing executor.submit(fn=...).
title: concurrent.futures: Executor.submit keyword arguments may not be called 'fn' (or 'self')
versions: Python 3.2, Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce