Skip to content

Commit c1e08b7

Browse files
authored
Merge pull request #229 from IlyaSkriblovsky/distinct-autoreconnect-instances
Do not reuse exception instances
2 parents af42461 + c45caae commit c1e08b7

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

docs/source/NEWS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Bugfixes
1111
^^^^^^^^
1212

1313
- Fixed compatibility of `Collection.aggregate()` with PyMongo 3.6
14+
- AutoReconnect exceptions may give invalid stack traces when not handled
1415

1516
Features
1617
^^^^^^^^

txmongo/protocol.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,14 @@ def connectionLost(self, reason=connectionDone):
323323
# too late.
324324
self.factory.setInstance(None, reason)
325325

326-
auto_reconnect = AutoReconnect("TxMongo lost connection to MongoDB.")
327-
328326
if self.__deferreds:
329327
deferreds, self.__deferreds = self.__deferreds, {}
330328
for df in deferreds.values():
331-
df.errback(auto_reconnect)
329+
df.errback(AutoReconnect("TxMongo lost connection to MongoDB."))
332330
deferreds, self.__connection_ready = self.__connection_ready, []
333331
if deferreds:
334332
for df in deferreds:
335-
df.errback(auto_reconnect)
333+
df.errback(AutoReconnect("TxMongo lost connection to MongoDB."))
336334

337335
protocol.Protocol.connectionLost(self, reason)
338336

0 commit comments

Comments
 (0)