Preventing problems possibly introduced by r14662

acquire a lock before entering a try block that ends with the lock's
release. Thanks for the catch Alex.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14668 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Honza Král 2010-11-21 17:34:21 +00:00
parent 65b380e74a
commit aee9db9b3e
1 changed files with 3 additions and 3 deletions

View File

@ -99,8 +99,8 @@ class Signal(object):
if weak:
receiver = saferef.safeRef(receiver, onDelete=self._remove_receiver)
self.lock.acquire()
try:
self.lock.acquire()
for r_key, _ in self.receivers:
if r_key == lookup_key:
break
@ -136,8 +136,8 @@ class Signal(object):
else:
lookup_key = (_make_id(receiver), _make_id(sender))
self.lock.acquire()
try:
self.lock.acquire()
for index in xrange(len(self.receivers)):
(r_key, _) = self.receivers[index]
if r_key == lookup_key:
@ -237,8 +237,8 @@ class Signal(object):
Remove dead receivers from connections.
"""
self.lock.acquire()
try:
self.lock.acquire()
to_remove = []
for key, connected_receiver in self.receivers:
if connected_receiver == receiver: