[issue4591] uid/gid problem in os.chown

2008-12-09 Thread Sjoerd Mullender

Sjoerd Mullender [EMAIL PROTECTED] added the comment:

I'm sure you meant 2^32-2 ;-).

The fix to use long doesn't seem right to me either.  unsigned int is
a better match with uid_t and gid_t.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4591
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4589] 'with' loses -bool exceptions

2008-12-09 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

The patch doesn't apply cleanly to the 2.5 branch, because that doesn't
have r61290. If somebody wants to backport it, go ahead (if you can do
so by Thursday).

--
nosy: +loewis

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4589
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4589] 'with' loses -bool exceptions

2008-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Does it need to be backported to 2.5? IMO it is a corner case.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4589
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4512] Add get_filename method to zipimport

2008-12-09 Thread Nick Coghlan

Changes by Nick Coghlan [EMAIL PROTECTED]:


--
assignee:  - ncoghlan

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4512
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1717] Get rid of more refercenes to __cmp__

2008-12-09 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

More seriously, if cmp were to go into the standard library somewhere,
perhaps Raymond's class decorator (for filling in missing rich
comparisons) could go into the same place?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4606] Passing 'None' if argtype is set to POINTER(...) doesn't always result in NULL

2008-12-09 Thread Robert Luce

New submission from Robert Luce [EMAIL PROTECTED]:

Consider the library 'c_lib.so' consisting of a single function 'c_func'

int c_func ( double *arg0, double *arg1, double *arg2, double *arg3,
 double *arg4, double *arg5, double *arg6) {
printf(Value of arg0 is %p\n, arg0);
printf(Value of arg1 is %p\n, arg1);
printf(Value of arg2 is %p\n, arg2);
printf(Value of arg3 is %p\n, arg3);
printf(Value of arg4 is %p\n, arg4);
printf(Value of arg5 is %p\n, arg5);
printf(Value of arg6 is %p\n, arg6);
return 0;
}

and the following snippet:

from ctypes import *
c_lib = CDLL('c_lib.so')
t = POINTER(c_double)
c_lib.c_func.argtypes = [t,t,t,t,t,t,t]

def call_c_func():
nptr = None
c_lib.c_func(nptr, nptr, nptr, nptr, nptr, nptr, nptr)

The output I get from call_c_func() with Python 2.6 and Python 2.5 on a
64 bit Linux box is (it probably won't happen on 32 bit systems):

Value of arg0 is (nil)
Value of arg1 is (nil)
Value of arg2 is (nil)
Value of arg3 is (nil)
Value of arg4 is (nil)
Value of arg5 is (nil)
Value of arg6 is 0xa

The reason appears to be that in 'PointerType_from_param' (_ctypes.c)
Py_None is converted to a Python integer of value 0.  Later, in
'ConvParam' (callproc.c), this integer ends up as a 4 byte integer type
on the argument stack for ffi. I don't know anything about ffi, but this
looks at least suspicious on any platform where sizeof(void*) is 8.

I propose to remove NULL pointer handling from the above from_param
function, since Py_None is properly handled by ConvParam itself. A patch
against the 2.6 maintenance branch is attached.

--
assignee: theller
components: ctypes
files: patch_ctypes_none_arg.diff
keywords: patch
messages: 77397
nosy: robertluce, theller
severity: normal
status: open
title: Passing 'None' if argtype is set to POINTER(...) doesn't always result 
in NULL
type: behavior
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file12300/patch_ctypes_none_arg.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4606
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1717] Get rid of more refercenes to __cmp__

2008-12-09 Thread Raymond Hettinger

Raymond Hettinger [EMAIL PROTECTED] added the comment:

Moving cmp() somewhere other than builtins is not progress.  IMO, it
needs to die off and the concept of it needs to disappear completely. 
Code is better without it.  Three-way comparisons are PITA to use --
their only virtue is as an optimization in the few cases where one
three-way test is cheaper to compute than two two-way tests.

The goal for 3.0 was to have one way to do it and thereby simplify the
language.  Tucking it away in a module or writing a new decorator
defeats the purpose.  It simply should die and go away.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1717] Get rid of more refercenes to __cmp__

2008-12-09 Thread Marc-Andre Lemburg

Marc-Andre Lemburg [EMAIL PROTECTED] added the comment:

On 2008-12-09 10:59, Raymond Hettinger wrote:
 Raymond Hettinger [EMAIL PROTECTED] added the comment:
 
 Moving cmp() somewhere other than builtins is not progress.  IMO, it
 needs to die off and the concept of it needs to disappear completely. 
 Code is better without it.  Three-way comparisons are PITA to use --
 their only virtue is as an optimization in the few cases where one
 three-way test is cheaper to compute than two two-way tests.
 
 The goal for 3.0 was to have one way to do it and thereby simplify the
 language.  Tucking it away in a module or writing a new decorator
 defeats the purpose.  It simply should die and go away.

The idea was to have one implementation of the work-around (ab) - (ba)
instead of 10 or so instances of this snippet in the Python stdlib
and probably a few hundred places in other code.

Indeed, the motivation is to have one obvious way to write this
work-around :-)

Note that cmp() doesn't make __cmp__ come back, but it does help
porting code that uses cmp().

Besides, cmp() is available builtin in 3.0, so it's too late to just
remove it anyway. We'd have to go through the usual deprecation
process.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4601] directory permission error with make install in 3.0

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Hum, there is not fixer for 2to3. But I might be hard to write such 
fixer because walk() generates (dirpath, dirnames, filenames) instead 
of (dirpath, filenames).

Python2 prototype:
  os.path.walk(path, visit, arg) - None
  with visit: callback(arg, dirpath, filenames)

Python3 prototype:
  os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]]) - 
generator
  with onerror: callback()
  the generator produces (dirpath, dirnames, filenames)

Example:
   os.path.walk('Lib/xml/', callback, 42)
can be replaced by
   for dirpath, dirnames, filenames in os.walk('Lib/xml/'):
  callback(42, dirpath, dirnames + filenames)

About the keyword only: +1 (or +2 :-)).

Index: Lib/os.py
===
--- Lib/os.py   (révision 67652)
+++ Lib/os.py   (copie de travail)
@@ -192,7 +192,7 @@

 __all__.extend([makedirs, removedirs, renames])

-def walk(top, topdown=True, onerror=None, followlinks=False):
+def walk(top, *, topdown=True, onerror=None, followlinks=False):
 Directory tree generator.

 For each directory in the directory tree rooted at top (including 
top

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4601
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-12-09 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11988/numbits-3.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4608] urllib.request.urlopen does not return an iterable object

2008-12-09 Thread Senthil

Senthil [EMAIL PROTECTED] added the comment:

I verified this bug in the Py3.0 and Py3.1. Shall come out with a patch
for it.

--
nosy: +orsenthil

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4608
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4609] Allow use of 256 FD's on solaris in 32 bit mode

2008-12-09 Thread Peter Saunders

New submission from Peter Saunders [EMAIL PROTECTED]:

Feature Request:

Could configure etc be modified to detect if it can use
enable_extended_FILE_stdio() to allow solaris to use  256 FD's while
still be compiled 32 bit. This is a new feature in Solaris 10 (came in
Update 4). 

Some futher infomation on this:

http://developers.sun.com/solaris/articles/stdio_256.html  (Scroll to
Programming Solutions)

http://docs.sun.com/app/docs/doc/819-2243/enable-extended-file-stdio-3c?a=view

--
components: Interpreter Core
messages: 77410
nosy: [EMAIL PROTECTED]
severity: normal
status: open
title: Allow use of  256 FD's on solaris in 32 bit mode
versions: Python 2.5, Python 2.6

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4609
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4609] Allow use of 256 FD's on solaris in 32 bit mode

2008-12-09 Thread Peter Saunders

Changes by Peter Saunders [EMAIL PROTECTED]:


--
components: +Distutils -Interpreter Core
type:  - feature request

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4609
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4609] Allow use of 256 FD's on solaris in 32 bit mode

2008-12-09 Thread Peter Saunders

Changes by Peter Saunders [EMAIL PROTECTED]:


--
components: +Interpreter Core -Distutils

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4609
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4607] uuid behavior with multiple threads

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

It looks like the bug is already fixed in Python trunk:

def uuid4():
Generate a random UUID.

# When the system provides a version-4 UUID generator, use it.
if _uuid_generate_random:
_buffer = ctypes.create_string_buffer(16)
_uuid_generate_random(_buffer)
return UUID(bytes=_buffer.raw)
...

Changeset: r67318. The changeset was not related to this issue, but 
#4363 (Make uuid module functions usable without ctypes).

--
nosy: +haypo

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4607
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

float(295147905179352891391L) gives different result on Python 2.5 and 
Python 2.6:
- 2.9514790517935289e+20   # Python 2.5.1
- 2.9514790517935283e+20   # 2.7a0

whereas the code is the same!?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

New version of my patch using a method instead of a property.

Added file: http://bugs.python.org/file12302/numbits-5.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4608] urllib.request.urlopen does not return an iterable object

2008-12-09 Thread Jakub Wilk

New submission from Jakub Wilk [EMAIL PROTECTED]:

$ cat urltest2.5
#!/usr/bin/python2.5
from urllib2 import urlopen
for line in urlopen('http://python.org/'):
print line
break

$ ./urltest2.5
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;


$ cat urltest3.0
#!/usr/bin/python3.0
from urllib.request import urlopen
for line in urlopen('http://python.org/'):
print(line)
break

$ ./urltest3.0
Traceback (most recent call last):
  File ./urltest3.0, line 3, in module
for line in urlopen('http://python.org/'):
TypeError: 'addinfourl' object is not iterable

--
components: Library (Lib)
messages: 77405
nosy: jwilk, pl
severity: normal
status: open
title: urllib.request.urlopen does not return an iterable object
type: behavior
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4608
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-12-09 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11990/numbits-4.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:40)
 reduce(lambda x,y: x*32768.0 + y, [256, 0, 0, 1, 32767])
2.9514790517935283e+20
 float(295147905179352891391L)
2.9514790517935289e+20

Python 2.7a0 (trunk:67679M, Dec  9 2008, 14:29:12)
 reduce(lambda x,y: x*32768.0 + y, [256, 0, 0, 1, 32767])
2.9514790517935283e+20
 float(295147905179352891391L)
2.9514790517935283e+20

Python 3.1a0 (py3k:67652M, Dec  9 2008, 13:08:19)
 float(295147905179352891391)
2.9514790517935283e+20
 digits=[256, 0, 0, 1, 32767]; x=0
 for d in digits:
...  x*=32768.0
...  x+= d
...
 x
2.9514790517935283e+20

All results are the same, except float(295147905179352891391L) in 
Python 2.5!? Python 2.5 rounds correctly:

Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:40)
 x=295147905179352891391L
 long(float(long(x))) - x
1L

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4594] Can't compile with -O3, on ARM, with gcc 3.4.4

2008-12-09 Thread John Stracke

John Stracke [EMAIL PROTECTED] added the comment:

The OPT env var is good.  Maybe it could be documented in configure --help?

And, yeah, recognizing the platform is messy.  I'll dig and see whether
gcc3 does the same thing on x86, though; if so, some logic to say use
-O2 for gcc 4 shouldn't be so bad.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4594
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: [issue4608] urllib.request.urlopen does not return an iterable object

2008-12-09 Thread Jeremy Hylton
Oops.  I didn't think it translate the code in addinfobase to the new
style of iterators.

Jeremy

On Tue, Dec 9, 2008 at 7:50 AM, Senthil [EMAIL PROTECTED] wrote:

 Senthil [EMAIL PROTECTED] added the comment:

 I verified this bug in the Py3.0 and Py3.1. Shall come out with a patch
 for it.

 --
 nosy: +orsenthil

 ___
 Python tracker [EMAIL PROTECTED]
 http://bugs.python.org/issue4608
 ___
 ___
 Python-bugs-list mailing list
 Unsubscribe: 
 http://mail.python.org/mailman/options/python-bugs-list/jeremy%40alum.mit.edu


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



[issue4594] Can't compile with -O3, on ARM, with gcc 3.4.4

2008-12-09 Thread John Stracke

John Stracke [EMAIL PROTECTED] added the comment:

OK, nope, gcc 3.4.6 on x86-64 builds fine.  So, please, just have
configure --help mention OPT.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4594
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4580] slicing of memoryviews when itemsize != 1 is wrong

2008-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Please, can you provide a patch that does not change whitespace
everywhere? Even if these files use indentation inconsistently; the
patch will be smaller and much easier to proofread.

(I vaguely remember a document saying that it's better to separate
whitespace change from real development, but I cannot find it.)

--
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4601] directory permission error with make install in 3.0

2008-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

The patch is fine.

If it were me, I'd change os.walk to accept keyword-only arguments:
def walk(top, *, topdown=True, onerror=None, followlinks=False):
   ...

--
nosy: +amaury.forgeotdarc
resolution:  - accepted

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4601
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4580] slicing of memoryviews when itemsize != 1 is wrong

2008-12-09 Thread Nick Coghlan

Nick Coghlan [EMAIL PROTECTED] added the comment:

Copy  paste from python-dev post:

The problem with memoryview appears to be related to the way it
calculates its own length (since that is the check that is failing when
the view blows up):

 a = array('i', range(10))
 m = memoryview(a)
 len(m) # This is the length in bytes, which is WRONG!
40
 m2 = memoryview(a)[2:8]
 len(m2) # This is correct
6
 a2 = array('i', range(6))
 m[:] = a# But this works
 m2[:] = a2  # and this does not
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: cannot modify size of memoryview object
 len(memoryview(a2)) # Ah, 24 != 6 is our problem!
24

Looks to me like there are a couple of bugs here:

The first is that memoryview is treating the len field in the Py_buffer
struct as the number of objects in the view in a few places instead of
as the total number of bytes being exposed (it is actually the latter,
as defined in PEP 3118).

The second is that the getbuf implementation in array.array is broken.
It is ONLY OK for shape to be null when ndim=0 (i.e. a scalar value). An
array is NOT a scalar value, so the array objects should be setting the
shape pointer to point to an single item array (where shape[0] is the
length of the array).

memoryview can then be fixed to use shape[0] instead of len to get the
number of objects in the view.

--
nosy: +ncoghlan

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4591] 32-bits unsigned user/group identifier

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

There is not only chown! There are also lchown(), fchown(), stat() and 
lstat().

Attached patch:
 - use unsigned int to store Windows st_uid/st_gid in the win32_stat 
structure
 - use PyLong to store an unsigned group in the stat result (because 
2^32-2 doesn't fit in a PyInt)
 - use unsigned int (instead of long) for uid/gid in chown, lchown 
and fchown

Note: *chown() accepts -1 for an argument, eg. chown(file, 10, -1) 
only changes the user group.

--
title: uid/gid problem in os.chown - 32-bits unsigned user/group identifier
versions: +Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file12301/posix_unsigned_uid.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4591
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4607] uuid behavior with multiple threads

2008-12-09 Thread Morten Bentsen

New submission from Morten Bentsen [EMAIL PROTECTED]:

The uuid module uses a single global buffer for storing random values 
obtained from the system. This can (and does) cause non-uniqueness of 
generated id's when using the uuid4 function in a multithreaded program.

The following snippet shows the problem - _buffer is the global buffer:

# When the system provides a version-4 UUID generator, use it.
if _uuid_generate_random:
_uuid_generate_random(_buffer)
return UUID(bytes=_buffer.raw)

--
components: Library (Lib)
messages: 77401
nosy: mortenab
severity: normal
status: open
title: uuid behavior with multiple threads
type: behavior
versions: Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4607
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4591] 32-bits unsigned user/group identifier

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

I tested my patch (for Python trunk) on Ubuntu Gutsy with a 32 bits 
CPU: chown(), lchwon(), fchown(), stat() and lstat() works as expected 
(support identifier  2**31-1).

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4591
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4610] Unicode case mappings are incorrect

2008-12-09 Thread Alex Stapleton

New submission from Alex Stapleton [EMAIL PROTECTED]:

Following a discussion on reddit it seems that the unicode case
conversion algorithms are not being followed.

$ python3.0
Python 3.0rc1 (r30rc1:66499, Oct 10 2008, 02:33:36) 
[GCC 4.0.1 (Apple Inc. build 5488)] on darwin
Type help, copyright, credits or license for more information.
 x='ß'
 print(x, x.upper())
ß ß

This conversion is correct as defined in UnicodeData.txt however
http://unicode.org/Public/UNIDATA/SpecialCasing.txt defines a more
complete set of case conversions.

According to this file ß.upper() should be SS. Presumably Python
simply isn't using this file to create it's mapping database.

--
components: Unicode
messages: 77417
nosy: alexs
severity: normal
status: open
title: Unicode case mappings are incorrect
type: behavior
versions: Python 2.6, Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4610
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4606] Passing 'None' if argtype is set to POINTER(...) doesn't always result in NULL

2008-12-09 Thread David W. Lambert

Changes by David W. Lambert [EMAIL PROTECTED]:


--
nosy: +LambertDW

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4606
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Ok, I understand why different versions of the same code gives 
different results: compiler flags! Python 2.5.1 is my Ubuntu version 
(should be compiled with -O3) whereas Python 2.7 and 3.1a0 are 
compiled by me with -00.

Results with Python 2.5.1:
 - with -O0, float(295147905179352891391L) gives 
2.9514790517935283e+20
 - with -O1, float(295147905179352891391L) gives 
2.9514790517935289e+20

I'm unable to isolate the exact compiler flag which changes the 
result. I tried all options listed in the gcc doc for the -O1 option:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Optimize-Options.html#Optimize-Options

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4580] slicing of memoryviews when itemsize != 1 is wrong

2008-12-09 Thread Antoine Pitrou

Antoine Pitrou [EMAIL PROTECTED] added the comment:

Sorry for the whitespace changes, here is a patch that has less of
them... hope that helps ;-S

Added file: http://bugs.python.org/file12303/issue4580ws.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1717] Get rid of more refercenes to __cmp__

2008-12-09 Thread Antoine Pitrou

Antoine Pitrou [EMAIL PROTECTED] added the comment:

 The idea was to have one implementation of the work-around (ab) - (ba)
 instead of 10 or so instances of this snippet in the Python stdlib
 and probably a few hundred places in other code.

But what use-case does it solve, except for making legacy code easier to
port to Py3k?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

Victor, what does

 1e16 + 2.

give on your Ubuntu 2.5 machine?
(Humor me. :) )

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4335] inspect.getsourcelines ignores last line in module

2008-12-09 Thread Alexander Belopolsky

Alexander Belopolsky [EMAIL PROTECTED] added the comment:

Just to add to the list of getsource quirks: with the following in x.py,

f = lambda: 0 \
[EOF]

 import inspect, x; inspect.getsource(x.f)
Traceback (most recent call last):
..
tokenize.TokenError: ('EOF in multi-line statement', (2, 0))

Same with

def f():
0 \
[EOF]

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4335
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4598] IDLE not opening

2008-12-09 Thread Elizabeth Chang

Elizabeth Chang [EMAIL PROTECTED] added the comment:

No, I don't have those set.

- Elizabeth

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4598
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4611] Small error in Extending Python with C or C++

2008-12-09 Thread Kuba Kończyk

New submission from Kuba Kończyk [EMAIL PROTECTED]:

Near the end of Reference Counting in Python section we have:
(...)The disadvantage of borrowing over leaking is(...), leaking
should be replaced by borrowing.

--
assignee: georg.brandl
components: Documentation
messages: 77425
nosy: georg.brandl, jakamkon
severity: normal
status: open
title: Small error in Extending Python with C or C++
versions: Python 2.6, Python 3.1

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4611
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4611] Small error in Extending Python with C or C++

2008-12-09 Thread Kuba Kończyk

Kuba Kończyk [EMAIL PROTECTED] added the comment:

I meant owning.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4611
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

About -O0 vs -O1, I think that I understood (by reading the 
assembler).

pseudocode of the -O0 version:
  while ()
  {
 load x from the stack
 x = x * ... + ...
 write x to the stack
  }

pseudocode of the -O1 version:
  while ()
  {
 x = x * ... + ...
  }

Intel uses 80 bits float in internals, but load/store uses 64 bits 
float. Load/store looses least significant bits.

Hey, floating point numbers are funny :-)

---

Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:40)
 1e16 + 2.999
10002.0
 1e16 + 2.
10004.0

Same result with python 2.7/3.1.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

An interresting document: Request for Comments: Rounding in PHP
http://wiki.php.net/rfc/rounding

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

 Intel uses 80 bits float in internals, but load/store uses 64 bits 
 float. Load/store looses least significant bits.

Exactly.  If your Intel machine is Pentium 4 or newer, you can get
around this by using the SSE2 extensions, which work with 64-bit doubles
throughout.  I don't remember offhand precisely which gcc flags you need
for this.

 Hey, floating point numbers are funny :-)

Yup.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Alexander Belopolsky

Alexander Belopolsky [EMAIL PROTECTED] added the comment:

On Tue, Dec 9, 2008 at 11:02 AM, Mark Dickinson [EMAIL PROTECTED] wrote:
...
 If your Intel machine is Pentium 4 or newer, you can get
 around this by using the SSE2 extensions, which work with 64-bit doubles
 throughout.  I don't remember offhand precisely which gcc flags you need
 for this.

The flags you may be looking for are -msse2 -mfpmath=sse

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

[Alexander]
 The flags you may be looking for are -msse2 -mfpmath=sse

Thanks, Alexander!

[Alexander again, from an earlier post...]
 I noticed that you replaced a call to _PyLong_AsScaledDouble with your 
 round to nearest algorithm.  I wonder if _PyLong_AsScaledDouble itself 
 would benefit from your change.  Currently it is used in 
PyLong_AsDouble 
 and long_true_divide.  I would think that long_true_divide would be 
more 
 accurate if longs were rounded to the nearest float.

You read my mind!  I've got another issue open about making long 
division round correctly, somewhere.  And indeed I'd like to make 
_PyLong_AsScaledDouble do correct rounding.  (I'd also like to make it 
return the exponent in bits, rather than digits, so that mathmodule.c 
doesn't have to know about the long int representation, but that's 
another story...)

 I believe _PyLong_AsScaledDouble is written the way it is to support 
 non-IEEE floating formats, but I am not sure that your algorithm would 
 always return the nearest float on an arbitrary non-IEEE platform.

Well, I had other possible formats in mind when I wrote the code, and I 
hope it's good whenever FLT_RADIX is 2.  If you can think of explicit 
cases where it's not going to work, please let me know.  My belief that 
it's safe rests on two facts: (1) it entirely avoids IEEE 754 oddities 
like negative zero, denormals and NaNs, and (2) all the floating-point 
operations actually performed should have exact results, so rounding 
doesn't come into play anywhere.

When FLT_RADIX is some other power of 2 (FLT_RADIX=16 is the only 
example I know of that exists in the wild) the code probably doesn't 
produce correctly rounded results in all cases, but it shouldn't do 
anything catastrophic either---I think the error still should't be more 
than 1ulp in this case.  When FLT_RADIX is not a power of 2 then so much 
else is going to be broken anyway that it's not worth worrying about.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4335] inspect.getsourcelines ignores last line in module

2008-12-09 Thread Alexander Belopolsky

Alexander Belopolsky [EMAIL PROTECTED] added the comment:

You convinced me.  After all, if python interpreter does not complain 
about missing end-of-line and processes the unterminated line, getsource 
should report it.

Here is a patch that passes existing tests and adds a NoEOF test case.

I am adding 2.5.3 to the list of versions, but someone will have to 
lobby python-dev to make it happen.

Note that I've modernized the code a little bit by switching from a 
callback tokenizer to the newer token generator.  Hopefully this will 
make it easier to review the code, but I can easily produce an old-style  
patch as well.

--
versions: +Python 2.5.3, Python 2.6, Python 2.7 -Python 2.5
Added file: http://bugs.python.org/file12304/issue4335.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4335
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1717] Get rid of more refercenes to __cmp__

2008-12-09 Thread Marc-Andre Lemburg

Marc-Andre Lemburg [EMAIL PROTECTED] added the comment:

On 2008-12-09 16:06, Antoine Pitrou wrote:
 Antoine Pitrou [EMAIL PROTECTED] added the comment:
 
 The idea was to have one implementation of the work-around (ab) - (ba)
 instead of 10 or so instances of this snippet in the Python stdlib
 and probably a few hundred places in other code.
 
 But what use-case does it solve, except for making legacy code easier to
 port to Py3k?

It implements the DRY principle.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

[Alexander]
 I also wonder whether round to nearest float can be implemented 
without
 floating point arithmetics.  I would think round towards zero should 
be
 a simple matter of extracting an appropriate number of bits from the
 long and round to nearest would at most require a long addition.

The idea's attractive.  The problem is finding an integer type that's 
guaranteed to have enough bits to store the mantissa for the float 
(probably plus one or two bits more for comfort);  for IEEE 754 this 
means a 64-bit integer type, and there aren't any of those in C89.

(One could use two 32-bit integer variables, but that's going to get 
messy.)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Alexander Belopolsky

Alexander Belopolsky [EMAIL PROTECTED] added the comment:

..
 The idea's attractive.  The problem is finding an integer type that's
 guaranteed to have enough bits to store the mantissa for the float
 (probably plus one or two bits more for comfort);  for IEEE 754 this
 means a 64-bit integer type, and there aren't any of those in C89.

But Python already has an arbitrary precision integer type, why not
use it?  Performance may suffer, but optimization can be considered
later possibly first on the most popular platforms.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Gabriel Genellina

Changes by Gabriel Genellina [EMAIL PROTECTED]:


--
nosy: +gagenellina

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

As you say, performance would suffer.

What would using Python's integer type solve, that isn't already solved by  
the patch?

I know the code isn't terribly readable;  I'll add some comments 
explaining clearly what's going on.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4566] 2.6.1 breaks many applications that embed Python on Windows

2008-12-09 Thread Gabriel Genellina

Changes by Gabriel Genellina [EMAIL PROTECTED]:


--
nosy: +gagenellina

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4566
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Alexander Belopolsky

Alexander Belopolsky [EMAIL PROTECTED] added the comment:

On Tue, Dec 9, 2008 at 12:39 PM, Mark Dickinson [EMAIL PROTECTED] wrote:
..
 What would using Python's integer type solve, that isn't already solved by
 the patch?


Speaking for myself, it would alleviate the irrational fear of
anything involving the FPU. :-)

Seriously, it is not obvious that your algorithm is correct and does
not depend on x being stored in an extended precision register.
Floating point experts are in short supply, so it may take a while for
your patch to be thoroughly reviewed by one of them.  If you could
produce a formal proof of correctness of your algorithm, that would be
more helpful than code comments.

On the other hand, an implementation that uses only integer
arithmetics plus bit shifts is likely to be much easier to understand.
 I don't think the performance will suffer much.  We can even start
with a pure python prototype using struct.pack or ctypes to produce
the double result.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4612] PyModule_Create() doesn't add/import module

2008-12-09 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

Are you returning the module in your extension's init function? The
import machinery takes the returned module from the init function and
adds it to sys.modules for you.

--
nosy: +brett.cannon

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4612
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4612] PyModule_Create() doesn't add/import module

2008-12-09 Thread Brett Cannon

Changes by Brett Cannon [EMAIL PROTECTED]:


--
status: open - pending

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4612
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4604] close() seems to have limited effect

2008-12-09 Thread Antoine Pitrou

Antoine Pitrou [EMAIL PROTECTED] added the comment:

Indeed, it seems to happen if you first call read() before calling close().

--
nosy: +pitrou

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

By the way, the algorithm here is essentially the same as the algorithm that I 
implemented for the float.fromhex method, except that the float.fromhex method 
is more 
complicated in that it may have to deal with signed zeros or subnormals.

So any mathematical defects that you find in this patch probably indicate a 
defect in 
float.fromhex too.

In fact, the code *does* do integer arithmetic, except that one of the integers 
happens 
to be stored as a double.  If you look at the code you'll find that at every 
stage, the 
floating-point variable x has an exact nonnegative integer value between 0 
and 
2**DBL_MANT_DIG.  All such values are exactly representable as a double, and 
all the 
arithmetic operations involved are exact.  This holds right up to the ldexp 
call at the 
end.  So the arithmetic with x is essentially integer arithmetic.

I accept the code needs extra documentation;  I was planning to put the 
equivalent 
Python code into the comments to make things clearer.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4612] PyModule_Create() doesn't add/import module

2008-12-09 Thread blake madden

blake madden [EMAIL PROTECTED] added the comment:

Sorry, mate, that's all Greek to me--I'm a total noob with Python.  I'm
simply trying to run the example in r67655 (the Extending Embedded
Python example) and it fails with 'emb' not being found.  It appears
that calling PyModule_Create(EmbModule); is not enough to create and
import the library.

Somebody made a comment in Issue4592 that PyModule_Create was missing
some logic, so I'm reporting that here.

I honestly don't know if there is something wrong with PyModule_Create
or if the example is missing something.  I'm just trying to get this
example to work.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4612
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4613] Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python shows no traceback

2008-12-09 Thread Albert Hopkins

New submission from Albert Hopkins [EMAIL PROTECTED]:

Say I have module foo.py:

def a(x):
   def b():
   x
   del x

If I run foo.py under Python 2.4.4 I get:

  File foo.py, line 4
del x
SyntaxError: can not delete variable 'x' referenced in nested
scope

Under Python 2.6 and Python 3.0 I get:

SyntaxError: can not delete variable 'x' referenced in nested
scope


The difference is under Python 2.4 I get a traceback with the lineno and
offending line, but I do not get a traceback in Pythons 2.6 and 3.0.

This also kinda relates to the 2to3 tool.  See:

http://groups.google.com/group/comp.lang.python/browse_frm/thread/a6600c80f8c3c60c/4d804532ea09aae7

--
components: Interpreter Core
messages: 77443
nosy: marduk
severity: normal
status: open
title: Can't figure out where SyntaxError: can not delete variable 'x' 
referenced in nested scope us coming from in python shows no traceback
type: behavior
versions: Python 2.6, Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4613
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1717] Get rid of more refercenes to __cmp__

2008-12-09 Thread Raymond Hettinger

Raymond Hettinger [EMAIL PROTECTED] added the comment:

Guido approved removing __builtin__.cmp() in 3.0.1.  It was supposed to
have been taken out but was forgotten.

With respect to the DRY principle, I disagree about its utility here. 
The code is so simple that it doesn't warrant cross-module
factorization.  It is a better goal to minimize dependencies.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4592] Example patch is missing something

2008-12-09 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

Because the init function for extension modules are supposed to return
the module now and the import machinery adds the module itself.

--
nosy: +brett.cannon

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4604] close() seems to have limited effect

2008-12-09 Thread Skip Montanaro

Skip Montanaro [EMAIL PROTECTED] added the comment:

Here's a test case (diff against Lib/test/test_io.py).  This fails for
me on OS X 10.5.5 with the tip of the py3k branch.

--
keywords: +patch
Added file: http://bugs.python.org/file12305/iobug.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4604] close() seems to have limited effect

2008-12-09 Thread Skip Montanaro

Changes by Skip Montanaro [EMAIL PROTECTED]:


--
stage: test needed - needs patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4612] PyModule_Create() doesn't add/import module

2008-12-09 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

Ah, I had not looked at the issue; sorry about the confusion.
PyImport_Create() is doing what it is supposed to be doing and should
not call PyImport_AddModule(). The example is wrong.

Closing this as invalid since the example is off.

--
resolution:  - invalid
status: pending - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4612
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4586] Extending Embedded Python documention uses removed Py_InitModule function

2008-12-09 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

You are probably looking at http://docs.python.org/3.0/ still and that
only updates when a new release happens. To see the in-development docs
look at http://docs.python.org/dev/3.0/ .

And the problem with the docs and its new PyModule_Create() usage is
being worked on in Issue4592 (already have a history over there so not
reopening this one).

--
nosy: +brett.cannon

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4586
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4592] Example patch is missing something

2008-12-09 Thread blake madden

blake madden [EMAIL PROTECTED] added the comment:

So, does that mean that Python is fine and there is a problem in the
example?  How do I get that example to work, there seems to be something
missing in it.  Thanks.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4604] close() seems to have limited effect

2008-12-09 Thread Skip Montanaro

Skip Montanaro [EMAIL PROTECTED] added the comment:

fixed patch.  I'm still a bit clumsy with the assertRaises stuff.

Added file: http://bugs.python.org/file12306/iobug.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3167] math test fails on Solaris 10

2008-12-09 Thread Jean Brouwers

Jean Brouwers [EMAIL PROTECTED] added the comment:

It looks like the patch did fix the problems.  Attached are the results 
for 32- and 64-bit Python 2.6.1 with and without the patch, all built with 
SUN's compilers on Solaris 10 (Opteron).

The math log tests failed with the 32-bit build before and passed after 
applying the patch.  The 64-bit build passed before and still passes after 
the patch.

Added file: 
http://bugs.python.org/file12307/Python-2.6.1-32bit-Solaris10-math_patch.log

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3167
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3167] math test fails on Solaris 10

2008-12-09 Thread Jean Brouwers

Changes by Jean Brouwers [EMAIL PROTECTED]:


Added file: 
http://bugs.python.org/file12308/Python-2.6.1-64bit-Solaris10-math_patch.log

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3167
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4592] Embedding example does not add created module

2008-12-09 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

The example is broken.

And the example under discussion is
http://docs.python.org/dev/3.0/extending/embedding.html#extending-embedded-python
.

I have changed the title to be more descriptive and assigned to Martin
to find out what the proper way is to handle this case.

--
assignee: georg.brandl - loewis
priority:  - critical
stage:  - needs patch
title: Example patch is missing something - Embedding example does not add 
created module

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4614] Document PyModule_Create()

2008-12-09 Thread Brett Cannon

New submission from Brett Cannon [EMAIL PROTECTED]:

PyModule_Create() is not documented (or at least it isn't showing up in
the C API index). Might be other parts of the new module initialization
API that are not documented either.

--
assignee: georg.brandl
components: Documentation
messages: 77454
nosy: brett.cannon, georg.brandl
severity: normal
stage: needs patch
status: open
title: Document PyModule_Create()
type: behavior
versions: Python 3.0, Python 3.1

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4604] close() seems to have limited effect

2008-12-09 Thread Skip Montanaro

Skip Montanaro [EMAIL PROTECTED] added the comment:

Here's a minimal patch to BufferedReader.read() which causes the test
to pass.  I will leave it for smarter people to decided whether or not
all the other read() methods need the same test.

Added file: http://bugs.python.org/file12309/io.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4604] close() seems to have limited effect

2008-12-09 Thread Skip Montanaro

Changes by Skip Montanaro [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file12305/iobug.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4580] slicing of memoryviews when itemsize != 1 is wrong

2008-12-09 Thread Nick Coghlan

Nick Coghlan [EMAIL PROTECTED] added the comment:

The patch still gets the length of memory view objects wrong - it just
makes it *consistently* wrong so that the specific assignment being
tested appears to work.

Note the following behaviour with the current memoryview :

 from array import array
 a10 = array('i', range(10))
 a6 = array('i', range(6))
 m10 = memoryview(a10)
 m6 = memoryview(a6)
 m = m10[2:8]
 len(m10)
40
 len(m6)
24
 len(m)
6

The patch will change the last item to 24 which will make the assignment
work, but it's still not the right answer!

As it turns out though, in addition to the length problems, this is far
from the only problem with memory view assignment - the damn things are
so finicky, it's practically impossible to assign anything to them:

 a = array('i', range(10))
 m = memoryview(a)
 m[1] = 1 # An integer perhaps?
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'int' does not have the buffer interface
 m[1] = array('i', range(1)) # A single valued array?
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: cannot modify size of memoryview object
 m[1] = b1234 # A bytes object of the correct size?
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: mismatching item sizes for array.array and bytes
 m[:1] = [0] # How about a sequence?
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'list' does not have the buffer interface
 m[1] = memoryview(array('i', range(1)))[:1] # Force the returned
'len' to be wrong (but right for what memoryview is going to do with it)
and the assignment works

I guess fixing most of those qualify as enhancements though, as opposed
to the length calculation which is simply an outright bug.

So...

1. memoryview needs to be fixed so that internally self-view.len is
always the length in bytes, even after taking a slice of the view

2. memoryview needs to be fixed so that len() reflects the number of
items in the view (i.e. self-view.shape[0]), not the total number of bytes

3. array.array needs to be fixed so that it populates the shape array (a
pointer to the arrays own internal length field should be adequate)

4. PyObject_GetBuffer needs to raise an exception if it sees ndim  0
with a NULL shape array in the resulting Py_buffer. The only time
shape=NULL is allowed is when ndim=0 (i.e. scalar values) because at
that point the length of the shape array is 0. The /* XXX */ comment in
the memoryview code about shape not being required by PEP 3118 needs to
go away because it *is* required - array.array is just broken in not
providing it.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4604] close() seems to have limited effect

2008-12-09 Thread Skip Montanaro

Changes by Skip Montanaro [EMAIL PROTECTED]:


--
stage: needs patch - patch review

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4586] Extending Embedded Python documention uses removed Py_InitModule function

2008-12-09 Thread blake madden

blake madden [EMAIL PROTECTED] added the comment:

You are probably looking at http://docs.python.org/3.0/ still and that
only updates when a new release happens.

Didn't you just have a new release, Python 3?  I thought the website
said it was a stable release?  The production help for Python 3 is using
Py_InitModule, which doesn't even exist in the production release of
Python 3.  I stopped looking at that help when I figured that out, and
after that I have been looking at the DEV help which (as you mentioned)
does not work for other reasons.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4586
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4589] 'with' loses -bool exceptions

2008-12-09 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

 Does it need to be backported to 2.5? IMO it is a corner case.

Not necessarily. If nobody volunteers, it won't be backported,
which is fine with me. The only potential release blocker for
a bug fix release can be a regression, which this isn't.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4589
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4586] Extending Embedded Python documention uses removed Py_InitModule function

2008-12-09 Thread Georg Brandl

Georg Brandl [EMAIL PROTECTED] added the comment:

Brett:

 You are probably looking at http://docs.python.org/3.0/ still and that
 only updates when a new release happens.

That is not true, I want it to update continually, like the 2.6 ones,
and have already contacted Neal about it.

Blake:

 Didn't you just have a new release, Python 3?  I thought the website
 said it was a stable release?  The production help for Python 3 is using
 Py_InitModule, which doesn't even exist in the production release of
 Python 3.

Yes. The production help is not without errors, since many changes to
the Python 3 branch haven't been properly documented.

But as said, when all is set up correctly, the docs.python.org/3.0 docs
will update and correct errors such as this one.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4586
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4594] Can't compile with -O3, on ARM, with gcc 3.4.4

2008-12-09 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

 OK, nope, gcc 3.4.6 on x86-64 builds fine.  So, please, just have
 configure --help mention OPT.

Can you contribute a patch? I'm skeptical it whether it is even possible
to influence the output of --help.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4594
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4610] Unicode case mappings are incorrect

2008-12-09 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

I have known this problem for years, and decided not to act; I don't
consider it an important problem. Implementing it properly is
complicated by the fact that some of the case mappings are conditional
on the locale.

If you consider it important, please submit a patch.

I'd rather see efforts put into an integration of ICU, which should
solve this problem and many others with Python's locale support.

--
nosy: +loewis

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4610
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4598] IDLE not opening

2008-12-09 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

Ok, then please run, in a cmd.exe shell, in the Python directory

  python.exe Lib\idlelib\idle.py

and report its output.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4598
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4587] Need to rework the dbm lib/include selection process

2008-12-09 Thread Roumen Petrov

Roumen Petrov [EMAIL PROTECTED] added the comment:

ok for patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4587
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4592] Embedding example does not add created module

2008-12-09 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

The proper way of extending embedded Python can be seen in
Demo/embed/demo.c.

I can't contribute to the documentation, so I'm unassigning myself.

--
assignee: loewis - 

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4612] PyModule_Create() doesn't add/import module

2008-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

When python is embedded in a program, there must be a way for the 
program to export 
some of its functions to python - a module that resides in the main 
executable.

You cannot use the import machinery to import such a module, because 
there is no 
separate file to find and load. Instead, the embedding program 
explicitly calls the 
module init() function. 
With python 2.x, this creates the module *and* inserts it into 
sys.modules. Then 
subsequent imports will find it directly in sys.modules.

mod_python for example works this way.
I maintain that the sample is still valid, and should be made to work 
somehow.

--
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4612
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1180] Option to ignore or substitute ~/.pydistutils.cfg

2008-12-09 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

Unfortunately, it missed the deadlines (i.e. nobody checked it in in
time). I'll look into it.

--
assignee:  - loewis
priority: normal - critical

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1180
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4612] PyModule_Create() doesn't add/import module

2008-12-09 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

On Tue, Dec 9, 2008 at 14:34, Amaury Forgeot d'Arc
[EMAIL PROTECTED] wrote:

 Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

 When python is embedded in a program, there must be a way for the
 program to export
 some of its functions to python - a module that resides in the main
 executable.

 You cannot use the import machinery to import such a module, because
 there is no
 separate file to find and load. Instead, the embedding program
 explicitly calls the
 module init() function.
 With python 2.x, this creates the module *and* inserts it into
 sys.modules. Then
 subsequent imports will find it directly in sys.modules.

 mod_python for example works this way.
 I maintain that the sample is still valid, and should be made to work
 somehow.

That's what I mean; the example is off as in incorrect. Not off as in
trying to do something silly.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4612
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4612] PyModule_Create() doesn't add/import module

2008-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

OK. I'm currently writing a documentation patch for issue4592.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4612
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4587] Need to rework the dbm lib/include selection process

2008-12-09 Thread Skip Montanaro

Skip Montanaro [EMAIL PROTECTED] added the comment:

Thanks Roumen.  Can I get a verdict on this approach from one of the
main Python developers?  I'm thinking a better way to control this
would be to add a --flag to the build command to control the search
order.

--
assignee:  - skip.montanaro
keywords: +needs review
stage:  - patch review

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4587
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4580] slicing of memoryviews when itemsize != 1 is wrong

2008-12-09 Thread Antoine Pitrou

Antoine Pitrou [EMAIL PROTECTED] added the comment:

Hi Nick,

 1. memoryview needs to be fixed so that internally self-view.len is
 always the length in bytes, even after taking a slice of the view

This is in my patch, unless I'm missing something?

 2. memoryview needs to be fixed so that len() reflects the number of
 items in the view (i.e. self-view.shape[0]), not the total number of bytes

Why should that be? There's nothing suggesting that in the PEP. On the
other hand I agree it looks a bit higher-level.

 3. array.array needs to be fixed so that it populates the shape array (a
 pointer to the arrays own internal length field should be adequate)

array.array is broken but that's a separate issue IMO (see e.g. #4509).
This issue is for fixing memoryview.

 4. PyObject_GetBuffer needs to raise an exception if it sees ndim  0
 with a NULL shape array in the resulting Py_buffer.

I'm for it, except that we must make sure that nobody really relies on
the current behaviour. I'm not sure there's only array.array.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4592] Embedding example does not add created module

2008-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

See attached documentation patch.

Instead of a direct call to PyModule_Create(), the main function must 
use
PyImport_AppendInittab(emb, PyInit_emb);

Note that the same line also works for all 2.x versions.
I'll try to add an item to howto/cporting.rst.

--
keywords: +needs review, patch
Added file: http://bugs.python.org/file12310/embedding_example.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4613] Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python shows no traceback

2008-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Somehow you caught the only SyntaxError that forgets to add filename and 
line information.
Patch attached, at the expense of not displaying the variable name (it 
should be obvious if the line is displayed)

--
keywords: +needs review, patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file12311/syntaxerror.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4613
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3166] Make conversions from long to float correctly rounded.

2008-12-09 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

Thanks for your comments, Alexander.

Here's a rewritten version of the patch that's better commented and 
somewhat less convoluted;  I think it should be easier to verify the 
correctness of this one.

Added file: http://bugs.python.org/file12312/long_as_double2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3166
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4592] Embedding example does not add created module

2008-12-09 Thread Georg Brandl

Georg Brandl [EMAIL PROTECTED] added the comment:

Applied in r67682.

Please don't add things directly to cporting.rst, rather amend the
PortingExtensionModulesToPy3k wiki page.

--
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4604] close() seems to have limited effect

2008-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

- The patch corrects a specific case, but not others: for example if the 
file is opened in r (text) mode.
There are also other methods to test: peek(), read1()...

- It should use
   self._checkClosed()
which already raises the same exception with the same message.

--
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4604] close() seems to have limited effect

2008-12-09 Thread Skip Montanaro

Skip Montanaro [EMAIL PROTECTED] added the comment:

Amaury - It should use
Amauryself._checkClosed()
Amaury which already raises the same exception with the same message.

I think some other places will need this change then.

Note that I don't know the io code at all.  I was just trying to provide a
simple test case and a simple fix.  Feel free to generalize it as necessary.

Skip

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4604
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4615] de-duping function in itertools

2008-12-09 Thread Tom Pinckney

New submission from Tom Pinckney [EMAIL PROTECTED]:

Any interest in an itertools de-duping function? I find I have to write 
this over and over for different projects:

def deduped(iter,key=None):
keys = set()
for x in iter:
if key:
k = key(x)
else:
k = x
if k in keys:
continue
keys.add(k)
yield(x)

--
components: Library (Lib)
messages: 77477
nosy: thomaspinckney3
severity: normal
status: open
title: de-duping function in itertools
type: feature request
versions: Python 2.6

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4615
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3999] Real segmentation fault handler

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

New patch:
 - limit memory footprint: use a static buffer to store the frames, 
with a maximum of MAXDEPTH frames (default: MAXDEPTH=100)
 - if there are more than MAXDEPTH frames, jump to the frame MAXDEPTH 
on error (it's like a truncated traceback)
 - don't call segfault_exit() in PyEval_EvalFrameEx() if 
segfault_enter() was not called

On Ubuntu Gutsy, for MAXDEPTH=100 the memory footprint is 19996 bytes. 
I think that it's small, but it's possible to reduce the footprint by 
using less frames or disable the alternative stack (needed for stack 
overflow errors).

Added file: http://bugs.python.org/file12313/segfault-3.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3999
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3999] Real segmentation fault handler

2008-12-09 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11666/segfault-2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3999
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3999] Real segmentation fault handler

2008-12-09 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Oh, another change in segfault-3.patch:
 - disable signal handler before the first call to segfault_enter() 
and the last call to segfault_exit()

About the memory footprint: it would be possible to use variable size 
buffer using malloc() and then realloc(). But static buffers are 
easier to use, and I don't want to play with malloc() while I'm 
handling a segmentation fault or stack overflow :-)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3999
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4613] Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python shows no traceback

2008-12-09 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

+1 compiler_error should be used anyway.

--
keywords:  -needs review
nosy: +benjamin.peterson

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4613
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4615] de-duping function in itertools

2008-12-09 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
assignee:  - rhettinger
nosy: +rhettinger

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4615
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >