diff options
author | Ionel Cristian Mărieș <contact@ionelmc.ro> | 2014-03-05 02:08:49 +0200 |
---|---|---|
committer | Ionel Cristian Mărieș <contact@ionelmc.ro> | 2014-03-05 02:08:58 +0200 |
commit | 901133676eccf51d973c802c7de7f1d966b00160 (patch) | |
tree | fe221902cba05455b79f7ef73f6926ba8a9e3ad2 /README.rst | |
parent | 2f5292c5b772b35431b1787ea961169b91d5faae (diff) |
Expand the comments a bit.
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -233,11 +233,12 @@ How's this useful ? Imagine you're using multiprocessing like this:: >>> import traceback >>> from multiprocessing import Pool - >>> import multiprocessing.pool >>> from examples import func_a - >>> # Undo the fix for http://bugs.python.org/issue13831 so that we can - >>> # see the effects of our change. - >>> multiprocessing.pool.ExceptionWithTraceback = lambda e, t: e + >>> if sys.version_info[:2] == (3, 4): + ... import multiprocessing.pool + ... # Undo the fix for http://bugs.python.org/issue13831 so that we can see the effects of our change. + ... # because Python 3.4 will show the remote traceback (but as a string sadly) + ... multiprocessing.pool.ExceptionWithTraceback = lambda e, t: e >>> pool = Pool() >>> try: ... for i in pool.map(func_a, range(5)): @@ -246,7 +247,7 @@ How's this useful ? Imagine you're using multiprocessing like this:: ... print(traceback.format_exc()) ... Traceback (most recent call last): - File "<doctest README.rst[38]>", line 2, in <module> + File "<doctest README.rst[...]>", line 2, in <module> for i in pool.map(func_a, range(5)): File "...multiprocessing...pool.py", line ..., in map ... @@ -271,7 +272,7 @@ Not very useful is it? Let's sort this out:: ... print(traceback.format_exc()) ... Traceback (most recent call last): - File "<doctest README.rst[43]>", line 4, in <module> + File "<doctest README.rst[...]>", line 4, in <module> i.reraise() File "...tblib...decorators.py", line ..., in reraise reraise(self.exc_type, self.exc_value, self.traceback) @@ -317,13 +318,13 @@ What if we have a local call stack ? ... except: ... print(traceback.format_exc()) Traceback (most recent call last): - File "<doctest README.rst[48]>", line 2, in <module> + File "<doctest README.rst[...]>", line 2, in <module> local_2() - File "<doctest README.rst[47]>", line 2, in local_2 + File "<doctest README.rst[...]>", line 2, in local_2 local_1() - File "<doctest README.rst[46]>", line 2, in local_1 + File "<doctest README.rst[...]>", line 2, in local_1 local_0() - File "<doctest README.rst[45]>", line 5, in local_0 + File "<doctest README.rst[...]>", line 5, in local_0 i.reraise() File "...tblib...decorators.py", line 19, in reraise reraise(self.exc_type, self.exc_value, self.traceback) @@ -347,4 +348,3 @@ Credits ======= * `mitsuhiko/jinja2 <https://github.com/mitsuhiko/jinja2>`_ for figuring a way to create traceback objects. - |