Permalink
Browse files

BUG: restore Python 3 compat

  • Loading branch information...
1 parent 73dbeff commit 88fc3680f9dc5fe0e7c0db1d8937d9a345f4929d @GaelVaroquaux GaelVaroquaux committed Jan 19, 2012
Showing with 10 additions and 5 deletions.
  1. +6 −3 joblib/test/test_parallel.py
  2. +4 −2 sphinx_pypi_upload.py
@@ -82,7 +82,9 @@ def test_simple_parallel():
delayed(square)(x) for x in X)
Parallel(n_jobs=2, verbose=verbose, pre_dispatch=2)(
delayed(square)(x) for x in X)
- except Exception, e:
+ except Exception:
+ # Cannot use 'except as' to maintain Python 2.5 compatibility
+ e = sys.exc_info()[1]
print sys.stdout.getvalue()
print sys.stderr.getvalue()
raise e
@@ -150,8 +152,9 @@ def test_error_capture():
ex = JoblibException
Parallel(n_jobs=1)(
delayed(division)(x, y) for x, y in zip((0, 1), (1, 0)))
- except Exception, e:
- ex = e
+ except Exception:
+ # Cannot use 'except as' to maintain Python 2.5 compatibility
+ ex = sys.exc_info()[1]
nose.tools.assert_false(isinstance(ex, JoblibException))
View
@@ -13,7 +13,7 @@
Modified for joblib by Gael Varoquaux
"""
-
+import sys
import os
import socket
try:
@@ -120,7 +120,9 @@ def upload(self, filename):
http.putheader('Authorization', auth)
http.endheaders()
http.send(body)
- except socket.error, e:
+ except socket.error:
+ # Cannot use 'except as' to maintain Python 2.5 compatibility
+ e = sys.exc_info()[1]
self.announce(str(e), log.ERROR)
return

0 comments on commit 88fc368

Please sign in to comment.