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 lev-veshnyakov
Recipients lev-veshnyakov
Date 2016-11-15.18:22:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479234139.82.0.483433491582.issue28699@psf.upfronthosting.co.za>
In-reply-to
Content
Consider the following code:

from multiprocessing.pool import ThreadPool

pool = ThreadPool(10)

def gen():
    yield 1 + '1' # here is an error

print(list(pool.imap(str, gen()))) # prints []
print(list(pool.map(str, gen()))) # raises TypeError

The difference is, that the line with imap prints an empty list, while the line with map raises an exception, as expected.

Change the above snippet of code, adding additional yield statement:

from multiprocessing.pool import ThreadPool

pool = ThreadPool(10)

def gen():
    yield 1
    yield 1 + '1' # here is an error

print(list(pool.imap(str, gen()))) # raises TypeError
print(list(pool.map(str, gen()))) # also would raise TypeError

So now both map and imap will raise the exception, as expected. Therefore I suppose the behavior of imap showed in the first case is wrong.
History
Date User Action Args
2016-11-15 18:22:19lev-veshnyakovsetrecipients: + lev-veshnyakov
2016-11-15 18:22:19lev-veshnyakovsetmessageid: <1479234139.82.0.483433491582.issue28699@psf.upfronthosting.co.za>
2016-11-15 18:22:19lev-veshnyakovlinkissue28699 messages
2016-11-15 18:22:19lev-veshnyakovcreate