barryp / py-amqplib

Python client for the Advanced Message Queuing Procotol (AMQP)
GNU Lesser General Public License v2.1
24 stars 10 forks source link

Python3 compatibility: raised exception #54

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Due to a difference in exceptions between python3 and python2 the py2to3 
doesn't do a perfect job.
http://docs.python.org/py3k/howto/pyporting.html#capturing-the-currently-raised-
exception

Fix is below. Basically stores the exception explicitly instead of leaking it.

--- transport.py    2012-10-04 10:34:36.737574933 +0200
+++ transport_fixed.py  2012-10-04 10:35:17.377255648 +0200
@@ -74,7 +74,8 @@
                 self.sock = socket.socket(af, socktype, proto)
                 self.sock.settimeout(connect_timeout)
                 self.sock.connect(sa)
-            except socket.error, msg:
+            except socket.error, msg_in:
+                msg=msg_in
                 self.sock.close()
                 self.sock = None
                 continue

Original issue reported on code.google.com by killian....@megasoft.be on 4 Oct 2012 at 8:39

GoogleCodeExporter commented 9 years ago
Oeps duplicate of https://code.google.com/p/py-amqplib/issues/detail?id=47

Original comment by killian....@megasoft.be on 4 Oct 2012 at 8:40