[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

The two latest patches (ntreader4.diff and
named_tuple_write_header.patch) seem like they are going in the right
direction and are getting close.

Barry or Skip, is this something you want in your module?

--
stage:  - patch review
type:  - feature request
versions: +Python 2.7, Python 3.1 -Python 2.6

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



[issue5373] TypeError when '\x00' in docstring

2009-02-26 Thread Noel Cuillandre

New submission from Noel Cuillandre noel.cuillan...@gmail.com:

The following code raises 'TypeError: __doc__ contains null-bytes'::

Python 3.1a0 (py3k, Jan 27 2009, 18:02:26) 
[GCC 4.1.1 (Gentoo 4.1.1-r1)] on linux2
Type help, copyright, credits or license for more information.
 class Foo:
...  '\x00'
... 
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: __doc__ contains null-bytes

--
messages: 82747
nosy: noel.cuillandre
severity: normal
status: open
title: TypeError when '\x00' in docstring
type: compile error
versions: Python 3.1

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



[issue5373] TypeError when '\x00' in docstring

2009-02-26 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Why do you think this is a bug?

--
nosy: +georg.brandl

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



[issue5373] TypeError when '\x00' in docstring

2009-02-26 Thread Noel Cuillandre

Noel Cuillandre noel.cuillan...@gmail.com added the comment:

Because the same code in Python 2.5.2 does not produce a TypeError::

Python 2.5.2 (r252:60911, Oct 21 2008, 15:11:46)
[GCC 4.1.1 (Gentoo 4.1.1-r1)] on linux2
Type help, copyright, credits or license for more information.
 class Foo:
...  '\x00'
...


Added file: http://bugs.python.org/file13189/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5373
___Because the same code in Python 2.5.2 does not produce a 
TypeError::brbrPython 2.5.2 (r252:60911, Oct 21 2008, 15:11:46) br[GCC 
4.1.1 (Gentoo 4.1.1-r1)] on linux2brType quot;helpquot;, 
quot;copyrightquot;, quot;creditsquot; or quot;licensequot; for more 
information.br
gt;gt;gt; class Foo:br...  
quot;quot;quot;#39;\x00#39;quot;quot;quot;br... 
brgt;gt;gt;brbr
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5373] TypeError when '\x00' in docstring

2009-02-26 Thread Noel Cuillandre

Changes by Noel Cuillandre noel.cuillan...@gmail.com:


Removed file: http://bugs.python.org/file13189/unnamed

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



[issue5373] TypeError when '\x00' in docstring

2009-02-26 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Well, that per se is not an indication that it is not a valid change in
3.0. However, I can see no good reason to disallow null-bytes in class
docstrings (especially since they're still allowed in function docstrings).

Assigning to Alexandre who made this change.

--
assignee:  - alexandre.vassalotti
nosy: +alexandre.vassalotti

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



[issue1580] Use shorter float repr when possible

2009-02-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 The GNU library's float-string routines are based on David Gay's. 
 Therefore you can compare those to Gay's originals

Sounds reasonable.

 (which accounts for the extreme length and complexity of Gay's code).

Looking at the code, I'm actually not seeing *extreme* complexity.
There are a lot of ifdefs for things that Python probably doesn't
care about (e.g., worrying about whether the inexact and underflow
flags get set or not;  hexadecimal floats, which Python already has
its own code for; weird rounding modes, ...).  There's some pretty
standard looking bignum integer stuff (it might even be possible to
substitute PyLong arithmetic for this bit).  There's lots of boring
material for things like parsing numeric strings.  The really
interesting part of the code is probably only a few hundred lines.

I think it looks feasible to adapt Gay's code for Python.  I'm not sure
I'd want to adapt it without understanding it fully, but actually that
looks quite feasible too.

The x87 control word stuff isn't really a big problem:  it can be dealt
with.  The bit I don't know how to do here is using the autoconf
machinery to figure out whether the x87 FPU exists and is in use on a
particular machine.  (I put in an autoconf test for x87-related double
rounding recently, which should be a pretty reliable indicator, but that
still fails if someone's already set 53-bit rounding precision...).

A side-note:  for x86/x86_64, we should really be enabling SSE2 by
default whenever possible (e.g., on all machines newer than Pentium 3).

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



[issue4278] optparse quirks

2009-02-26 Thread Andy Buckley

Andy Buckley a...@insectnation.org added the comment:

Are these really bugs? The first message just reports the error the
other way around from how you view it: you are thinking of -TO as a
two-character short option, optparse thinks of it as a two-character
long option which is missing a dash. I would side with optparse's
definition, since the point of short options is that they can be
combined under a single dash --- a multi-character option can't do that,
and so can't be short by definition.

In both this and the -h issue, optparse is reasonably enforcing a UI
convention as well as providing parsing facilities. That uniformity of
UI behaviour is a design goal is made explicit in the documentation.
Using optparse means that users can rely on -h to give them help
documentation, which IMO is a very useful convention to respect. And the
splitting of long and short options by whether they are single character
(and hence can be combined) or multi-character (hence uncombinable, but
good for less-used options without eating up the alphabetic option
namespace) is another nice convention which optparse enforces.

-1 from me: I think the existing behaviours are good, largely *because*
they aren't flexible.

--
nosy: +andybuckley

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



[issue4318] optparse: formatting of help text/descriptions

2009-02-26 Thread Andy Buckley

Andy Buckley a...@insectnation.org added the comment:

FWIW, I would like to see an option on textwrap to preserve newlines for
purposes other than optparse formatting. optparse would then just be
able to pass that as a flag when building the text wrapper object.
Should I open a separate issue targeted at textwrap?

--
nosy: +andybuckley

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



[issue5374] optparse special usage tokens conflict with formatting characters

2009-02-26 Thread Andy Buckley

New submission from Andy Buckley a...@insectnation.org:

optparse's OptionParser takes a usage string as a constructor argument,
in which a %prog token is replaced with the executable name. Nice
idea, but the choice of a percent sign for token delimiter is
troublesome since it means that attempting to substitute any variables
into the usage string, e.g.

usage = 
%prog [options] foo bar ...

Some computed info: %s % myinfo

gives a ValueError:

ValueError: unsupported format character 'p' (0x70) at index 2

Maybe this ceases to be a problem with what I've heard about the
formatting re-design in Python 3.x, but it will probably continue to be
awkward for the 2.x series where the % operator still applies. Maybe
optparse could also use a safer token (@prog, say), so that those of
use who would like to substitute variables into usage strings don't have
to artificially break our strings apart every time we use the program name?

--
components: Library (Lib)
messages: 82755
nosy: andybuckley
severity: normal
status: open
title: optparse special usage tokens conflict with formatting characters
type: behavior
versions: Python 2.5

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



[issue5375] Unified locals/consts array + register-based instructions

2009-02-26 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

There is no patch here, this entry is just a reminder of some of the
ideas that have been suggested to experiment with ways to speedup the
Python VM (djc, who is nosied, has said he'd be willing to try working
on it):

- unify the local variables and constants arrays (this costs a copy of
the constants array at each frame creation, but it should be negligible
since frames are reused and the copy can probably be a dumb memcpy)
- devise new instructions, or a whole new instruction set, which takes
its arguments from this array

As a simple way to experiment, one could start with a new instruction
named e.g. BINARY_ADD_FAST which would take one 16-bit arg, whose 8
upper bits would be the index of the first argument, and whose 8 lower
bits would be the index of the second argument. The result would be
pushed on top of the stack.

It could also be measured whether having a special value (255) to mean
pop the argument off the pop of the stack gives negative (because of
overhead) or positive (because of less bytecode) results.

--
components: Interpreter Core
messages: 82756
nosy: collinwinter, djc, jyasskin, pitrou
priority: normal
severity: normal
status: open
title: Unified locals/consts array + register-based instructions
type: performance
versions: Python 2.7, Python 3.1

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



[issue5374] optparse special usage tokens conflict with formatting characters

2009-02-26 Thread Tim Gordon

Tim Gordon tim...@aleph17.co.uk added the comment:

Try escaping the '%prog' in your usage string (i.e. use '%%prog' 
instead) so you don't get the error when you substitute values in.

--
nosy: +QuantumTim

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



[issue5368] curses patch add color_set and wcolor_set functions

2009-02-26 Thread Steve Owens

Steve Owens st...@integrityintegrators.net added the comment:

According to the python.org website: http://python.org/dev/patches/

We were to submit Documentation patches as Documentation, but it did'nt
say what to submit other types of patches as, so I took a chance.

How should it have been submitted?

Best Regards,
Steve Owens

 Georg Brandl ge...@python.org added the comment:

 Why was this classified as documentation?

 --
 components: +Extension Modules -Documentation

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


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



[issue5374] optparse special usage tokens conflict with formatting characters

2009-02-26 Thread Raghuram Devarakonda

Raghuram Devarakonda draghu...@gmail.com added the comment:

Please use the fix suggested by Tim Gordon.

--
nosy: +draghuram
resolution:  - works for me
status: open - closed

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



[issue5374] optparse special usage tokens conflict with formatting characters

2009-02-26 Thread Andy Buckley

Andy Buckley a...@insectnation.org added the comment:

Dang, why didn't I think of that? Cheers. Might be worth mentioning that
in the documentation, in case there are other people with my particular
brand of tunnel vision ;)

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



[issue5374] optparse special usage tokens conflict with formatting characters

2009-02-26 Thread Raghuram Devarakonda

Raghuram Devarakonda draghu...@gmail.com added the comment:

On Thu, Feb 26, 2009 at 9:32 AM, Andy Buckley rep...@bugs.python.org wrote:

 Dang, why didn't I think of that? Cheers. Might be worth mentioning that
 in the documentation, in case there are other people with my particular
 brand of tunnel vision ;)

I am not entirely sure if it is worth changing the documentation but
it wouldn't hurt, I suppose. It will be helpful if you can submit a
simple doc patch for that purpose.

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



[issue4318] optparse: formatting of help text/descriptions

2009-02-26 Thread David W. Lambert

David W. Lambert lamber...@corning.com added the comment:

I'd like textwrap option to preserve new lines.  Actual case:

I have a code that produces cryptograms meant to be printed and solved 
with paper and pencil.  Standard format for cryptogram inserts space 
character between each character of the original text, doubling the line 
length.  textwrap is handy to fit the cryptogram back to paper width.

Problem: When text to cryptogramize is a limerick original line breaks 
should be preserved.


P A Y C Y   H J K   J   K Q L Z   B J U R   G C V F   P C Y I P ,   H A 
V 

 K V O N A P   I Y H   H J R K   P V   U Y U Y I P .   A Y C   P R E ' Y 
C 

 L A V L Z   G O B B   V G   E V V   G C V F   J   N O B B .   K A Y 

 U Q Y U   B J K P   I Q N A P ;   K A Y   H J K   K E Y I P . 

 J I V I R F V O K



import string
import random
import textwrap

def Shuffle(L):
random.shuffle(L)
return L

def create_cryptogram(quote):

(disregards cryptogram rule that a letter can't stand for 
itself)
doctest omitted

# wish: wrap line-by-line to preserve original line breaks
wrapped_quote = textwrap.fill(text=quote,width=38).upper()
d = {c:c for c in string.printable}
d['\n'] = '\n'*2
UC = string.ascii_uppercase
d.update(zip(UC,Shuffle(list(UC
return ' '.join(d[c] for c in wrapped_quote)

--
nosy: +LambertDW

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

Raymond Barry or Skip, is this something you want in your module?

Sorry, I haven't really looked at this ticket other than to notice its
presence.  I wrote the DictReader/DictWriter functions way back when, so I'm
pretty comfortable using them.  I haven't felt the need for any other reader
or writer which manipulates file headers.

Skip

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

I think it would be useful to have.

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



[issue5376] Wrong ImportError message if module is not readable

2009-02-26 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

__import__() raises an ImportError No module named ... if the module 
file is not readable or module directory is not executable. The 
expected message is something like Module named ... is not readable.

Directory tree for the test:
--
marge$ ls -lRF .
.:
drwxrwxrwx 2 haypo haypo 4096 2009-02-26 16:51 module/
-rw-rw-rw- 1 haypo haypo9 2009-02-26 16:48 module2.py
-rw-r--r-- 1 haypo haypo  414 2009-02-26 16:50 test.py

./module:
-rw-r--r-- 1 haypo haypo 10 2009-02-26 16:45 __init__.py
--

Success with correct file permissions:
--
$ python test.py
__import__('/home/haypo/xxx/module') ...
PI = 3.14
__import__('/home/haypo/xxx/module2') ...
E = 2.72
--

Change module/ and module2.py permissions to 000 (no read, no write, 
no execute):
--
__import__('/home/haypo/xxx/module') ...
No module named /home/haypo/xxx/module
__import__('/home/haypo/xxx/module2') ...
No module named /home/haypo/xxx/module2
--

--
components: Interpreter Core
files: test.tar.gz
messages: 82766
nosy: haypo
severity: normal
status: open
title: Wrong ImportError message if module is not readable
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file13190/test.tar.gz

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



[issue5375] Unified locals/consts array + register-based instructions

2009-02-26 Thread Martin v. Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Please don't store such information in the bug tracker. If you think you
need public storage of it, consider using the wiki.

OTOH, I'm skeptical why a reminder is necessary in the first place: if
this is a project that interests you, you surely won't forget about it,
right?

--
nosy: +loewis

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



[issue5375] Unified locals/consts array + register-based instructions

2009-02-26 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 OTOH, I'm skeptical why a reminder is necessary in the first place: if
 this is a project that interests you, you surely won't forget about it,
 right?

The reason I don't just store it somewhere inside my head is that it's a
collective reminder :-). Also, djc (Dirkjan Ochtman) asked me to open an
entry as he wants to try to work on it.

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



[issue5366] setupscript examples for dependency keywords in setup.py

2009-02-26 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

Another thing for setupscript is to state that long_description is
actually ReStructured text.

--
title: examples for dependency keywords in setup.py - setupscript examples for 
dependency keywords in setup.py

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

Hrm... I replied twice by email.  Only one comment appears to have
survived the long trip.  Here's my second reply:


Rob NamedTupleReader and NamedTupleWriter should be inverses.  This
Rob means that NamedTupleWriter needs to write headers.  This should
Rob produce identical output as the dict writer example, but it's much
Rob cleaner.

You're assuming that one instance of these classes will read or write an
entire file.  What if you want to append lines to an existing CSV file or
pick up reading a file with a new reader which has already be partially
processed?

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

Let me be more explicit.  I don't know how it implements it, but I think
you really need to give the user the option of specifying the field
names and not reading/writing headers.  It can't be implicit as I
interpreted Rob's earlier comment:

 NamedTupleReader and NamedTupleWriter should be inverses.
 This means that NamedTupleWriter needs to write headers.

Skip

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



[issue4318] optparse: formatting of help text/descriptions

2009-02-26 Thread David W. Lambert

David W. Lambert lamber...@corning.com added the comment:

granted, this isn't terribly difficult:

'\n'.join(textwrap.fill(line) for line in text.split('\n'))

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



[issue5322] Python 2.6 object.__new__ argument calling autodetection faulty

2009-02-26 Thread James Mills

Changes by James Mills prolo...@shortcircuit.net.au:


--
nosy: +prologic

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



[issue5368] curses patch add color_set and wcolor_set functions

2009-02-26 Thread Steve Owens

Changes by Steve Owens st...@integrityintegrators.net:


--
components: +Library (Lib) -Extension Modules

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



[issue5368] curses patch add color_set and wcolor_set functions

2009-02-26 Thread Steve Owens

Changes by Steve Owens st...@integrityintegrators.net:


--
components: +Extension Modules -Library (Lib)

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-02-26 Thread Gregory Golberg

New submission from Gregory Golberg gri...@alum.mit.edu:

On some Python builds (2.5.2 and 2.6.1) the following program:

import sys
from decimal import Decimal

def show(n):
print type(n)
d = Decimal(str(n))
i = int(d)
t = type(i)
print t
i2 = int(i)
t2 = type(i2)
print t2

n = - sys.maxint - 1
show(n)

prints

type 'int'
type 'long'
type 'int'

While on 2.4 and 2.5.1 it prints:

type 'int'
type 'int'
type 'int'

This seems to happen only with -sys.maxint-1 number!

This has been tested with the following builds:

*** Strange result (with long): ***

2.6.1 (r261:67515, Feb 26 2009, 12:21:28) [GCC 4.2.4 (Ubuntu
4.2.4-1ubuntu3)]

2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]

2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu
4.2.3-2ubuntu7)]

2.5.2 and 2.6.1 on Windows Server 2003

*** Expected result (all int): ***

2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] 

2.5.1 (r251:54863, Oct 15 2007, 13:50:22) [GCC 3.4.6 20060404 (Red Hat
3.4.6-3)]

2.5.1 (r251:54863, Jul 31 2008, 23:17:40) [GCC 4.1.3 20070929
(prerelease) (Ubuntu 4.1.2-16ubuntu2)] 

2.4.5 (#2, Aug  1 2008, 02:20:59) [GCC 4.3.1] 

2.4.5 (#1, Jul 22 2008, 08:30:02) [GCC 3.4.3 (csl-sol210-3_4-20050802)]

2.4.3 (#1, Sep 21 2007, 20:05:43) [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)]

--
assignee: theller
components: Interpreter Core, ctypes
files: negmaxintbug.py
messages: 82773
nosy: debedb, theller
severity: normal
status: open
title: Strange behavior when performing int on a Decimal made from -sys.maxint-1
type: behavior
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file13191/negmaxintbug.py

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



[issue1580] Use shorter float repr when possible

2009-02-26 Thread Tim Peters

Tim Peters tim.pet...@gmail.com added the comment:

Mark, extreme complexity is relative to what's possible if you don't
care about speed; e.g., if you use only bigint operations very
straightforwardly, correct rounding amounts to a dozen lines of
obviously correct Python code.

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



[issue5334] array.fromfile() fails to insert values when EOFError is raised

2009-02-26 Thread Hirokazu Yamamoto

Hirokazu Yamamoto ocean-c...@m2.ccsnet.ne.jp added the comment:

Patch attached.

--
components: +Extension Modules -Library (Lib)
keywords: +patch
nosy: +ocean-city
versions: +Python 3.1
Added file: http://bugs.python.org/file13192/py3k_fix_array_fromfile.patch

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



[issue1580] Use shorter float repr when possible

2009-02-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

So is it worth trying to come up with a patch for this?  (Where this = 
making David Gay's code for strtod and dtoa usable from Python.)

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



[issue1580] Use shorter float repr when possible

2009-02-26 Thread Tim Peters

Tim Peters tim.pet...@gmail.com added the comment:

Is it worth it?  To whom ;-) ?  It was discussed several times before on
various Python mailing lists, and nobody was willing to sign up for the
considerable effort required (both to update Gay's code and to fight
with shifting platform quirks ever after).

If /you/ have the time, interest, and commitment, then yes, it's a Very
Good Thing.  The only hangup has been that it's also a labor-intensive
thing, in an obscure area requiring true expertise.

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Jervis Whitley

Jervis Whitley jervi...@gmail.com added the comment:

Skip Let me be more explicit.  I don't know how it implements it, but I 
think
Skip you really need to give the user the option of specifying the 
field
Skip names and not reading/writing headers.  It can't be implicit as I
Skip interpreted Rob's earlier comment:

rrenaud NamedTupleReader and NamedTupleWriter should be inverses.
rrenaud This means that NamedTupleWriter needs to write headers.

I agree with Skip, we mustn't have a 'wroteheader' flag internal to the 
NamedTupleWriter.

Currently to write a 'header' row with a csv.writer you could (for 
example) pass a tuple of header names to writerow. NamedTupleWriter
is no different, you would have a namedtuple of header names instead of
a tuple of header names.

I would not like to see another flag added to the initialisation process
to enable the writing of a header row as the 'first' (or any) row 
written to a file.  We could add a function 'writeheader' that would
write the contents of 'fieldnames' as a row, but I don't like the idea.

Cheers,

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



[issue1006238] cross compile patch

2009-02-26 Thread Roumen Petrov

Roumen Petrov bugtr...@roumenpetrov.info added the comment:

Mike, the python configure script fail to detect some of toolchain tools.

--
nosy: +rpetrov

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



[issue2889] curses for windows (alternative patch)

2009-02-26 Thread A.M. Kuchling

Changes by A.M. Kuchling li...@amk.ca:


--
nosy: +akuchling

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Rob Renaud

Rob Renaud rren...@google.com added the comment:

I want to make sure I understand.  Am I correct in believing that Skip
thinks writing headers should be optional, while Jervis believes we
should leave the burden to the NamedTupleWriter client?  

I agree that we should not unconditionally write headers, but I think
that we should write headers by default, much like we read them by default.

I believe the implicit header writing is very elegant, and the only
reason that the DictWriter object doesn't write headers is the impedance
mismatch between dicts and CSV.  namedtuples has the field order
information, the impedance mismatch is gone, we should no longer be
hindered.  Implicitly reading but not explicitly writing headers just
seems wrong.

It also seems wrong to require the construction of header namedtuple
objects.  It's much less natural than dicts holding identity mappings.

 Point._make(Point._fields)
Point(x='x', y='y')

To me, that just looks weird and non-obvious to me.  That Point instance
doesn't really fit in my mind as something that should be a Point.

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



[issue2889] curses for windows (alternative patch)

2009-02-26 Thread A.M. Kuchling

A.M. Kuchling li...@amk.ca added the comment:

I can't say anything about the Windows build aspects.  Some observations
about the curses/test_curses changes:

* test_curses: I'd be happier to see the 'if' statement as sys.platform
!= 'win32' and (not term or term == 'unknown')  -- easier to read.

* test_curses: does putp() make PDCurses crash, or is it not available?
 If the latter, I'd prefer to see 'if hasattr(curses, putp): putp
test'.Same for the tparm() test.

* Given that you include term.h and IRIX included term.h, I wonder if we
should make _cursesmodule.c include term.h on all platforms that have
it, and then fix the resulting breakage claimed by the comment (if any).

* Is setupterm() a no-up on Windows?  Maybe the function just shouldn't
be defined on Windows, then, so that user code can check for the
function's existence.

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



[issue5368] curses patch add color_set and wcolor_set functions

2009-02-26 Thread A.M. Kuchling

Changes by A.M. Kuchling li...@amk.ca:


--
nosy: +akuchling

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



[issue4254] _cursesmodule.c callable update_lines_cols()

2009-02-26 Thread A.M. Kuchling

A.M. Kuchling li...@amk.ca added the comment:

No documentation?  Doc/library/curses.rst exists; there's also
Doc/howto/curses.rst.  What functions in _curses need to be documented?

--
nosy: +akuchling

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



[issue4254] _cursesmodule.c callable update_lines_cols()

2009-02-26 Thread A.M. Kuchling

A.M. Kuchling li...@amk.ca added the comment:

BTW, the code portion of the patch looks OK to me.

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



[issue843590] 'macintosh' encoding alias for 'mac_roman'

2009-02-26 Thread Martin von Gagern

Martin von Gagern martin.vgag...@gmx.net added the comment:

I did some further investigations here. Apple doesn't seem likely to
offer any authoritative reference for the macintosh encoding, because
all they ever seem to talk about is Roman. The only source for
macintosh I could find is this RFC 1345, with the listed differences.
The RFC states the Unicode 1.0 standard as its source. Yesterday I went
to the library and thumbed through that volume. That, too, talks about
the different macintosh encodings, one of which is called Roman and
matches the one from current Unicode standards, except for 0xdb which
used to be the currency sign back then but is euro now. On 2009-02-09 I
also tried to ask Keld Simonsen, the author of the RFC, about this whole
issue. I got no reply so far.

On the whole, I get the impression that the macintosh encoding from
RFC 1345 is pretty much without actual use. I see no real world
application which actually uses it as it is defined, as most users
intend it as the IANA-registered name for mac-roman.

Python has two options, I believe. We could either do this by the book,
and implement an encoding as it was defined, even though there is no
known real world applicaton of that exact charset. Or we could be
pragmatic, and postulate that the RFC is simply wrong, and every real
world occurrence of macintosh intends to refer to mac-romand, in which
case an alias would be appropriate. I would say, let's be pragmatic.

When converting from unicode to macintosh, it might be possible to
accomodate both mappings, and in this way avoid unmappable characters.
As this doesn't deal well with the switched dashes, I guess I'd rather
not do this, in order to avoid subtle issues from going undetected. It
might be a good idea, however, to map both currecny sign and euro to the
same byte, and choose one when mapping back to unicode.

I don't think I can contribute much more information to this issue, and
seeing as it has been open for years without much input, I take it
neither will others. So I guess it is time to make a choice based on the
information available. By the book, or pragmatic?

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



[issue5376] Wrong ImportError message if module is not readable

2009-02-26 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file13190/test.tar.gz

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



[issue5376] Wrong ImportError message if module is not readable

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Oops, my first .tar.gz doesn't create files in a subdirectory. New 
archive fixes that.

Added file: http://bugs.python.org/file13193/issue5376.tar.gz

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



[issue5376] Wrong ImportError message if module is not readable

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Oooh, import by filename has been disabled in Python 2.6: see issue 
#1776.

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

For a Decimal object (d), int(d) calls d.__int__(). In your example, d 
has the attributes:
* _sign=1 (negative)
* _exp=0 (10^0=1)
* _int='2147483648'

d.__int__() uses s*int(self._int)*10**self._exp 
= -(int('2147483648')). Since int('2147483648') creates a long, you 
finally get a long instead of an integer.

Workaround to get a small integer even with -2147483648: 
int(int(d)) ;-)

For me, it's not a bug because __int__() can return a long! The 
following code works in Python 2.5 and 2.6:
   class A:
   def __int__(self):
   return 10**20

--
nosy: +haypo

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



[issue4474] PyUnicode_FromWideChar incorrect for characters outside the BMP (unix only)

2009-02-26 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: 
http://bugs.python.org/file13166/unicode_fromwidechar_surrogate-5.patch

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



[issue4474] PyUnicode_FromWideChar incorrect for characters outside the BMP (unix only)

2009-02-26 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: 
http://bugs.python.org/file12890/unicode_fromwidechar_surrogate-4.patch

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-02-26 Thread Gregory Golberg

Gregory Golberg gri...@alum.mit.edu added the comment:

Well, yes, the workaround works, but the question is why would the
second int() return an int, if it's indeed a long? And why the
difference in this behavior between 2.5.1 and 2.5.2.

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



[issue4474] PyUnicode_FromWideChar incorrect for characters outside the BMP (unix only)

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 add defined(SIZEOF_WCHAR_T) check

I don't understand why SIZEOF_WCHAR_T could be unset, but the patch 
version 6 only checks defined(SIZEOF_WCHAR_T) in unicodeobject.c, not 
in _testcapimodule.c (#if SIZEOF_WCHAR_T == 4).

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



[issue5378] adding --quiet to bdist_rpm

2009-02-26 Thread Tarek Ziadé

New submission from Tarek Ziadé ziade.ta...@gmail.com:

rmp and rpmbuild has a --quiet option that lowers down the output to
stdout and stderr.

Having it in Distutils is useful to cut down the output when bdist_rpm
calls these commands

--
assignee: tarek
components: Distutils
messages: 82790
nosy: tarek
priority: normal
severity: normal
status: open
title: adding --quiet to bdist_rpm
type: feature request
versions: Python 2.7, Python 3.1

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



[issue1533164] Installed but not listed *.pyo break bdist_rpm

2009-02-26 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

before I commit this patch I will do this one : #5378
to be able to lower down the output of the rpm/rpmbuild command calls

--
dependencies: +adding --quiet to bdist_rpm

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



[issue4258] Use 30-bit digits instead of 15-bit digits for Python integers.

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

1 comment and 1 question about 30bit_longdigit20.patch:
 - I love fixed size type: you use them when PYLONG_BITS_IN_DIGIT == 
30 (eg. digit=PY_UINT32_T) but not when PYLONG_BITS_IN_DIGIT == 15 
(eg. digit=unsigned short). Even if short is always 16 bits, I would 
prefer fixed size types in any case.
 - In pyport.h, you redefine PYLONG_BITS_IN_DIGIT if it's not set. Is 
it for the Windows world (which doesn't use configure script)?

I prefer the patch version 20 because it's much simplier than the 
other with the algorithm optimisations. The patch is already huge, so 
it's better to split it into smaller parts ;-)

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



[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 I think that feature is ok to not support.

Yeah!

Anyone to review and/or commit the last patch?

--
versions: +Python 3.1

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



[issue5052] Mark distutils to stay compatible with 2.3

2009-02-26 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

ok the current trunk won't run even under 2.5...

I will make two small changes:

- use md5 module of haslib is not found
- make the smallest possible change for site.USER_BASE 
  and site.USER_SITE usage

--
nosy: +christian.heimes

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



[issue5305] imaplib should support international mailbox names

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 The IMAP4rev1 specification allows for non-ASCII mailbox 
 names using a modified UTF-7 encoding

UTF-7 already sounds like something horrible for me, but a *modified* 
UTF-7 encoding is something a little bit more strange for me. Why not 
reusing directly UTF-7.

(sorry, it's an off topic dummy question)

--
nosy: +haypo

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



[issue3595] Windows base64 Decode

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

need more informations like a test script. reopen if you such 
script ;-)

--
nosy: +haypo
resolution:  - invalid
status: open - closed

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



[issue5305] imaplib should support international mailbox names

2009-02-26 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@divmod.com added the comment:

 UTF-7 already sounds like something horrible for me, but a *modified*
 UTF-7 encoding is something a little bit more strange for me. Why not
 reusing directly UTF-7.

UTF-7 wasn't horrible for its time, but its time has very likely passed.
 Alas, changing a standard like IMAP4 is so difficult, this mistake will
be with us for a long time to come.

As for why IMAP4 uses a modified form of UTF-7, the RFC addresses this:

   The purpose of these modifications is to correct the following
   problems with UTF-7:

  1) UTF-7 uses the + character for shifting; this conflicts with
 the common use of + in mailbox names, in particular USENET
 newsgroup names.

  2) UTF-7's encoding is BASE64 which uses the / character; this
 conflicts with the use of / as a popular hierarchy delimiter.

  3) UTF-7 prohibits the unencoded usage of \; this conflicts with
 the use of \ as a popular hierarchy delimiter.

  4) UTF-7 prohibits the unencoded usage of ~; this conflicts with
 the use of ~ in some servers as a home directory indicator.

  5) UTF-7 permits multiple alternate forms to represent the same
 string; in particular, printable US-ASCII characters can be
 represented in encoded form.

Whether you are convinced by these arguments or not is, of course,
entirely up to you.  Note also, however, that the modified UTF-7 is not
mandated by the RFC:

   By convention, international mailbox names in IMAP4rev1 are specified
   using a modified version of the UTF-7 encoding described in [UTF-7].
   Modified UTF-7 may also be usable in servers that implement an
   earlier version of this protocol.

However, it seems stupid to say that the choice if encoding is only a
convention since there is no other way to communicate the choice of
encoding between client and server.

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

More concretely, I don't think this is so onerous:

names = [col1, col2, color]
writer = csv.DictWriter(open(f.csv, wb), fieldnames=names, ...)
writer.writerow(dict(zip(names, names)))
...

or

f = open(f.csv, rb)
names = csv.reader(f).next()
reader = csv.DictReader(f, fieldnames=names, ...)
...

Skip

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 the question is why would the second int() return an int, 
 if it's indeed a long?

Python doesn't convert long to int even if the long can fit in an int. 
Example:

 type(1)
type 'int'
 type(1L)
type 'long'
 type(1L+1)
type 'long'
 type(2)
type 'int'

Even if 1L and 2L can fit in a int, Python keeps the long type.

 why the difference in this behavior between 2.5.1 and 2.5.2

No idea. You can simplify your test script with :

# example with python 2.5.1 (32 bits CPU)
 type(-int('2147483648'))
type 'long'
 sys.maxint

On a 64 bits CPU, sys.maxint is much bigger, so don't have the problem 
with -2147483648 but with -9223372036854775808:

# example with python 2.5.2 (*64 bits CPU*)
 sys.maxint + 1
9223372036854775808L
 -int('9223372036854775808')
-9223372036854775808L
 int(-int('9223372036854775808'))
-9223372036854775808

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



[issue1580] Use shorter float repr when possible

2009-02-26 Thread Guido van Rossum

Guido van Rossum gu...@python.org added the comment:

On Thu, Feb 26, 2009 at 1:01 PM, Tim Peters rep...@bugs.python.org wrote:
 Is it worth it?  To whom ;-) ?  It was discussed several times before on
 various Python mailing lists, and nobody was willing to sign up for the
 considerable effort required (both to update Gay's code and to fight
 with shifting platform quirks ever after).

 If /you/ have the time, interest, and commitment, then yes, it's a Very
 Good Thing.  The only hangup has been that it's also a labor-intensive
 thing, in an obscure area requiring true expertise.

I *think* I understood Preston as saying that he has the expertise and
is interested in doing this. He's just looking for guidance on how
we'd like the software engineering side of things to be done, and I
think he's getting good feedback here. (Preston, please butt in if I
misunderstood you.)

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Anyway, the behaviour in correct. But ok, it's strange because 
unexpected. You have to understand the fact the long=int conversion 
is manual :-/ Decimal.__int__ might force return int(result) at the 
end to avoid problem with -sys.maxint, but is it really important? I 
don't think so. Python3 doesn't have this problem ;-)

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-02-26 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-02-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Anyway, the behaviour is correct. But ok, it's strange because 
unexpected. You have to understand the fact the long=int conversion 
is manual :-/ Decimal.__int__ might force return int(result) at the 
end to avoid problem with -sys.maxint, but is it really important? I 
don't think so. Python3 doesn't have this problem ;-)

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



[issue5368] curses patch add color_set and wcolor_set , and addchstr family of functions

2009-02-26 Thread Steve Owens

Steve Owens st...@integrityintegrators.net added the comment:

I have also added the addchstr family of functions.  The updated patch2
should include the previos patch since it has not been applied to the
repository as of this writing.  See also the unittest for the addchstr
method family.

I will update the docs and add those as well, but there is quite alot of
documentation that needs to be done and it is late, please let me know
if this will be an acceptable patch. I'm still new.

--
title: curses patch add color_set and wcolor_set functions - curses patch add 
color_set and wcolor_set , and addchstr family of functions
Added file: http://bugs.python.org/file13194/curses_patch2.diff

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



[issue5368] curses patch add color_set and wcolor_set , and addchstr family of functions

2009-02-26 Thread Steve Owens

Steve Owens st...@integrityintegrators.net added the comment:

This is the addchstr unit test.

Added file: http://bugs.python.org/file13195/test_curses_addchstr.py

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



[issue5368] curses patch add color_set and wcolor_set , and addchstr family of functions

2009-02-26 Thread Steve Owens

Steve Owens st...@integrityintegrators.net added the comment:

This is a start on the documentation efforts.  I have updated the
recently modified curses.rst (how to) file.  Need direction in locating
all of the docs that are impacted by the changes I have introduced and I
will write them up.

Added file: http://bugs.python.org/file13196/curses.rst

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



[issue5052] Mark distutils to stay compatible with 2.3

2009-02-26 Thread Tarek Ziadé

Changes by Tarek Ziadé ziade.ta...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file13197/2.3.patch

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



[issue1580] Use shorter float repr when possible

2009-02-26 Thread Tim Peters

Tim Peters tim.pet...@gmail.com added the comment:

Huh.  I didn't see Preston volunteer to do anything here ;-)

One bit of software engineering for whoever does sign on:  nothing kills
porting a language to a new platform faster than needing to get an
obscure but core subsystem working.  So whatever is done here, to the
extent that it requires fiddling with obscure platform-specific gimmicks
for manipulating FPU state, to that extent also is it important to
retain a std C fallback (i.e., one requiring no porting effort).

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



[issue5366] setupscript examples for dependency keywords in setup.py

2009-02-26 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

 Another thing for setupscript is to state that long_description is
 actually ReStructured text.

I can be free text. If it's ReStructured text it will be parsed by PyPI
but this is it;

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



[issue5366] setupscript examples for dependency keywords in setup.py

2009-02-26 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

For the requires and provides, I am afraid no one really uses theses
option, and they might get deprecated at some point. So I don't think it
worth adding an example for it

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



[issue5379] Multicast example mcast.py is outdated and ugly

2009-02-26 Thread Philipp Hagemeister

New submission from Philipp Hagemeister phi...@phihag.de:

The multicast example Demo/sockets/mcast.py
1. mentions that multicast is only implemented on SGI (and optional on
other systems). That is not the case anymore.
2. Includes completely unrelated code for broadcast transmission. There
is already an example for that, suitably named broadcast.py (in the same
directory).
3. Does only support IPv4.
4. Is borderline buggy. Line 85 only works by accident. Similarly, line
37 fails if the TTL would be increased to 127.
5. Is ugly. Line 79-81 are an example of how not to write python code,
line 62 can be deleted without changing the program's semantics.
(All line numbers refer to rev70006)

The attached patch removes broadcast support in mcast.py, adds IPv6
support and fixes all other problems mentioned above.

--
components: Demos and Tools
files: mcast-example.diff
keywords: patch
messages: 82810
nosy: phihag
severity: normal
status: open
title: Multicast example mcast.py is outdated and ugly
type: behavior
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file13198/mcast-example.diff

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



[issue5379] Multicast example mcast.py is outdated and ugly

2009-02-26 Thread Gregory P. Smith

Gregory P. Smith g...@krypto.org added the comment:

heh yuck that code was ancient.  thanks for the update, i'll submit it.

--
assignee:  - gregory.p.smith
nosy: +gregory.p.smith

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



[issue5379] Multicast example mcast.py is outdated and ugly

2009-02-26 Thread Gregory P. Smith

Changes by Gregory P. Smith g...@krypto.org:


--
priority:  - normal

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Rob Renaud

Rob Renaud rren...@google.com added the comment:

I did a search on Google code for the DictReader constructor.  I
analyzed the first 3 pages, the fieldnames parameter was used in 14 of
27 cases (discounting unittest code built into Python) and was not
used in 13 of 27 cases.  I suppose that means headered csv files are
sufficiently rare that they shouldn't be created implicitly by
default.  I still don't like the lack of symmetry of supporting
implicit header reads, but not implicit header writes.

On Thu, Feb 26, 2009 at 8:00 PM, Skip Montanaro rep...@bugs.python.org wrote:

 Skip Montanaro s...@pobox.com added the comment:

 More concretely, I don't think this is so onerous:

names = [col1, col2, color]
writer = csv.DictWriter(open(f.csv, wb), fieldnames=names, ...)
writer.writerow(dict(zip(names, names)))
...

 or

f = open(f.csv, rb)
names = csv.reader(f).next()
reader = csv.DictReader(f, fieldnames=names, ...)
...

 Skip

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


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



[issue5366] setupscript examples for dependency keywords in setup.py

2009-02-26 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

I have added more details in r70007. Thanks!

notice that setupscript mentions that long_description is rest:


‘long string’
Multiple lines of plain text in reStructuredText format (see
http://docutils.sf.net/).


--
status: open - closed

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

 I don't think you should write them by default.  
 I've worked with lots of CSV files which have no headers. 

My experience has been the same as Skips.

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



[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-02-26 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

I'll deal with it eventually.

--
assignee:  - benjamin.peterson

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



[issue5213] _resolve_name in importlib/__init__.py left an index on rindex usage

2009-02-26 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Fixed in 70011.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue1580] Use shorter float repr when possible

2009-02-26 Thread Preston Briggs

Preston Briggs prest...@google.com added the comment:

This all started with email to Guido that y'all didn't see,
wherein I wondered if Python was interested in such a thing.
Guido said: Sure, in principle, please see the discussion associated
with this change.

I probably don't have all the required expertise today,
but I am patient and persistent.  I wouldn't be very fast either,
'cause I have other things on my plate.  Nevertheless, it seems like
an interesting project and I'm happy to work on it.

If Mark or someone else wants to jump in, that's fine too.

Preston

Added file: http://bugs.python.org/file13199/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1580
___This all started with email to Guido that y#39;all didn#39;t see,brwherein 
I wondered if Python was interested in such a thing.brGuido said: Sure, in 
principle, please see the discussion associatedbrwith this change.br
brI probably don#39;t have all the required expertise today,brbut I am 
patient and persistent.  I wouldn#39;t be very fast either,br#39;cause I 
have other things on my plate.  Nevertheless, it seems likebran interesting 
project and I#39;m happy to work on it.br
brIf Mark or someone else wants to jump in, that#39;s fine 
too.brbrPrestonbrbrbr
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2009-02-26 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

I am currently doing a review of the patch over at
http://codereview.appspot.com/22042 .

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



[issue1818] Add named tuple reader to CSV module

2009-02-26 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

Rob I still don't like the lack of symmetry of supporting implicit
Rob header reads, but not implicit header writes.

A header is nothing more than a row in the CSV file with special
interpretation applied by the user.  There is nothing implicit about it.
If you know the first line is a header, use the recipe I posted.  If not,
supply your own fieldnames and treat the first row as data.

Skip

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



[issue5358] Unicode control characters are not allowed as identifiers

2009-02-26 Thread Baiju M

Baiju M baiju.m.m...@gmail.com added the comment:

On a further look at this issue, I understood Python cannot use all
Unicode control characters as identifiers.  But for many international
languages, without some control characters like ZWJ  ZWNJ [1], it won't
be possible to construct all characters with proper visual
representation.  So, if Python really want to support international
characters as identifiers (for some reason), ZWJ  ZWNJ are unavoidable,
may be some other characters also.

 [1] http://en.wikipedia.org/wiki/Zero-width_joiner
 http://en.wikipedia.org/wiki/Zero-width_non-joiner

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-02-26 Thread Thomas Heller

Changes by Thomas Heller thel...@ctypes.org:


--
components:  -ctypes
nosy:  -theller

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-02-26 Thread Thomas Heller

Changes by Thomas Heller thel...@ctypes.org:


--
assignee: theller - 

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



[issue5358] Unicode control characters are not allowed as identifiers

2009-02-26 Thread Baiju M

Baiju M baiju.m.m...@gmail.com added the comment:

I think RFC-3454 [1] can be used as a base for selecting the control
characters which can be used as a valid identifier character.

 [1] http://www.rfc-editor.org/rfc/rfc3454.txt

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



[issue5358] Unicode control characters are not allowed as identifiers

2009-02-26 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Valid identifiers should begin with a letter or '_' and contain only
letters, numbers and '_'. This probably means that only the Unicode
characters that belong to the categories Ll, Lu (Letter Lower/Upper
case), Nd (Number, Decimal Digit) and Pc (Punctuation, Connector) - and
possibly other categories like Lm, Lt, No and Nl - are valid.

Some examples:
 a-b = 5 # U+FF0D, Cat: Pd, FULLWIDTH HYPHEN-MINUS
SyntaxError: invalid character in identifier
 a# = 5 # U+FF03, Cat: Po, FULLWIDTH NUMBER SIGN
SyntaxError: invalid character in identifier
 a)b = 5 # U+FF09, Cat: Pe, FULLWIDTH RIGHT PARENTHESIS
SyntaxError: invalid character in identifier
 a_b = 5 # U+FF3F, Cat: Pc, FULLWIDTH LOW LINE
 a_b
5
 a﹍b﹎c﹏d = 5 # U+FE4D, U+FE4E, U+FE4F, Cat: Pc
 a﹍b﹎c﹏d
5

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



[issue5334] array.fromfile() fails to insert values when EOFError is raised

2009-02-26 Thread Zac Medico

Zac Medico zmed...@gentoo.org added the comment:

Thanks for the patch. It works for me.

--
components: +Library (Lib) -Extension Modules
versions:  -Python 3.1

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