Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31058

an error in python lib?

Date 2012-10-09 17:32 -0700
Subject an error in python lib?
From Wenhua Zhao <whzhao@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2017.1349829133.27098.python-list@python.org> (permalink)

Show all headers | View raw


Hi list,

I just noticed that in /usr/lib/python2.7/threading.py

class _Condition(_Verbose):
    ...
    def _is_owned(self):
        # Return True if lock is owned by current_thread.
        # This method is called only if __lock doesn't have
_is_owned().
        if self.__lock.acquire(0):
            self.__lock.release()
            return False
        else:
            return True

The return values seem to be wrong.  They should be swapped:

    def _is_owned(self):
        if self.__lock.acquire(0):
            self.__lock.release()
            return True
        else:
            return False

Or I understood it wrong here?

Thanks,
Wenhua

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

an error in python lib? Wenhua Zhao <whzhao@gmail.com> - 2012-10-09 17:32 -0700
  Re: an error in python lib? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-10 14:04 +0200

csiph-web