This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients mark.dickinson
Date 2012-09-18.15:32:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347982368.75.0.56994107832.issue15966@psf.upfronthosting.co.za>
In-reply-to
Content
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):
        ...

to

    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=...).
History
Date User Action Args
2012-09-18 15:32:48mark.dickinsonsetrecipients: + mark.dickinson
2012-09-18 15:32:48mark.dickinsonsetmessageid: <1347982368.75.0.56994107832.issue15966@psf.upfronthosting.co.za>
2012-09-18 15:32:48mark.dickinsonlinkissue15966 messages
2012-09-18 15:32:47mark.dickinsoncreate