[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-10-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

Hmm.  It looks as though the gamma computation itself is fine;  it's the 
accuracy check that's going wrong.

I'm suspecting an endianness issue and/or a struct module bug.

Ned, do you still get these failures with a direct single-architecture 
build on PPC?  Or just for the universal build?

--

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-10-17 Thread Tim Peters

Tim Peters  added the comment:

Adding

-mno-fused-madd

would be worth trying.  It usually fixes PPC bugs ;-)

--

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-10-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

It was a stupid Mark bug.  I'd missed out a '<' from the struct.unpack 
call that was translating floats into integers, for the purposes of 
computing ulps difference.  Fixed in r75454 (trunk), r75455 (py3k).

Thanks for reporting this, Ned.

--

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-10-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

BTW, the gamma computation shouldn't be at all fragile, unless I've messed 
up somewhere:  the Lanczos sum is evaluated as a rational function in 
which both numerator and denominator have only positive coefficients, so 
there's little danger of nasty cancellations boosting the relative error.
I'd be surprised if use of fma instructions made more than 1 or 2 ulps 
difference to the result, but I'll take a look.

--

___
Python tracker 

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



[issue7158] os.path.basename/split fails

2009-10-17 Thread Marco Buccini

Marco Buccini  added the comment:

I think this is not a Python bug, since it concerns PyQt. 

You're passing a QString object to os.path.split(), while the official
documentation wants you pass a Python string.

However, when I tried to run your example, newWF.py, and tried to open a
file from the menu, I got this:

controls.nch: 1024
Controls Window data shape: (511, 1024)
Data file: None
/home/marco/Programmi/Python-2.6.3/pyconfig.h
Traceback (most recent call last):
  File "issue7158.py", line 277, in openDataFile
head,tail = os.path.split(filename)
  File "/usr/lib/python2.5/posixpath.py", line 77, in split
i = p.rfind('/') + 1
AttributeError: 'QString' object has no attribute 'rfind'

Why does this happen? 
`filename` is a QString object. (you can see why here:
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qfiledialog.html#getOpenFileName
)

So how do you split your filename? I don't know.

I should close this bug.

--
nosy: +markon

___
Python tracker 

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



[issue7158] os.path.basename/split fails

2009-10-17 Thread Marco Buccini

Marco Buccini  added the comment:

> I should close this bug.

I *would* close this bug. Sorry :)

--

___
Python tracker 

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



[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-10-17 Thread Tim Peters

Tim Peters  added the comment:

Mark, you needn't bother:  you found the smoking gun already!  From your
description, I agree it would be very surprising if FMA made a
significant difference in the absence of catastrophic cancellation.

--

___
Python tracker 

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



[issue7158] os.path.basename/split fails

2009-10-17 Thread Tom Kuiper

Tom Kuiper  added the comment:

That's a good point, Marco.  I'd forgotten about the distinction.  
Converting 'filename' to a Python string with 'str()' fixed the problem.
> However, when I tried to run your example, newWF.py, and tried to open a
> file from the menu, I got this:
>
> controls.nch: 1024
> Controls Window data shape: (511, 1024)
> Data file: None
> /home/marco/Programmi/Python-2.6.3/pyconfig.h
> Traceback (most recent call last):
>   File "issue7158.py", line 277, in openDataFile
> head,tail = os.path.split(filename)
>   File "/usr/lib/python2.5/posixpath.py", line 77, in split
> i = p.rfind('/') + 1
> AttributeError: 'QString' object has no attribute 'rfind'
>   
I'm sorry about the confusion.  In the file I attached I had tried using 
'os.path.split()', with no luck.
> Why does this happen? 
> `filename` is a QString object. (you can see why here:
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qfiledialog.html#getOpenFileName
> )
>
> So how do you split your filename? I don't know.
>   
Python's 'split()' works, like this:
basename = filename.split('/')[-1]
self.datafile.setText(basename)
Also, with less code,
self.datafile.setText(os.path.basename(str(filename)))
> I should close this bug.
>   
Yes.  Please do.  I guess it's useful though to have our e-mail exchange 
on record for anyone else who stumbles over the Python string vs QString 
distinction.

Thanks and regards

Tom
> --
> nosy: +markon
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue7158] os.path.basename/split fails

2009-10-17 Thread Marco Buccini

Marco Buccini  added the comment:

I cannot close this bug, ahah :)

BTW: I'm happy you solved this bug.
Bye.

--

___
Python tracker 

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



[issue7158] os.path.basename/split fails

2009-10-17 Thread Tom Kuiper

Tom Kuiper  added the comment:

Do I have to do that?  I've never used the Python bug tracking system 
before.
> BTW: I'm happy you solved this bug.
>   
I guess we could consume a few beers over whether it's a bug or not.

Cheers

Tom

--

___
Python tracker 

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



[issue7158] os.path.basename/split fails

2009-10-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
resolution:  -> invalid
stage:  -> 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



[issue1646838] os.path, %HOME% set: realpath contradicts expanduser on '~'

2009-10-17 Thread Marco Buccini

Changes by Marco Buccini :


--
nosy: +markon

___
Python tracker 

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



[issue6975] symlinks incorrectly resolved on Linux

2009-10-17 Thread Marco Buccini

Changes by Marco Buccini :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue6975] symlinks incorrectly resolved on Linux

2009-10-17 Thread Marco Buccini

Marco Buccini  added the comment:

I've just found a similar bug:
http://bugs.python.org/issue1646838

However, does os.path.realpath's behavior have to be as the one
specified by the POSIX standard (
http://www.kernel.org/doc/man-pages/online/pages/man3/realpath.3.html )?
If we wanted to follow the standard, we should break the
retro-compatibility, since we should raise an exception in the case the
path passed as argument doesn't exist.

--

___
Python tracker 

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



[issue7159] Urllib2 authentication memory.

2009-10-17 Thread Brad Olson

New submission from Brad Olson :

For each request requiring HTTP authentication, urllib2 submits the
request without authentication, receives the server's 401
error/challenge, then re-submits the request with authentication.

This is compliant behavior. The problem comes in that urllib2 repeats
this for every ensuing request to the same namespace.

At times this is just an inefficiency--every request gets sent twice,
often with POST data (which can be sizeable).

Sometimes, especially with large POST bodies, this causes a connection
failure.

(Mercurial suffers greatly from this (and I have suggested workaround to
that team.)

This isn't non-compliant behavior, but RFC2617 (sections 2, 3.3)
suggests that once an HTTP client authenticates, it pre-emptively send
authentication with ensuing requests.

More analysis and fix suggestions at
bitbucket.org/bradobro/liquidhg/wiki/Home.

--
components: Library (Lib)
messages: 94180
nosy: bradobro
severity: normal
status: open
title: Urllib2 authentication memory.
type: behavior
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



[issue7160] Crash when returning a 64-bit char pointer in Python 2.6.3 ctypes

2009-10-17 Thread Michael J. Fromberger

New submission from Michael J. Fromberger :

A segmentation fault is generated in _ctypes.so when calling a function that 
returns a char pointer on a system 
with 64-bit pointer types.  The attached crash dump is from a Python 2.6.3 
built from MacPorts ("port install 
python26 +no_tkinter"), but the same behaviour occurs with the Python 2.6.1 
installed by Apple.

To reproduce, build the attached sample program ("testlib.c"):

% gcc -Wall -c testlib.o
% ld -dylib -o testlib.so testlib.o

Then, in Python:

# Common setup for each of the cases below.
>>> from ctypes import *
>>> lib = CDLL('testlib.so')

# Case 1: Integer return value (no crash).
>>> get_value = CFUNCTYPE(c_int)(lib.get_value)
>>> get_value()
12345

# Case 2: Pointer argument value (no crash).
>>> buf = create_string_buffer(256)
>>> copy_message = CFUNCTYPE(None, c_char_p)(lib.copy_message)
>>> copy_message(buf)

# Case 3: Pointer return value (crash).
>>> get_message = CFUNCTYPE(c_char_p)(lib.get_message)
>>> get_message()
Segmentation fault

-- System information:

% uname -a
MacOS 10.6.1
Darwin gorion.local 10.0.0 Darwin Kernel Version 10.0.0: Fri Jul 31 22:47:34 
PDT 2009; root:xnu-
1456.1.25~1/RELEASE_I386 i386

% python
Python 2.6.3 (r263:75183, Oct 17 2009, 01:49:30) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin

% gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1)

--
assignee: theller
components: ctypes
files: testlib.c
messages: 94181
nosy: creachadair, theller
severity: normal
status: open
title: Crash when returning a 64-bit char pointer in Python 2.6.3 ctypes
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file15154/testlib.c

___
Python tracker 

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



[issue7160] Crash when returning a 64-bit char pointer in Python 2.6.3 ctypes

2009-10-17 Thread Michael J. Fromberger

Changes by Michael J. Fromberger :


Added file: http://bugs.python.org/file15155/crash-report.txt

___
Python tracker 

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



[issue7160] Crash when returning a 64-bit char pointer in Python 2.6.3 ctypes

2009-10-17 Thread Michael J. Fromberger

Michael J. Fromberger  added the comment:

I believe this error occurs because a pointer value is being truncated to 
32 bits.  The exception code is

KERN_INVALID_ADDRESS at 0x002fe020

If you add a diagnostic printout to the body of get_message(), you will 
see that its return value is 0x1002fe020, so in other words, the high-
order word 0x0001 is being discarded somewhere.

--

___
Python tracker 

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



[issue7160] Crash when returning a 64-bit char pointer in Python 2.6.3 ctypes

2009-10-17 Thread Trundle

Trundle  added the comment:

You are using `CFUNCTYPE` wrong. `CFUNCTYPE` returns a type which will 
take a *Python function* (or an address of a function as integer). You 
provide `lib.get_message` as Python function, which is a wrapper object 
for the C function. By default, ctypes assumes an int as return type for 
C functions. On your platform, the size of an int is not the same as the 
size of a pointer. Therefore, the return value is truncated. You call 
the CFUNCTION which then calls `lib.get_message` which returns the 
truncated pointer as integer and then ctypes tries to make a `c_char_p` 
out of the integer which segfaults because it's truncated.

I think what you are really looking for is ``lib.get_message.restype = 
c_char_p``.

--
nosy: +Trundle

___
Python tracker 

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



[issue6952] deprecated conversion from string constant to char *

2009-10-17 Thread Barry Alan Scott

Barry Alan Scott  added the comment:

Here is my 1st patch to allow const char * and const Py_UNICODE *
It is agsinst http://svn.python.org/projects/python/trunk.

What I have attempted to do is stop the public API of python needing
char * or Py_UNICODE * where the API clearly does not need to modify
the argument. I have only modified internal API where its necessary
to provide a public const API.

Please give feedback and let me know if you wish me raise anything
with python dev.

I'm happy to produce a 3.2 version of the patch after the 2.7 version
is acceptable.

Barry

--
keywords: +patch
Added file: http://bugs.python.org/file15156/const_api_r75468.patch

___
Python tracker 

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



[issue7161] raise of SyntaxError in codeop was ported incorrectly to Py3

2009-10-17 Thread Trundle

New submission from Trundle :

The original lines in Lib/codeop.py under Python 2.6:

raise SyntaxError, err1

Those lines were ported to Python 3 as:

raise SyntaxError(err1)

Which is wrong because `err1` is in both cases an instance of 
`SyntaxError`. Quote from the language reference: "If the first object 
is a class, it becomes the type of the exception. The second object is 
used to determine the exception value: If it is an instance of the 
class, the instance becomes the exception value." Therefore, the correct 
translation of that code is: "raise err1".

The attached patch fixes the issue.

--
components: Library (Lib)
files: codeop_raise_syntaxerror.patch
keywords: patch
messages: 94185
nosy: Trundle
severity: normal
status: open
title: raise of SyntaxError in codeop was ported incorrectly to Py3
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file15157/codeop_raise_syntaxerror.patch

___
Python tracker 

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



[issue7080] locale.strxfrm raises MemoryError

2009-10-17 Thread egreen

egreen  added the comment:

I've added the tests.

I found that on Windows, strxfrm has been unavailable in py3k since
r61306, because of an omission in PC/pyconfig.h.  (cf. patch)

In determining whether I should first test for the existence of strcoll
(or strxfrm) in the locale module, as was done in TestMiscellaneous, I
found this is no longer needed in py3k since r61339.  (cf. patch)  (In
python2 such checks are still necessary.)

--
Added file: 
http://bugs.python.org/file15158/strxfrm_fixes_and_collation_tests.patch

___
Python tracker 

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



[issue7149] 2.6.4rc1 regression: test_urllib2 fails on OS X with UnboundLocalError

2009-10-17 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

Ronald, please apply asap.  This is the last thing I'm waiting on before
I tag 2.6.4rc2.

--
resolution:  -> accepted

___
Python tracker 

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



[issue2054] add ftp-tls support to ftplib - RFC 4217

2009-10-17 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

A patch including tests and documentation is now in attachment.
The test TLS server is very similar to pyftpdlib's I draw on:
http://code.google.com/p/pyftpdlib/source/browse/trunk/demo/tls_ftpd.py
I wasn't able to "compile" the documentation so I'm not 100% sure it looks 
perfectly.
Test suite run successfully on Windows XP, Ubuntu 9.04 and FreeBSD 7.1.

--
nosy: +josiah.carlson, josiahcarlson
Added file: http://bugs.python.org/file15159/ftplib.patch

___
Python tracker 

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



[issue6952] deprecated conversion from string constant to char *

2009-10-17 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Without looking into the details: the places where you cast-away
constness look wrong. Either the parameter shouldn't have been declared
const, or the target of the assignment needs to be converted to const,
too. If the cast is really legitimite, a comment needs to justify it
(but then, I think I would still prefer not to change the parameter to
const).

--

___
Python tracker 

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



[issue7162] 2to3 does not convert __builtins__.file

2009-10-17 Thread Joe Amenta

New submission from Joe Amenta :

Step to reproduce:

$ echo 'file("/some/file")' | python `which 2to3` -

(replace python with whichever python executable version you wish to
use, e.g. ~/python-trunk/python or /usr/local/bin/python3.2 )

Expected result:
Anything referring to the fact that the "file" type no longer exists in
python 3.x, whether it be a warning or a refactoring.

Actual result:
RefactoringTool: No files need to be modified.

Just a report for now, I don't have the time to write a patch.

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 94190
nosy: joe.amenta
severity: normal
status: open
title: 2to3 does not convert __builtins__.file
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2

___
Python tracker 

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



[issue7163] IDLE suppresses sys.stdout.write() return value

2009-10-17 Thread Terry J. Reedy

New submission from Terry J. Reedy :

IDLE
Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit
(Intel)] on win32

>>> import sys
>>> sys.stdout.write('abc')
abc

whereas

Command Window
Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit
(Intel)] on win32

>>> import sys
>>> sys.stdout.write('abc')
abc3

--
components: IDLE
messages: 94191
nosy: tjreedy
severity: normal
status: open
title: IDLE suppresses sys.stdout.write() return value
versions: Python 3.1, Python 3.2

___
Python tracker 

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



[issue1160] Medium size regexp crashes python

2009-10-17 Thread kristall

kristall  added the comment:

aloha,

I also use large RE's. re.compile() worked fine under python2.6 (OS
ubuntu-linux). After moving the code to python3.0 I get the same error
as ostkamp did. Under 3.1 also. Under 3.1 I tried to the fix that
ostkamp described (setting 'short' to 'long' in Modules/sre.h) and
rebuild python, but still the error occurs. I want to change to 3.x
since my variables contain german text with Umlauten (ä, ö, ü etc.) and
its pain to work with unicode under 2.x. Is there anything else I can
try, or is there a planned date when this bug will be fixed. I am
thankful in advance for any help.

kristall

--
nosy: +kristall

___
Python tracker 

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



[issue7153] add "start" arg to max and min functions

2009-10-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Here’s a summary of my research so far (including discussion with other
programmers, a Google code search, discussion on #python-dev on IRC, and
comparing the proposal to other APIs with start-arguments such as sum(),
reduce(), and enumerate()):

1. Showed several examples to other programmers and found that they did
not immediately get what the start argument was trying to do.  Was a
start argument the same as:

 reduce(max, seq, 0) # zero when empty and never less than zero
 max(seq) if seq else 0  # zero when empty (only works for sequences)
 max(chain([0], seq) # zero when empty and never less than zero

2. There is an issue of API complexity.  Even if a feature is useful and
clear, it may not be a good idea when the API of a function is already
complex.  In the case of min()/max(), we already have special handling
for one argument (treated as an iterator) versus no arguments (treated
an error versus multiple arguments (treated as an input sequence of
values).  We also have a key= argument.  Taken together, the min/max
functions already have a lot of features.

3.Beyond the complexity of having too many features in a function that
should be simple, there is also an issue of how those features would
interact:

 min(iterable, key=f, start=x)  # is the default value x or f(x)?
 min(start=x)  # should this be allowed?
 min(*args, start=x)   # if so, what is behavior when len(args)==0 or 1
or 2?

4. The argument about reduce(max, seq, 0) being confusing to
non-functional programmers isn’t persuasive since perfectly clear
(though multi-line) exception-catching or size-checking imperative forms
can be written, or one can can simply factor-out any recurring
expressions if they seem awkward or confusing:

def max_or_zero(iterable):
'Return zero if the iterable is empty or max(0, max(iterable))
otherwise'
return functools.reduce(max, iterable, 0)

5. In the case of sequences, it can be clearer to write:

 max(seq) if seq else 0  
 max(seq + [0]) # or use itertools.chain()

6. A code search showed that max() is mostly used in a two-argument
form.  When it does get used with iterables, it doesn't seem common to
trap ValueErrors.

--

___
Python tracker 

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



[issue7092] Test suite emits many DeprecationWarnings when -3 is enabled

2009-10-17 Thread Ehsan Amiri

Changes by Ehsan Amiri :


--
nosy: +esam

___
Python tracker 

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



[issue7161] raise of SyntaxError in codeop was ported incorrectly to Py3

2009-10-17 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r75472.

--
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



[issue7164] pickle test failure after test_imp/test_import (_make_stat_result is not the same object as os._make_stat_result)

2009-10-17 Thread R. David Murray

New submission from R. David Murray :

After r75467, which changed test_imp and test_import to use CleanImport,
the various pickle tests fail (all in the same common test, I believe).
 The error looks like this:

Traceback (most recent call last):
  File "/home/rdmurray/python/trunk/Lib/test/pickletester.py", line 623,
in test_structseq
s = self.dumps(t, proto)
  File "/home/rdmurray/python/trunk/Lib/test/test_pickle.py", line 33,
in dumps
p.dump(arg)
  File "/home/rdmurray/python/trunk/Lib/pickle.py", line 224, in dump
self.save(obj)
  File "/home/rdmurray/python/trunk/Lib/pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
  File "/home/rdmurray/python/trunk/Lib/pickle.py", line 400, in save_reduce
save(func)
  File "/home/rdmurray/python/trunk/Lib/pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
  File "/home/rdmurray/python/trunk/Lib/pickle.py", line 753, in save_global
(obj, module, name))
PicklingError: Can't pickle :
it's not the same object as os._make_stat_result

I don't have enough pickle-foo to understand what it is trying to do
here or what about CleanImport is messing it up.

--
components: Tests
messages: 94195
nosy: brett.cannon, ncoghlan, r.david.murray
priority: normal
severity: normal
status: open
title: pickle test failure after test_imp/test_import (_make_stat_result is not 
the same object as os._make_stat_result)
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue7153] add "start" arg to max and min functions

2009-10-17 Thread paul rubin

paul rubin  added the comment:

1. Yes, the idea is to figure out the best solution and go with it (or
decide to do nothing).  That many possibilities exist just points to the
need for experience and wisdom in identifying the best choice ("one and
preferably only one").  One of the attractive points about Python is it
comes with so many such decisions already wisely made.  The design
wisdom embodied in Python is almost like a useful software library in
its own right.  So the presence of multiple choices should be seen as an
invitation to resolve the issue, not a flag to keep it unresolved.

2. I agree that the multi-arg and iterator API's should have been done
as separate functions (or denoted through a keyword arg), but what we
have isn't too bad, and it's what we have.

3.  min(iterable, key=f, start=x) should obviously default to the same
thing as min([x], key=f).  min(*args, start=x) should only be allowed
when len(args)==1, since the start arg is restricted to the case of
minimum over an iterator.  min(start=x) should not be allowed.

4. I'm in general unpersuaded by the argument that a stdlib function
isn't worth having because the same thing can be done by bloating up the
user code.  Python code should be concise, which means using the stdlib
in preference to writing more user-defined functions that the next
maintainer has to figure out, and which may have their own bugs and
unhandled edge cases.  For stdlib design, it's mostly a matter of
deciding whether a construction occurs often enough to write a re-usable
function for.  In this case it wouldn't have occurred to me to write any
of those suggested versions, instead of writing reduce(max, iterator, 0)
with an explanatory comment.  But even the observation that "reduce"
made me bloat up the comments in the code, rather than the code itself,
was enough to get me to suggest adding the initial arg.

5. I don't think it's good to rely on bool(seq) or len(seq) to be
available if there's a simple construction (like here) that works for
arbitrary iterables.  It's better to handle the general case.  I hadn't
even realized til just now that "sequence" and "iterable" didn't mean
the same thing.

6. Yes, I know it's not common to trap ValueErrors when using max with
iterables.  I wrote code without such traps myself and then got bitten
by unhandled exceptions when some of those iterables turned out to be
empty (hence my "reduce" hack).  It wouldn't surprise me if lots more
such code out there is similarly buggy.  I think it's good to make
bug-avoiding mechanisms obvious and convenient.

--

___
Python tracker 

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



[issue7155] urllib2 and python 3 urllib do not document default use of system proxy configuration

2009-10-17 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Thanks for the comments.

Fixed and committed the changes trunk - 75478.
and merged into
release26-maint - 75479.
py3k - r75476
release31-maint - r75477

--
resolution: accepted -> 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



[issue7159] Urllib2 authentication memory.

2009-10-17 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
assignee:  -> orsenthil
nosy: +orsenthil

___
Python tracker 

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



[issue5625] test_urllib2 fails - urlopen error file not on local host

2009-10-17 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
assignee:  -> orsenthil

___
Python tracker 

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



[issue5475] urllib2.getproxies not documented

2009-10-17 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

getproxies is urllib one of the many helper functions that is not
documented in the Documentation files.

I am not sure of a good resolution for this (leave it as such/Document
it/ make it private). I shall look into the test coverage,usage of the
function and decide.

--
assignee: georg.brandl -> orsenthil
nosy: +orsenthil

___
Python tracker 

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



[issue6975] symlinks incorrectly resolved on Linux

2009-10-17 Thread Sylwester Warecki

Sylwester Warecki  added the comment:

Marco,

Thanks for looking deeper into it.
I would like to check the solution ASAP.
We have really crazy dir structure which can catch a lot of
the unexpected problems with paths, links, circular links etc.

Should I expect the new version to generate the exception
as you suggested?

Best Regards,
Sywlester Warecki

Marco Buccini wrote:
> Marco Buccini  added the comment:
>
> I've just found a similar bug:
> http://bugs.python.org/issue1646838
>
> However, does os.path.realpath's behavior have to be as the one
> specified by the POSIX standard (
> http://www.kernel.org/doc/man-pages/online/pages/man3/realpath.3.html )?
> If we wanted to follow the standard, we should break the
> retro-compatibility, since we should raise an exception in the case the
> path passed as argument doesn't exist.
>
> --
>
> ___
> Python tracker 
> 
> ___
>
>

--

___
Python tracker 

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



[issue7162] 2to3 does not convert __builtins__.file

2009-10-17 Thread Joe Amenta

Changes by Joe Amenta :


--
type:  -> behavior

___
Python tracker 

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



[issue7164] pickle test failure after test_imp/test_import (_make_stat_result is not the same object as os._make_stat_result)

2009-10-17 Thread Nick Coghlan

Nick Coghlan  added the comment:

Must have missed running the full test suite before checking that one
in. Whoops...

Anyway, the culprit is a couple of copy_reg calls that the os module
runs on import to register pickle support methods. CleanImport's
simplistic approach to reversion leaves the replacement handlers
registered even after the original os module has been restored, leading
to copy_reg complaining when you attempt to use the registered pickle
handlers.

I'll narrow the scope to just reverting os.environ and otherwise leave
the new os module in place.

--

___
Python tracker 

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



[issue7164] pickle test failure after test_imp/test_import (_make_stat_result is not the same object as os._make_stat_result)

2009-10-17 Thread Nick Coghlan

Nick Coghlan  added the comment:

Should be OK again as of r75481.

--
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



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2009-10-17 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

What's a procedure for testing this patch (please be as precise as
possible)?

--

___
Python tracker 

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