Message170650
| 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:48 | mark.dickinson | set | recipients:
+ mark.dickinson |
| 2012年09月18日 15:32:48 | mark.dickinson | set | messageid: <1347982368.75.0.56994107832.issue15966@psf.upfronthosting.co.za> |
| 2012年09月18日 15:32:48 | mark.dickinson | link | issue15966 messages |
| 2012年09月18日 15:32:47 | mark.dickinson | create |
|