Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion an error in python lib?

Received: by 10.180.84.74 with SMTP id w10mr3127304wiy.4.1350352653962;
        Mon, 15 Oct 2012 18:57:33 -0700 (PDT)
Path: q10ni65138211wif.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!216.196.110.142.MISMATCH!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.panservice.it!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path: <whz...@gmail.com>
X-Original-To: python-l...@python.org
Delivered-To: python-l...@mail.python.org
X-Spam-Status: OK 0.020
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'else:': 0.03; 'here?':
	0.09; 'def': 0.10; 'subject:error': 0.11; 'subject:python': 0.11;
	'thanks,': 0.18; 'skip:_ 20': 0.22; 'values': 0.26; 'message-
	id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'noticed': 0.28;
	'skip:_ 10': 0.29; 'class': 0.29; 'received:209.85.160.46': 0.32;
	'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'wrong':
	0.34; 'false': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35;
	'method': 0.36; 'should': 0.36; 'received:209': 0.37;
	'to:addr:python.org': 0.39; 'called': 0.39; 'list,': 0.39;
	'header:Received:5': 0.40; 'skip:/ 30': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:date:message-id:subject:from:to:content-type;
	bh=k7XUaf8rIxE4zsrxDVV73jBgwjZLdE9SExDWkiZSc90=;
	b=gUt5kKiNUr/KdVf6vpaGjpF5+0SsXjUY7R8Z4KbyczvPLI+Xr0ltK+Fbh9yN1dpTlM
	yc7ORjqOufX11H+k6Ouyqrv2nZ9CtDkJQ0GpbRNiSl46rxp6u3TbUV6xxX4dr7TGk965
	jqogZhu6+UYg/JKWoKc+MIqm1CFr9naVQozORCSq64JwZ8+G/jP0jPMF7CR2C2S9WOkQ
	Tfc1Zz2HVmz3r/4JOyy53wP2iWQJ/T5QH9gtKmAKSmNPX+VpUb2APMdqy77xLGzXbM32
	5epw/iMaMdrOrKolYM0ghgVx51XYN3FbAW3c18qjkC6DMHc8uzYcQnGDm5je379H8k38
	A4cg==
MIME-Version: 1.0
Date: Tue, 9 Oct 2012 17:32:11 -0700
Subject: an error in python lib?
From: Wenhua Zhao <whz...@gmail.com>
To: python-l...@python.org
X-BeenThere: python-l...@python.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: General discussion list for the Python programming language
	<python-list.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/options/python-list>,
	<mailto:python-list-requ...@python.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-l...@python.org>
List-Help: <mailto:python-list-requ...@python.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-list>,
	<mailto:python-list-requ...@python.org?subject=subscribe>
Newsgroups: comp.lang.python
Message-ID: <mailman.2017.1349829133.27098.python-l...@python.org>
Lines: 29
NNTP-Posting-Host: 2001:888:2000:d::a6
X-Trace: 1349829133 news.xs4all.nl 6918 [2001:888:2000:d::a6]:39648
X-Complaints-To: ab...@xs4all.nl
Bytes: 3385
Content-Type: text/plain; charset=UTF-8

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