~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-05-08 07:05:00 UTC
  • mfrom: (3376.2.15 no-asserts)
  • Revision ID: pqm@pqm.ubuntu.com-20080508070500-9zyyvsk0eev20t4w
(mbp) remove and disallow assert statements

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
 
188
188
            :return: A token which can be used to switch back to a read lock.
189
189
            """
190
 
            assert self.filename not in _fcntl_WriteLock._open_locks
 
190
            if self.filename in _fcntl_WriteLock._open_locks:
 
191
                raise AssertionError('file already locked: %r'
 
192
                    % (self.filename,))
191
193
            try:
192
194
                wlock = _fcntl_TemporaryWriteLock(self)
193
195
            except errors.LockError:
213
215
                # write lock.
214
216
                raise errors.LockContention(self.filename)
215
217
 
216
 
            assert self.filename not in _fcntl_WriteLock._open_locks
 
218
            if self.filename in _fcntl_WriteLock._open_locks:
 
219
                raise AssertionError('file already locked: %r'
 
220
                    % (self.filename,))
217
221
 
218
222
            # See if we can open the file for writing. Another process might
219
223
            # have a read lock. We don't use self._open() because we don't want