[issue7279] decimal.py: == and != comparisons involving NaNs

2009-11-08 Thread Mark Dickinson

Mark Dickinson  added the comment:

There's a second issue to consider here, which is that Python uses 
equality as specified by the == operator as the basic equivalence relation 
for set and dict membership tests.  So as a general rule, an equality test 
between two objects of the same type shouldn't be raising exceptions.  If 
== raised for comparisons with nans then it would make it awkward to put 
nans into a set.

Hmm.  But now I notice that you can't put Decimal nans into sets anyway:  
you get a 'TypeError: Cannot hash a NaN value'.  I'm not sure of the 
rationale for this.

One might also question whether Decimal("NaN") < 9 should really be 
raising InvalidOperation, or whether (as an operation that doesn't return 
a Decimal instance and is in some sense outside the scope of the standard-
--similar to int(Decimal('nan')) and hash(Decimal('nan'))) it should be 
raising some general Python exception instead.

I'm closing this as invalid: the behaviour isn't a bug, at least in the 
sense that the code is working as designed.  I think there may well be a 
useful discussion here, but the bugtracker isn't the right place to have 
it:  could we move it to python-dev instead?

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7287] import hook demo does not work

2009-11-08 Thread Baptiste Lepilleur

New submission from Baptiste Lepilleur :

The import hook demo in the source directory
Python-3.1.1\Demo\imputil\knee.py fails to run correctly:

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import knee
>>> import ctypes.utils
Traceback (most recent call last):
  File "", line 1, in 
TypeError: import_hook() takes at most 4 positional arguments (5 given)
>>>

--
components: Demos and Tools
messages: 95040
nosy: blep
severity: normal
status: open
title: import hook demo does not work
type: behavior
versions: Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7281] copysign() with NaN arguments on OpenSolaris

2009-11-08 Thread Stefan Krah

Stefan Krah  added the comment:

I hope this won't be getting too complex. :)

Firstly, I agree that this is perhaps not a bug at all. I reported it
because I seemed possible that Python2.x had a deliberate workaround for
this issue which somehow got lost in 3.x.

Secondly, I didn't mention that I'm running OpenSolaris on KVM since I
can't get it to install on physical hardware. However, I don't think KVM
plays a role here since gcc produces 'normal' results.

So, the problem combination is:

Ubuntu64bit -> KVM -> OpenSolaris32bit/suncc/Py3k


On the C level, here's an example:

#include 
#include 

int main(void)
{
double x = NAN;
printf("%f  %f\n", x, copysign(1.0, x));
return 0;
}

This gives -NaN, -1.00 with suncc and NaN, 1.00 with gcc. 


Back to Python:

sys.float_repr_style is 'legacy'.

It looks like the C99 fenv functions are pretty much supported, but I
don't know since when. I found man pages from 2003 for fenv and from
2006 for the fe*() functions.

This for example works:

#include 
#include 
#include 
#include 

int main(void)
{
#pragma STDC FENV_ACCESS ON
int save_round;
int setround_ok;

save_round = fegetround();

setround_ok = fesetround(FE_DOWNWARD);
assert(setround_ok == 0);

fesetround(save_round);
}


I could test changes that you make (preferably in p3k head, so I could
just pull them). But as I said: If the 'proper' behavior in 2.x was not
a deliberate workaround, there's really no need to change anything.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue3001] RLock's are SLOW

2009-11-08 Thread STINNER Victor

STINNER Victor  added the comment:

rlock4.patch looks correct and pass test_threading.py tests.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3475] _elementtree.c import can fail silently

2009-11-08 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

For 2.5, this will not be fixed, as it is not security-critical.

--
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3475] _elementtree.c import can fail silently

2009-11-08 Thread Fredrik Lundh

Fredrik Lundh  added the comment:

Note that "fail silently" is a bit of a misnomer - if the embedded import 
doesn't work, portions of the library will fail pretty loudly.  Feel free 
to use some variation of the suggested patch, or just wait until the next 
upstream release gets imported (if ever).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6233] ElementTree (py3k) doesn't properly encode characters that can't be represented in the specified encoding

2009-11-08 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The patch looks ok to me.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5611] Auto-detect indentation in C source in vimrc

2009-11-08 Thread Brett Cannon

Brett Cannon  added the comment:

in r76154 for trunk and r76155 for py3k. Thanks for the help, guys!

--
resolution:  -> accepted
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7288] Detect improper leading whitespace in C files for Vim

2009-11-08 Thread Brett Cannon

New submission from Brett Cannon :

With the proper detection for C files using either tabs or spaces now in 
there should also be proper highlighting when the wrong leading whitespace 
is used, e.g. if the file uses tabs then any lines with "^ +" should be 
flagged as wrong.

--
assignee: brett.cannon
components: None
keywords: easy
messages: 95047
nosy: brett.cannon
priority: low
severity: normal
stage: needs patch
status: open
title: Detect improper leading whitespace in C files for Vim
type: behavior
versions: Python 2.7, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7288] Detect improper leading whitespace in C files for Vim

2009-11-08 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

As a non-Vim user, I don't really care, but lines beginning with spaces
are valid if you want to indent by something smaller than a tab (this is
common in comments).

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7289] bad import in redemo.py script in v3.1

2009-11-08 Thread Alan Gauld

New submission from Alan Gauld :

The Tkinter import in redemo.py in Tools/Scripts folder of the 3.1 
distribution uses the old spelling of Tkinter. Changing it to lower case 
fixes it. I've just noticed there is a 3.2 listed, I haven't checked 
whether it's been fixed there but its not mentioned in the change log for 
3.1.1

--
components: Demos and Tools
messages: 95049
nosy: alan.ga...@btinternet.com
severity: normal
status: open
title: bad import in redemo.py script in v3.1
type: behavior
versions: Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7289] bad import in redemo.py script in v3.1

2009-11-08 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r76156.

--
nosy: +benjamin.peterson
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1294] Management of KeyboardInterrupt in cmd.py

2009-11-08 Thread Ilya Sandler

Ilya Sandler  added the comment:

Is not this patch backward incompatible?

E.g any cmd-based application which expects Ctrl-C to propagate to the
top level will be broken by this patch.

As for pdb, I don't think pdb will benefit from this patch: as I believe
that pdb needs something along the lines of patch #7245 for Ctrl-C
(temporary interrupt of execution with ability to resume similar to what
gdb does)

--
nosy: +isandler

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6986] _json crash on scanner/encoder initialization error

2009-11-08 Thread STINNER Victor

STINNER Victor  added the comment:

New version of my patch:
 * don't create file in Lib/json/tests/: add new tests in
Lib/json/tests/test_speedups.py as asked by pitrou
 * use json.scanner.c_make_scanner and json.encoder.c_make_encoder in
the test, instead of using directly the _json module

--
Added file: http://bugs.python.org/file15291/json-crash-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7288] Detect improper leading whitespace in C files for Vim

2009-11-08 Thread Brett Cannon

Brett Cannon  added the comment:

Ah nuts, you're right. I guess it will only work for starting with tabs 
when spaces are being used for the indentation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6986] _json crash on scanner/encoder initialization error

2009-11-08 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file15291/json-crash-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6986] _json crash on scanner/encoder initialization error

2009-11-08 Thread STINNER Victor

STINNER Victor  added the comment:

Oops, you forget json-crash-2.patch, the patch was completly wrong.
Check the json-crash-3.patch.

--
Added file: http://bugs.python.org/file15292/json-crash-3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3999] Real segmentation fault handler

2009-11-08 Thread STINNER Victor

STINNER Victor  added the comment:

My idea was rejected on python-dev mailing list. But I'm unable to
write a patch to dump a backtrace on segfault. Anyway it would be a
complelty different patch (and so a different issue). So I prefer to
close this (old) issue.

--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7274] json module apparently fails regression found at http://json.org/JSON_checker/test.zip.

2009-11-08 Thread Douglas Shawhan

Douglas Shawhan  added the comment:

Fair enough. Thanks.

On Fri, Nov 6, 2009 at 5:45 PM, Bob Ippolito  wrote:

>
> Bob Ippolito  added the comment:
>
> The json module departs slightly from the spec in that it will allow you
> to consume and produce documents that don't have an array or object
> envelope. This is a feature.
>
> The "Too deep" test case is just a silly thing that crockford's code
> does, there's a fixed limitation for how complex an object could be.
> That's not a regression failure and the spec doesn't say anything about
> a maximum nesting level.
>
> The json module includes all of these in its test suite, although it
> disagrees slightly with crockford on what should pass.
>
> http://svn.python.org/view/python/branches/release26-
> maint/Lib/json/tests/test_fail.py
>
> SKIPS = {
>1: "why not have a string payload?",
>18: "spec doesn't specify any nesting limitations",
> }
>
> --
> resolution:  -> invalid
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--
Added file: http://bugs.python.org/file15293/unnamed

___
Python tracker 

___Fair enough. Thanks.On Fri, Nov 6, 2009 at 
5:45 PM, Bob Ippolito rep...@bugs.python.org> 
wrote:


Bob Ippolito b...@redivi.com> added 
the comment:

The json module departs slightly from the spec in that it will allow you
to consume and produce documents that don't have an array or object
envelope. This is a feature.

The "Too deep" test case is just a silly thing that crockford's 
code
does, there's a fixed limitation for how complex an object could be.
That's not a regression failure and the spec doesn't say anything 
about
a maximum nesting level.

The json module includes all of these in its test suite, although it
disagrees slightly with crockford on what should pass.

http://svn.python.org/view/python/branches/release26-%0Amaint/Lib/json/tests/test_fail.py";
 target="_blank">http://svn.python.org/view/python/branches/release26-
maint/Lib/json/tests/test_fail.py

SKIPS = {
    1: "why not have a string payload?",
    18: "spec doesn't specify any nesting limitations",
}

--
resolution:  -> invalid
status: open -> closed

___
Python tracker rep...@bugs.python.org>
http://bugs.python.org/issue7274>
___

___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7290] Update 'how do I set a global variable' faq entry

2009-11-08 Thread R. David Murray

New submission from R. David Murray :

Someone else closed issue 7276, but I was thinking of doing so but
wanted to include a pointer to the relevant documentation.  I'm not sure
where that documentation is, but I figured there ought to be a FAQ entry
for it.  And there is, sort of...the first two sections of the
programming faq's 'core language' section.  However, I think that the
way that most people run in to this problem is by getting the
'UnboundLocalError', and so I think the FAQ entry title should mention
that error.  I attach a proposed update to the first section of the core
language section of the programming FAQ.  I'm also going to attach a
copy of the complete entry since it is hard to read in the patch.

--
assignee: georg.brandl
components: Documentation
files: UnboundLocalError-faq.patch
keywords: patch
messages: 95057
nosy: georg.brandl, r.david.murray
priority: normal
severity: normal
stage: patch review
status: open
title: Update 'how do I set a global variable' faq entry
type: feature request
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file15294/UnboundLocalError-faq.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7290] Update 'how do I set a global variable' faq entry

2009-11-08 Thread R. David Murray

Changes by R. David Murray :


Added file: http://bugs.python.org/file15295/UnboundLocalError-faq.rst

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7291] urllib2 cannot handle https with proxy requiring auth

2009-11-08 Thread Tatsuhiro Tsujikawa

New submission from Tatsuhiro Tsujikawa :

urllib2 cannot handle https with proxy requiring authorization.

After https_proxy is set correctly,

Python 2.6.4 (r264:75706, Oct 29 2009, 15:38:25)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> c=urllib2.urlopen("https://sourceforge.net";)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/urllib2.py", line 124, in urlopen
return _opener.open(url, data, timeout)
  File "/usr/lib/python2.6/urllib2.py", line 389, in open
response = self._open(req, data)
  File "/usr/lib/python2.6/urllib2.py", line 407, in _open
'_open', req)
  File "/usr/lib/python2.6/urllib2.py", line 367, in _call_chain
result = func(*args)
  File "/usr/lib/python2.6/urllib2.py", line 1154, in https_open
return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.6/urllib2.py", line 1121, in do_open
raise URLError(err)
urllib2.URLError: 

This is because HTTPConnection::_tunnel() in httplib.py doesn't send
Proxy-Authorization header.

--
components: Library (Lib)
messages: 95058
nosy: tsujikawa
severity: normal
status: open
title: urllib2 cannot handle https with proxy requiring auth
versions: Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7292] Multiprocessing Joinable race condition?

2009-11-08 Thread Jonathan

New submission from Jonathan :

In multiprocessing.JoinableQueue when task_done is called
self._unfinished_tasks.acquire(False) is called non-blocking.  My
program reliably crashes with the "task_done() called too many times"
message.  If I change the .acquire() call to True (blocking) then my
program no longer crashes and I have not noticed any adverse effects.  I
don't know if this would be considered a race condition or something
else but it does lead to crashes even in correct use scenarios.

(Code snippet follows for context, line 292 is the critical one for me)

def task_done(self):
self._cond.acquire()
try:
if not self._unfinished_tasks.acquire(False):
raise ValueError('task_done() called too many times')
if self._unfinished_tasks._semlock._is_zero():

--
components: None
messages: 95059
nosy: jonat...@kc8onw.net
severity: normal
status: open
title: Multiprocessing Joinable race condition?
type: behavior
versions: Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7291] urllib2 cannot handle https with proxy requiring auth

2009-11-08 Thread Tatsuhiro Tsujikawa

Tatsuhiro Tsujikawa  added the comment:

I created a patch.
I added additional argument 'headers' to HTTPConnection::set_tunnel()
method,
which is a mapping of HTTP headers to sent with CONNECT method. Since
authorization
credential is already set to Request object, in
AbstractHTTPHandler::do_open(),
if "Proxy-Authorization" header is found, pass it to set_tunnel().

It works fine for me.

--
keywords: +patch
Added file: http://bugs.python.org/file15296/https_proxy_auth.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7293] test_msvc9compiler test_reg_class failure on new Windows box

2009-11-08 Thread David Bolen

New submission from David Bolen :

This is a pretty tiny bug..

The test_reg_class test in test_msvc9compiler.py assumes that there is a
Notepad registry key on Windows systems.  That appears to be false until
Notepad is run the very first time.  I ran into this setting up a build
slave VM, where I never had the need to run Notepad.

I guess it's pretty rare for Notepad not to be run eventually, but
clearly the comments in the test saying the key is always present is
inaccurate, and perhaps a different key should be chosen or at least
have the test not fail if the key is missing.

It also appears that Windows 7 doesn't have that key even after Notepad
is run.

--
assignee: tarek
components: Distutils
messages: 95061
nosy: db3l, tarek
severity: normal
status: open
title: test_msvc9compiler test_reg_class failure on new Windows box

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com