Skip to content

Commit c226b4f

Browse files
committed
PYTHON-939 - AttributeError during shutdown.
I was treating a weakref.ref as if it were a weakref.proxy.
1 parent 5fcc5c7 commit c226b4f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pymongo/periodic_executor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@ def _shutdown_executors():
135135

136136
# First signal all executors to close...
137137
for ref in executors:
138-
try:
139-
ref().close()
140-
except ReferenceError:
141-
pass
138+
executor = ref()
139+
if executor:
140+
executor.close()
142141

143142
# ...then try to join them.
144143
for ref in executors:
145-
try:
146-
ref().join(1)
147-
except ReferenceError:
148-
pass
144+
executor = ref()
145+
if executor:
146+
executor.join(1)
147+
148+
executor = None
149149

150150
atexit.register(_shutdown_executors)

0 commit comments

Comments
 (0)