Re: [Python-Dev] more timely detection of unbound locals

2011-05-10 Thread Fred Drake
On Tue, May 10, 2011 at 6:38 PM, Steven D'Aprano wrote: > I don't know why it was thought necessary to distinguish between them in the > first place. New users almost constantly expressed confusion by NameError when the name was clearly bound at global scope, and a subsequent assignment caused it

Re: [Python-Dev] more timely detection of unbound locals

2011-05-10 Thread Steven D'Aprano
Nick Coghlan wrote: Personally, I would just add "in current scope" to the existing error message for the unbound local case (and potentially collapse the exception hierarchy a bit by setting UnboundLocalError = NameError). -0 That was the case prior to Python 2.0. Reverting is potentially a

Re: [Python-Dev] more timely detection of unbound locals

2011-05-10 Thread Eli Bendersky
> > > # Early reference to local > > > UnboundLocalError: local variable 'bob' referenced before assignment > > > > I would change this to > > "local name 'bob' used before the assignment that makes it a local name" > > > > Calling names 'variables' is itself a point of confusion. > > Yes, your p

Re: [Python-Dev] more timely detection of unbound locals

2011-05-10 Thread R. David Murray
On Tue, 10 May 2011 13:56:58 -0400, Terry Reedy wrote: > On 5/10/2011 10:59 AM, Nick Coghlan wrote: > > On Tue, May 10, 2011 at 11:11 PM, R. David Murray > > wrote: > >> How about: > >> > >> "reference to variable 'y' precedes an assignment that makes it a local > >> variable" > > > > For compar

Re: [Python-Dev] more timely detection of unbound locals

2011-05-10 Thread Terry Reedy
On 5/10/2011 10:59 AM, Nick Coghlan wrote: On Tue, May 10, 2011 at 11:11 PM, R. David Murray wrote: How about: "reference to variable 'y' precedes an assignment that makes it a local variable" For comparison, the error messages I was able to elicit from 2.7 were as follows: # Module level N

Re: [Python-Dev] more timely detection of unbound locals

2011-05-10 Thread R. David Murray
On Wed, 11 May 2011 00:59:08 +1000, Nick Coghlan wrote: > On Tue, May 10, 2011 at 11:11 PM, R. David Murray w= > rote: > > How about: > > > > "reference to variable 'y' precedes an assignment that makes it a local > > variable" > > For comparison, the error messages I was able to elicit from 2.7

Re: [Python-Dev] more timely detection of unbound locals

2011-05-10 Thread Nick Coghlan
On Tue, May 10, 2011 at 11:11 PM, R. David Murray wrote: > How about: > > "reference to variable 'y' precedes an assignment that makes it a local > variable" For comparison, the error messages I was able to elicit from 2.7 were as follows: # Module level NameError: name 'bob' is not defined # F

Re: [Python-Dev] Commit messages: please avoid temporal ambiguity

2011-05-10 Thread R. David Murray
On Tue, 10 May 2011 17:45:44 +0400, Oleg Broytman wrote: > On Tue, May 10, 2011 at 09:33:13AM -0400, R. David Murray wrote: > > commit: > > 11999: sync based on comparing mtimes, not mtime to system clock > > NEWS: > > Issue 11999: fixed sporadic sync failure mailbox.Maildir due to its > >

Re: [Python-Dev] more timely detection of unbound locals

2011-05-10 Thread Eli Bendersky
On Tue, May 10, 2011 at 16:11, R. David Murray wrote: > On Tue, 10 May 2011 08:36:38 +0300, Eli Bendersky > wrote: > > With an unlimited error message length it could make sense to say "Hey, I > > see 'x' may be assigned in this scope, so I mark it local. But this > access > > to 'x' happens befo

Re: [Python-Dev] Commit messages: please avoid temporal ambiguity

2011-05-10 Thread Oleg Broytman
On Tue, May 10, 2011 at 09:33:13AM -0400, R. David Murray wrote: > commit: > 11999: sync based on comparing mtimes, not mtime to system clock > NEWS: > Issue 11999: fixed sporadic sync failure mailbox.Maildir due to its > trying to detect mtime changes by comparing to the system clock >

Re: [Python-Dev] [Python-checkins] cpython: _PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII

2011-05-10 Thread Michael Urman
On Tue, May 10, 2011 at 03:03, Victor Stinner wrote: > If GetProcAddress() expects a byte string encoded to the ANSI code page, > my patch is correct because the function used the UTF-8 encoding, not > the ANSI code page. We can maybe use GetProcAddressW() to pass a Unicode > string. I don't know

Re: [Python-Dev] Commit messages: please avoid temporal ambiguity

2011-05-10 Thread R. David Murray
On Tue, 10 May 2011 22:29:58 +1000, Nick Coghlan wrote: > On Tue, May 10, 2011 at 5:36 AM, Eric Smith wrote: > > Thanks indeed for bringing this up, Terry. It's been on my to-do list > > for a while. I think it comes from just copying the title of a bug > > report. The bug is "X does Y", and that

Re: [Python-Dev] more timely detection of unbound locals

2011-05-10 Thread R. David Murray
On Tue, 10 May 2011 08:36:38 +0300, Eli Bendersky wrote: > With an unlimited error message length it could make sense to say "Hey, I > see 'x' may be assigned in this scope, so I mark it local. But this access > to 'x' happens before assignment - so ERROR". This isn't realistic, of > course, so I'

Re: [Python-Dev] Commit changelog: issue number and merges

2011-05-10 Thread Nick Coghlan
On Tue, May 10, 2011 at 12:51 PM, Stephen J. Turnbull wrote: > R. David Murray writes: >  > On Mon, 09 May 2011 18:23:45 -0500, Benjamin Peterson > wrote: > >  > > *cough* http://mercurial.selenic.com/wiki/GraphlogExtension >  > >  > I'm sorry, but I've looked at the output of that and the menta

Re: [Python-Dev] Commit changelog: issue number and merges

2011-05-10 Thread R. David Murray
On Tue, 10 May 2011 11:51:19 +0900, "Stephen J. Turnbull" wrote: > R. David Murray writes: > > On Mon, 09 May 2011 18:23:45 -0500, Benjamin Peterson > wrote: > > > > *cough* http://mercurial.selenic.com/wiki/GraphlogExtension > > > > I'm sorry, but I've looked at the output of that and th

Re: [Python-Dev] Borrowed and Stolen References in API

2011-05-10 Thread Nick Coghlan
On Tue, May 10, 2011 at 11:53 AM, Marvin Humphrey wrote: > With regards to "what actually happens to the reference count", I would argue > that "incremented" and "decremented" are accurate descriptions. > >  * When a function returns an "incremented" object, that function has added >    a refcount

Re: [Python-Dev] Commit messages: please avoid temporal ambiguity

2011-05-10 Thread Nick Coghlan
On Tue, May 10, 2011 at 5:36 AM, Eric Smith wrote: > Thanks indeed for bringing this up, Terry. It's been on my to-do list > for a while. I think it comes from just copying the title of a bug > report. The bug is "X does Y", and that's what's used in the fix. I believe I've actually seen it in NE

Re: [Python-Dev] Commit changelog: issue number and merges

2011-05-10 Thread Aurélien Campéas
Le 10/05/2011 04:51, Stephen J. Turnbull a écrit : R. David Murray writes: > On Mon, 09 May 2011 18:23:45 -0500, Benjamin Peterson wrote: > > *cough* http://mercurial.selenic.com/wiki/GraphlogExtension > > I'm sorry, but I've looked at the output of that and the mental overhead >

Re: [Python-Dev] [Python-checkins] cpython: Issue #12039: Add end_headers() call to avoid BadStatusLine.

2011-05-10 Thread Senthil Kumaran
On Tue, May 10, 2011 at 10:10:15AM +0200, vinay.sajip wrote: > diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py > --- a/Lib/test/test_logging.py > +++ b/Lib/test/test_logging.py > @@ -1489,6 +1489,7 @@ > except: > self.post_data = None > reques

Re: [Python-Dev] [Python-checkins] cpython: _PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII

2011-05-10 Thread Victor Stinner
Le lundi 09 mai 2011 à 22:18 -0500, Michael Urman a écrit : > On Mon, May 9, 2011 at 20:08, Neil Hodgson wrote: > > Yes, Windows will use UTF-16 as it does for almost everything. From > > a user's point of view, these should both just be seen as Unicode. > > I'm not convinced this is correct fo