[issue5380] array.fromfile() on master pty raises IOError when slave pty device is closed

2009-02-27 Thread Zac Medico

New submission from Zac Medico :

With python-3.0, array.fromfile() raises an IOError when reading from a
master pty device after the slave device has been closed. This causes
remaining data that had been written to the slave device to be lost. I
have observed this problem with python-3.0.1 on linux (I get the same
result with or without the patch from issue 5334). The traceback
produced by the attached test case looks like this:

Traceback (most recent call last):
File "./fromfile_pty_ioerror.py", line 26, in 
buf.fromfile(master_file, bufsize)
File "/usr/lib/python3.0/io.py", line 918, in read
return self._read_unlocked(n)
File "/usr/lib/python3.0/io.py", line 952, in _read_unlocked
chunk = self.raw.read(wanted)
IOError: [Errno 5] Input/output error

With python-2.x, the remaining data is appended to the array and an
EOFError is raised like one would expect.

--
components: Library (Lib)
files: fromfile_pty_ioerror.py
messages: 82824
nosy: zmedico
severity: normal
status: open
title: array.fromfile() on master pty raises IOError when slave pty device is 
closed
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file13200/fromfile_pty_ioerror.py

___
Python tracker 

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



[issue5381] json need object_pairs_hook

2009-02-27 Thread Raymond Hettinger

New submission from Raymond Hettinger :

If PEP372 goes through, Python is going to gain an ordered dict soon.

The json module's encoder works well with it:

>>> items = [('one', 1), ('two', 2), ('three',3), ('four',4), ('five',5)]
>>> json.dumps(OrderedDict(items))
'{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}'

But the decoder doesn't fare so well.  The existing object_hook for the
decoder passes in a dictionary instead of a list of pairs.  So, all the
ordering information is lost:

>>> jtext = '{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}'
>>> json.loads(jtext, object_hook=OrderedDict)
OrderedDict({u'four': 4, u'three': 3, u'five': 5, u'two': 2, u'one': 1})

A solution is to provide an alternate hook that emits a sequence of
pairs.  If present, that hook should run instead of object_hook.  A
rough proof-of-concept patch is attached.

FWIW, sample ordered dict code is at: 
  http://code.activestate.com/recipes/576669/

--
assignee: bob.ippolito
components: Library (Lib)
files: json_hook.diff
keywords: patch
messages: 82825
nosy: bob.ippolito, rhettinger
priority: normal
severity: normal
status: open
title: json need object_pairs_hook
type: feature request
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file13201/json_hook.diff

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

I think this is not array modules' bug. Attached test program outputs
different results on trunk/py3k.

debian:~/python-dev/trunk# ./python /mnt/windows/simple_test.py
os.pipe: success
pty.openpty: success

debian:~/python-dev/py3k# ./python /mnt/windows/simpled_test.py
b'os.pipe: success'
Traceback (most recent call last):
  File "/mnt/windows/simpled_test.py", line 17, in 
gotdata = master_file.read(len(data) + 1)
  File "/root/python-dev/py3k/Lib/io.py", line 918, in read
return self._read_unlocked(n)
  File "/root/python-dev/py3k/Lib/io.py", line 952, in _read_unlocked
chunk = self.raw.read(wanted)
IOError: [Errno 5] Input/output error

And if you use io.open instead of os.fdopen, you can see same error
happens on trunk. So I think this is io module's bug. (py3k is using io
module deeply)

--
nosy: +ocean-city
title: array.fromfile() on master pty raises IOError when slave pty device is 
closed -> pty.read raises IOError when slave pty device is closed
Added file: http://bugs.python.org/file13202/simple_test.py

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

This OSError(5) happens when we tries to read from pty after data runs out.
So simple_test_2.py fails with same error even if we don't use io module.

Modules/posixmodule.c (posix_read) simply calls read(2) once, but io module

while avail < n:
chunk = self.raw.read(wanted)
if chunk in empty_values:
nodata_val = chunk
break
avail += len(chunk)
chunks.append(chunk)

chunk is shorter than wanted (data runs out), but not empty, so io
module's read tries to read again => error happens.

I said this is io module's bug, but now I'm not sure.

Added file: http://bugs.python.org/file13203/simple_test_2.py

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Hirokazu Yamamoto

Changes by Hirokazu Yamamoto :


--
nosy: +pitrou

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Interesting. The reason the io module calls read() more than once is
that BufferedReader is a generic wrapper which can be used on different
kinds of file-like objects, including sockets.

I'm not sure how to satisfy that use-case without compromising normal
error-handling behaviour. Perhaps the FileIO object, when receiving an
errno=5 on read(), should check for S_IFIFO on the fstat() result and
then return an empty string instead?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +gvanrossum

___
Python tracker 

___
___
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-27 Thread Mark Dickinson

Mark Dickinson  added the comment:

Why do you care whether the result is an int or a long in this case? 
Does it affect any code that you know of in a meaningful way?

> And why the difference in this behavior between 2.5.1 and 2.5.2.

There were some fairly major changes (many bugfixes, new functions to
comply with an updated specification, for example, pow, log and log10)
to the decimal module between 2.5 and 2.6, and the majority of those
changes were also backported to 2.5.2.  This particular change was part
of a set of changes that changed the internal representation of the
coefficient of a Decimal instance from a tuple to a string, for speed
reasons.  See r59144.

As Victor says, this is trivial to fix;  I'm not convinced that it's
actually worth fixing, though.  In Python 2.5, the difference between
ints and longs should be almost invisible anyway.  It's nice (for
performance reasons) if small integers are represented as ints rather
than longs.  Since this one's only just a small integer, it's difficult
to care much.  :-)

--
components: +Library (Lib) -Interpreter Core
nosy: +marketdickinson, rhettinger
versions: +Python 2.7 -Python 2.5

___
Python tracker 

___
___
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-27 Thread Mark Dickinson

Mark Dickinson  added the comment:

For anyone who does care about this, it should be noted that
the Fraction type has similar issues.  The following comes from Python
2.7 on a 64-bit machine:

>>> int(Fraction(2**63-1))
9223372036854775807L
>>> int(2**63-1)
9223372036854775807

___
Python tracker 

___
___
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-27 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

And we're back in PEP 291 !

see r70019, r70017 and r70021

--
status: open -> closed

___
Python tracker 

___
___
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-27 Thread Mark Dickinson

Mark Dickinson  added the comment:

I'd be interested in working with Preston on adapting David Gay's code.

(I'm interested in looking at this anyway, but I'd much prefer to do it
in collaboration with someone else.)

It would be nice to get something working before the 3.1 betas, but that
seems a little optimistic.   2.7 and 3.2 are more likely targets.

Preston, are you going to be at PyCon?

___
Python tracker 

___
___
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-27 Thread Steve Owens

Steve Owens  added the comment:

I am attaching the diff file for the Docs/library/curses.rst as 
lib_curses_rst.diff

Added file: http://bugs.python.org/file13204/lib_curses_rst.diff

___
Python tracker 

___
___
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-27 Thread Steve Owens

Steve Owens  added the comment:

I am attaching the Docs/howto/curses.rst file as howto_curses_rst.diff

Added file: http://bugs.python.org/file13205/howto_curses_rst.diff

___
Python tracker 

___
___
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-27 Thread Steve Owens

Changes by Steve Owens :


Removed file: http://bugs.python.org/file13205/howto_curses_rst.diff

___
Python tracker 

___
___
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-27 Thread Steve Owens

Changes by Steve Owens :


Added file: http://bugs.python.org/file13206/howto_curses_rst.diff

___
Python tracker 

___
___
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-27 Thread Steve Owens

Changes by Steve Owens :


Added file: http://bugs.python.org/file13207/whatsnew_2_7_rst.diff

___
Python tracker 

___
___
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-27 Thread Steve Owens

Changes by Steve Owens :


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

___
Python tracker 

___
___
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-27 Thread Steve Owens

Changes by Steve Owens :


Removed file: http://bugs.python.org/file13174/color_set_patch.diff

___
Python tracker 

___
___
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-27 Thread Steve Owens

Steve Owens  added the comment:

I am not familiar with the process here, but I would like to continue 
to add additional support to the _cursesmodule.c file.  However, I am 
loathe to put too much functionality into any one patch.  Is there any 
way I can find out when this patch will be applied so that I can get 
latest and then move forward incrementally?

___
Python tracker 

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



[issue5361] Obsolete mispelled in string formatting docs

2009-02-27 Thread Georg Brandl

Georg Brandl  added the comment:

Thanks, fixed in r70022.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5382] Allow Python keywords as keyword arguments for functions.

2009-02-27 Thread David Kerkeslager

New submission from David Kerkeslager :

This problem arose in this thread:
http://www.python-forum.org/pythonforum/viewtopic.php?f=2&t=11606

Basically, we have the following function which will generate an XHTML 
node:

def xhtmlNode(tag, **attr):...

If we call:

xhtmlNode('div',class='sidebar')

... it should generate the xhtml:



However, this isn't possible because the 'class' keyword in Python 
blocks it.  Since this is a key in a dictionary (attr['class']) this 
shouldn't be a problem.  As far as I know, there is no parsing issue 
with this either.

Could we allow Python keywords to be keyword arguments?  The use case 
above shows that this is useful in a real-life situation.

--
components: Interpreter Core
messages: 82837
nosy: Imagist
severity: normal
status: open
title: Allow Python keywords as keyword arguments for functions.
type: feature request
versions: Python 3.0, Python 3.1

___
Python tracker 

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



[issue5363] Documentation of filecmp.compfiles missing word & possible explanation

2009-02-27 Thread Georg Brandl

Georg Brandl  added the comment:

That was really a suboptimal documentation :)

I reworded it and added an example in r70023. (I suspect it's still not
as clear as if the actual five lines of implementation were given ;)

--
assignee: tarek -> georg.brandl
nosy: +georg.brandl
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5383] Allow intermixing of keyword arguments and vargarg arguments

2009-02-27 Thread David Kerkeslager

New submission from David Kerkeslager :

This problem arose in this thread:
http://www.python-forum.org/pythonforum/viewtopic.php?f=2&t=11606

Basically, we have the following function which will generate an XHTML 
node:

def xhtmlNode(tag, *content, **attr):...

If we call:

xhtmlNode('div',id='sidebar','Hello, world')

... it should generate the xhtml:

Hello, world

However, this isn't possible because the keyword argument isn't allowed 
to come before the 'vararg' argument.  We could do this:

xhtmlNode('div','Hello, world',id='sidebar')

... but this would not have symmetry with the generated xhtml and 
therefore complicates the code.  The solution, in my opinion, is to 
allow varargs to be intermixed with keyword args.  The above real-world 
example shows a use-case for this more flexible functionality.

If the following rules apply, there shouldn't be any issues:
1. Positional arguments must be in their position (positional arguments 
must come before all 'vararg' arguments and keyword arguments).
2. Varargs come in the order in which they are received, ignoring any 
keyword arguments that are intermixed.
3. Keyword arguments order doesn't matter (a dictionary isn't ordered).  
They can be intermixed with varargs.

Thus the following call:

xhtmlNode('div',id='sidebar',style='width:100px;float:left;','Hello,worl
d',xhtmlNode('p','Hello, world'))

... would result in the following html:

 Hello, world 
Hello, world

--
messages: 82839
nosy: Imagist
severity: normal
status: open
title: Allow intermixing of keyword arguments and vargarg arguments

___
Python tracker 

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



[issue5383] Allow intermixing of keyword arguments and vargarg arguments

2009-02-27 Thread David Kerkeslager

Changes by David Kerkeslager :


--
type:  -> feature request
versions: +Python 3.0, Python 3.1

___
Python tracker 

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



[issue5357] Last paragraph of urllib.request.urlopen documentation is garbled

2009-02-27 Thread Georg Brandl

Georg Brandl  added the comment:

That paragraph was a slight bit incomprehensible :)

Fixed in r70024.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5383] Allow intermixing of keyword arguments and vargarg arguments

2009-02-27 Thread David Kerkeslager

Changes by David Kerkeslager :


--
components: +Interpreter Core

___
Python tracker 

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



[issue5344] typo in what's new in 2.6

2009-02-27 Thread Georg Brandl

Georg Brandl  added the comment:

Thanks, fixed in r70025.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5358] Unicode control characters are not allowed as identifiers

2009-02-27 Thread Matthew Barnett

Matthew Barnett  added the comment:

The definition of a word in the new re module (actually targetted at
Python 2.7) is currently a sequence of L&, N&, M& and Pc.

I suppose ideally we want the definitions of a word and an identifier to
be basically the same, except that an identifier can't start with N&.

--
nosy: +mrabarnett

___
Python tracker 

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



[issue5365] add conversion table to time module docs

2009-02-27 Thread Georg Brandl

Georg Brandl  added the comment:

Thanks, added the table in r70026.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5364] documentation in epub format

2009-02-27 Thread Georg Brandl

Georg Brandl  added the comment:

Well, the request is valid, so I'll leave this open here.

Since the format seems to me to be nothing but XHTML with a bit of extra
markup around it, it would be quite easy to write a builder for Sphinx
(by copying from the HTML help one) to do it. Would you like to try that?

___
Python tracker 

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



[issue5382] Allow Python keywords as keyword arguments for functions.

2009-02-27 Thread David W. Lambert

David W. Lambert  added the comment:

Use cases are easy to find.
So easily found that there's probably a sound reason for reserved words.
The proposal couples lexical analysis to the parser.

# syntax error or name error?

def f():
class
return

def f(class):
class
return

--
nosy: +LambertDW

___
Python tracker 

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



[issue5382] Allow Python keywords as keyword arguments for functions.

2009-02-27 Thread Matthew Barnett

Matthew Barnett  added the comment:

The usual trick is to append "_":

xhtmlNode('div',class_='sidebar')

Could you modify the function to remove the trailing "_"?

--
nosy: +mrabarnett

___
Python tracker 

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



[issue5360] RO (shorthand for READONLY) gone, not in documentation

2009-02-27 Thread Georg Brandl

Georg Brandl  added the comment:

Removed RO in r70027. Fixed HEAD_INIT stuff in r70028.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5382] Allow Python keywords as keyword arguments for functions.

2009-02-27 Thread David W. Lambert

David W. Lambert  added the comment:

You can sneak them in thusly:


def f(**kwargs):
print(kwargs)

f(**{'class':'sidebar'})

___
Python tracker 

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



[issue5384] mmap and exception type

2009-02-27 Thread Hirokazu Yamamoto

New submission from Hirokazu Yamamoto :

It seems mmap module is using inappropriate exception types. For example,

if (! (PyString_Check(v)) ) {
PyErr_SetString(PyExc_IndexError,
"mmap slice assignment must be a string");
return -1;
}

I think this should be PyExc_TypeError.

if (self->size >= pos && count > self->size - pos) {
PyErr_SetString(PyExc_ValueError,
"source or destination out of range");
return NULL;

I think this is out of range, so PyExc_IndexError.

Of course, there is the case difficult to determine which exception is
suitable. For example, if Py_ssize_t is negative value, OverflowError or
IndexError?

--
messages: 82849
nosy: ocean-city
severity: normal
status: open
title: mmap and exception type
type: behavior
versions: Python 2.7, Python 3.1

___
Python tracker 

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



[issue804543] invalid use of setlocale

2009-02-27 Thread Akira Kitada

Akira Kitada  added the comment:

If I'm not mistaken, this bug seems to be fre-introduced in
"release30-maint/Modules/python.c".
It could be fixed in just as it was before.

--
components: +Interpreter Core -None
nosy: +akitada
type:  -> behavior
versions: +Python 2.6, Python 2.7, Python 3.0, Python 3.1

___
Python tracker 

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



[issue5382] Allow Python keywords as keyword arguments for functions.

2009-02-27 Thread Georg Brandl

Georg Brandl  added the comment:

This is not going to happen:

First, function call syntax is nicely parallel to parameter definition
syntax, and it is obviously not possible to define parameters named like
keywords.

Second, making exceptions like this leads to more exceptions and finally
inconsistencies. People will say "if it's allowed here, why not there
too, where it is grammatically unambiguous". Quoting the Zen: Special
cases aren't special enough to break the rules.


PS: In addition to what David Lambert and Matthew said, you could also
lower() all attributes on generation and use

xhtmlNode('div', Class='sidebar')

--
nosy: +georg.brandl
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue5385] mmap can crash after resize failure (windows)

2009-02-27 Thread Hirokazu Yamamoto

New submission from Hirokazu Yamamoto :

On windows, after mmap.resize fails, self->map_handle
becomes NULL, but it should become INVALID_HANDLE_VALUE otherwise
CHECK_VALID is passed through, it can cause crash like bellow.

import mmap
m = mmap.mmap(-1, 5)
try:
m.resize(-1)
except WindowsError:
pass
m[0] = '1' # crash

The patch is in r69942.

--
components: Extension Modules
messages: 82852
nosy: ocean-city
severity: normal
status: open
title: mmap can crash after resize failure (windows)
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

___
Python tracker 

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



[issue5385] mmap can crash after resize failure (windows)

2009-02-27 Thread Hirokazu Yamamoto

Changes by Hirokazu Yamamoto :


--
type:  -> crash

___
Python tracker 

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



[issue5386] mmap can crash with write_byte

2009-02-27 Thread Hirokazu Yamamoto

New submission from Hirokazu Yamamoto :

mmap.write_byte doesn't check buffer size, so it can cause crash like
bellow.

import mmap
m = mmap.mmap(-1, 1)
for i in xrange(1): # enough?
print i
m.write_byte('1') # crash

The patch is in r69945.

--
components: Extension Modules
messages: 82853
nosy: ocean-city
severity: normal
status: open
title: mmap can crash with write_byte
type: crash
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

___
Python tracker 

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



[issue5387] mmap.move crashes by integer overflow

2009-02-27 Thread Hirokazu Yamamoto

New submission from Hirokazu Yamamoto :

mmap.move crashes by integer overflow. See
http://www.nabble.com/Segv-in-mmap.move()-td18617044.html

import mmap
data = mmap.mmap(-1, 1)
data.move(1,1,-1) # crash

Maybe mmap.move should use Py_ssize_t and raise
IndexError(OverflowError?) for negative value.

The patch is in r69943.

--
components: Extension Modules
messages: 82854
nosy: ocean-city
severity: normal
status: open
title: mmap.move crashes by integer overflow
type: crash
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

___
Python tracker 

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



[issue804543] invalid use of setlocale

2009-02-27 Thread Georg Brandl

Changes by Georg Brandl :


--
resolution: accepted -> 
status: closed -> open

___
Python tracker 

___
___
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-27 Thread Skip Montanaro

Changes by Skip Montanaro :


--
nosy:  -skip.montanaro

___
Python tracker 

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



[issue804543] invalid use of setlocale

2009-02-27 Thread Georg Brandl

Georg Brandl  added the comment:

Fixed in r70029, merged to 3.0 in r70030.

--
nosy: +georg.brandl
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5383] Allow intermixing of keyword arguments and vargarg arguments

2009-02-27 Thread David W. Lambert

David W. Lambert  added the comment:

I think you need this order preserving paradigm using python as is: 

def xhtmlNode(tag,*args):
...

xhtmlNode('div', {'id':'sidebar'}, 'Hello world')


Less work in xhtmlNode might offset the extra work in writing the
function call.  Oh well, I didn't read the pythonforum thread.

--
nosy: +LambertDW

___
Python tracker 

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



[issue5383] Allow intermixing of keyword arguments and vargarg arguments

2009-02-27 Thread Ezio Melotti

Ezio Melotti  added the comment:

> xhtmlNode('div','Hello, world',id='sidebar')

> ... but this would not have symmetry with the generated xhtml and 
> therefore complicates the code.  The solution, in my opinion, is to 
> allow varargs to be intermixed with keyword args.  The above real-world 
> example shows a use-case for this more flexible functionality.

IMHO your API is confusing in the first place, if xhtmlNode is supposed
to create an XHTML element (possibly with attributes), why would you
want to pass also the content as a positional argument?

I would probably keep the element and its content separate and do
something like:
div = xhtmlNode('div', **attributes)
div.add(TextNode('Hello World'))

or, if you want a shortcut:
xhtmlNode('div', id='sidebar', content='Hello world') or
xhtmlNode('div', id='sidebar', text='Hello world')

--
nosy: +ezio.melotti

___
Python tracker 

___
___
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-27 Thread Martin v. Löwis

Martin v. Löwis  added the comment:

See PEP 3131 for a specification what is an identifier in Python.

Closing this as "won't fix".

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue5382] Allow Python keywords as keyword arguments for functions.

2009-02-27 Thread David Kerkeslager

David Kerkeslager  added the comment:

Thank you all for reading and responding to my submission.

I post the following without expectation of results, only to expand my 
reasoning:

The following aren't applicable to the situation I described:

def f():
class
return

def f(class):
class
return

The are not applicable because inside the function, "class" would always 
be contained in a string (as a key of the kwargs dictionary).

To explain further, for:

def f(**kwargs):
 print(kwargs['foo'])
f(foo='bar')

This isn't a problem.  So why is this a problem?

def f(**kwargs):
 print(kwargs['class'])
f(class='foo')

In response to Mr. Brandl's statements:

> First, function call syntax is nicely parallel to parameter definition
> syntax, and it is obviously not possible to define parameters named 
like
> keywords.

For normal arguments this is true:  def a(b,c) is called with 
a(,).  But this parallel breaks down when you introduce variable 
arguments def a(*b) is called a(,,).  And it breaks down 
even more when you add keyword arguments.  def a(**b) is called 
a(=,=) At this point, where's the 
parallel?

If anything, there's a parallel between the keywords and the dictionary 
keys, which, as strings, can contain anything.  We obviously have to 
limit this a bit to keep the overall syntax unambiguous, but restricting 
out keywords isn't necessary.  You're essentially preventing us from 
putting keywords in a string.

> Second, making exceptions like this leads to more exceptions and 
finally
> inconsistencies. People will say "if it's allowed here, why not there
> too, where it is grammatically unambiguous". Quoting the Zen: Special
> cases aren't special enough to break the rules.

Allowing keywords as keyword arguments isn't an exception to the rule; 
NOT allowing them is the exception.  "class" is a perfectly valid 
dictionary key, and given that there's no syntactic reason not to allow 
this, why do so?

___
Python tracker 

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



[issue5381] json need object_pairs_hook

2009-02-27 Thread Bob Ippolito

Bob Ippolito  added the comment:

Why? According to RFC (emphasis mine):

An object is an *unordered* collection of zero or more name/value
   pairs, where a name is a string and a value is a string, number,
   boolean, null, object, or array.

--
resolution:  -> invalid

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Guido van Rossum

Guido van Rossum  added the comment:

IIUC the problem is that a read() syscall on the pty after the other end
has been closed raises an error instead of reading 0 bytes?  Isn't that
a bug in the pty implementation? For lots of devices (e.g. sockets,
pipes) a short non-empty read just means that you have to call read()
again to get more data -- it does not mean EOF.

___
Python tracker 

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



[issue5382] Allow Python keywords as keyword arguments for functions.

2009-02-27 Thread Matthew Barnett

Matthew Barnett  added the comment:

The normal use of a keyword argument is to refer to a formal argument,
which is an identifier. Being able to wrap it up into a dict is a later
addition, and it's necessary to turn the identifier into a string
because it's not possible to use a bare word (as Perl would call it) as
a key (I can't think of any other place where something is automatically
turned into a string). Of course, another approach would've been to make
them attributes of the formal argument:

def foo(**args):
print "a is %s" % args.a

foo(a=1)

As for it being an exception to the rule, well, many things can be a
key: an integer could be a key. Would foo(0="zero") be OK? There's no
syntactic reason why it couldn't be allowed.

-1 from me.

___
Python tracker 

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



[issue5388] Green-box doc glitch: winhelp version only

2009-02-27 Thread Terry J. Reedy

New submission from Terry J. Reedy :

Example: LangRef / LexAnalysis / Identifiers

Green-shaded grammar section has 3 lines, 2 very long:

identifier  ::=  id_start id_continue*
id_start::=  

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone :


--
nosy: +exarkun

___
Python tracker 

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



[issue5381] json need object_pairs_hook

2009-02-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Same reason as for config files and yaml files.  Sometimes those files
represent human edited input and if a machine re-edits, filters, or
copies, it is nice to keep the original order (though it may make no
semantic difference to the computer).  

For example, jsonrpc method invocations are done with objects having
three properties (method, params, id).  The machine doesn't care about
the order of the properties but a human reader prefers the order listed:

  --> {"method": "postMessage", "params": ["Hello all!"], "id": 99}
  <-- {"result": 1, "error": null, "id": 99}

If you're testing a program that filters json data (like a typical xml
task), it is nice to write-out data in the same order received (failing
to do that is a common complaint about misdesigned xml filters):

  --> {{"title": "awk", "author":"aho", "isbn":"123456789X"},
   {"title": "taocp", "author":"knuth", "isbn":"987654321X"}"
  <-- {{"title": "awk", "author":"aho"},
   {"title": "taocp", "author":"knuth"}}
   
Semantically, those entries can be scrambled; however, someone reading
the filtered result desires that the input and output visually
correspond as much as possible.  An object_pairs_hook makes this possible.

___
Python tracker 

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



[issue5381] json need object_pairs_hook

2009-02-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

FWIW, here's the intended code for the filter in the last post:

books = json.loads(infile, object_hook=OrderedDict)
for book in books:
del book['isbn']
json.dumps(books, outfile)

___
Python tracker 

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



[issue5364] documentation in epub format

2009-02-27 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

A few days ago, Tim O'Reilly wrote a column in Forbes 
http://www.forbes.com/2009/02/22/kindle-oreilly-ebooks-technology-breakthroughs_oreilly.html
promoting epub and noting that his computer book company is starting to
use it.

I got the same impression: xhtml + extra markup for mobile readers.

--
nosy: +tjreedy

___
Python tracker 

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



[issue5364] documentation in epub format

2009-02-27 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

___
___
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-27 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The bug is the discrepancy between doc

"[3] A string literal appearing as the first statement in the function
body is transformed into the function’s __doc__ attribute and therefore
the function’s docstring. 
[4] A string literal appearing as the first statement in the class body
is transformed into the namespace’s __doc__ item and therefore the
class’s docstring. "

and behavior. In this case, I would agree that the behavior is wrong
unless somehow justified.

I verified in 3.0.1, winxp: '\x00' ok in function, not in class.

--
nosy: +tjreedy

___
Python tracker 

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



[issue1975] signals not always delivered to main thread, since other threads have the signal unmasked

2009-02-27 Thread Adam Olsen

Adam Olsen  added the comment:

The readline API just sucks.  It's not at all designed to be used
simultaneously from multiple threads, so we shouldn't even try.  Ban
using it in non-main threads, restore the blocking of signals, and go on
with our merry lives.

--
nosy: +Rhamphoryncus

___
Python tracker 

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



[issue1975] signals not always delivered to main thread, since other threads have the signal unmasked

2009-02-27 Thread Adam Olsen

Changes by Adam Olsen :


--
versions: +Python 2.6, Python 2.7, Python 3.0, Python 3.1

___
Python tracker 

___
___
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-27 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Unless there is a discrepancy between doc and behavior, this strikes me
as an unspecified implementation detail.  If so, it should be either
closed or changed to a specific feature request.

--
nosy: +tjreedy

___
Python tracker 

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



[issue5381] json need object_pairs_hook

2009-02-27 Thread Bob Ippolito

Bob Ippolito  added the comment:

Fair enough, but the patch isn't usable because the decoder was rewritten 
in a later version of simplejson. There's another issue with patch to 
backport those back into Python http://bugs.python.org/issue4136 or you 
could just use the simplejson source here http://code.google.com/p/simplejson/

--
resolution: invalid -> 

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Guido: I don't know if it can be considered as a "bug" rather than a
misguided "feature". However, at least 3 of us (the OP, Hirokazu and I)
reproduce it (as for me, it's on a quite recent x86-64 Mandriva Linux
setup), so I imagine it's not totally exotic behaviour.

___
Python tracker 

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



[issue5381] json need object_pairs_hook

2009-02-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Thanks.  I'll write-up a patch against
http://code.google.com/p/simplejson/ and assign it back to you for review.

--
assignee: bob.ippolito -> rhettinger

___
Python tracker 

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



[issue4136] merge json library with latest simplejson 2.0.x

2009-02-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks for the update. I'll try to take the time for a review in less
than one month. In the meantime, though, I want to point out that the
80-character rule should also apply to C files. You have quite a bit of
huge C code lines, especially in parsing code.

___
Python tracker 

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



[issue4136] merge json library with latest simplejson 2.0.x

2009-02-27 Thread Bob Ippolito

Bob Ippolito  added the comment:

Honestly I'm not sure when I'm going to find the time and motivation to 
reformat the C source and tests to fit < 80 char lines. I don't think this 
should hold up the patch, someone who is more obsessive compulsive than 
myself can fix that once it hits trunk :)

___
Python tracker 

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



[issue4136] merge json library with latest simplejson 2.0.x

2009-02-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I think reformatting line length should not hold-up this patch.  That is
a nice-to-have, not a must-have.

--
nosy: +rhettinger

___
Python tracker 

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



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

2009-02-27 Thread Jeff Oyama

Jeff Oyama  added the comment:

Ok after examining it more closely, it appears to be a false alarm, my
apologies

___
Python tracker 

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



[issue4136] merge json library with latest simplejson 2.0.x

2009-02-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Reviewers: ,

Description:
Updated patch from Bob Ippolito, for updating the Python trunk json
package to the latest simplejson.

Please review this at http://codereview.appspot.com/20095

Affected files:
   Lib/json/__init__.py
   Lib/json/decoder.py
   Lib/json/encoder.py
   Lib/json/scanner.py
   Lib/json/tests/test_check_circular.py
   Lib/json/tests/test_decode.py
   Lib/json/tests/test_dump.py
   Lib/json/tests/test_encode_basestring_ascii.py
   Lib/json/tests/test_fail.py
   Lib/json/tests/test_float.py
   Lib/json/tests/test_unicode.py
   Lib/json/tool.py
   Modules/_json.c

___
Python tracker 

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



[issue1975] signals not always delivered to main thread, since other threads have the signal unmasked

2009-02-27 Thread Guido van Rossum

Guido van Rossum  added the comment:

Agreed.  Multiple threads trying to read interactive input from a
keyboard sounds like a bad idea anyway.

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Guido van Rossum

Guido van Rossum  added the comment:

That may be how it works, but how do you expect to deal with it?

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, as I suggested, in FileIO.read(): when receiving errno=5 on a
read() call and if S_IFIFO() returns true, clear errno and return an
empty string.
The question is whether a genuine EIO error ("low level IO error") can
occur on a FIFO. Intuitively, I'd say "no" since a FIFO is only a
software communication channel, but who knows...

___
Python tracker 

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



[issue5389] Uninitialized variable may be used in PyUnicode_DecodeUTF7Stateful()

2009-02-27 Thread Guido van Rossum

New submission from Guido van Rossum :

[Found by a Googler who prefers to remain anonymous]

This might be easier to trigger on a 64-bit:

PyObject *PyUnicode_DecodeUTF7Stateful(...)
{
...
Py_ssize_t startinpos;
...
while (s < e) {
...
  utf7Error:
outpos = p-PyUnicode_AS_UNICODE(unicode);
endinpos = s-starts;
if (unicode_decode_call_errorhandler(
errors, &errorHandler,
"utf7", errmsg,
starts, size, &startinpos, &endinpos, &exc, &s,
&unicode, &outpos, &p))
...
}
...
}

The lack of initialization of startinpos will lead to the likelihood of
the value being >= INT_MAX with a 64-bit value, leading to the
subsequent assert [somewhere in unicode_decode_call_errorhandler()]. In
theory the assert could trigger in 32-bit if the uninitialized value
happened to get set to INT_MAX.

The other similar variable also probably need to be initialized.
Furthermore, the function PyUnicode_DecodeUTF8Stateful also has the same
uninitialized variables.

--
messages: 82881
nosy: gvanrossum
severity: normal
status: open
title: Uninitialized variable may be used in PyUnicode_DecodeUTF7Stateful()
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1

___
Python tracker 

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



[issue5380] pty.read raises IOError when slave pty device is closed

2009-02-27 Thread Guido van Rossum

Guido van Rossum  added the comment:

> Well, as I suggested, in FileIO.read(): when receiving errno=5 on a
> read() call and if S_IFIFO() returns true, clear errno and return an
> empty string.
> The question is whether a genuine EIO error ("low level IO error") can
> occur on a FIFO. Intuitively, I'd say "no" since a FIFO is only a
> software communication channel, but who knows...

OK, that sounds reasonable. (I missed that in the discussion on the
bug, sorry. I tend not to download files unless I actually am on the
hook for code reviewing them, so any details that were only obvious
from the patch may have gone by me.)

Of course, you should check if those symbols even exist before referencing them.

___
Python tracker 

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



[issue4565] Rewrite the IO stack in C

2009-02-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Ok, so the ABC stuff is done now.
Remaining:
- fix the test failures with the Python implementation
- the _ssl bug

___
Python tracker 

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



[issue5336] collections.namedtuple generates code causing PyChecker warnings

2009-02-27 Thread Nick Coghlan

Nick Coghlan  added the comment:

Completely unrelated to the topic at hand, but that command line can be
written more concisely as:

E:\Python26\python.exe -m pychecker.checker test.py 

(pychecker was actually the number 1 use case when it came to justifying
the expansion of -m to modules inside packages)

As for the actual topic of the bug report... using 't' for tuple
(instead of the more common 'self') seems like a perfectly reasonable
name for the first argument to _asdict(). Expanding it to 'self' doesn't
really improve readability all that much - it just makes the self
references take up more visual space relative to the attribute names.

def _asdict(self):
  'Return a new dict which maps field names to their values'
  return {'id': self[0], 'date': self[1], 'name': self[2], 'desc': self
[3]}

Pychecker and friends are probably going to want to recognise namedtuple
instances and silence this warning by default anyway (since even if it
does get changed, there will still be plenty of Python installations out
there which will still generate the warning).

--
nosy: +ncoghlan

___
Python tracker 

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



[issue5381] json need object_pairs_hook

2009-02-27 Thread Armin Ronacher

Armin Ronacher  added the comment:

Motivation:

Yes.  JSON says it's unordered.  However Hashes in Ruby are ordered
since 1.9 and they were since the very beginning in JavaScript and PHP.

--
nosy: +aronacher

___
Python tracker 

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



[issue5251] contextlib.nested inconsistent with, well, nested with statements due exceptions raised in __enter__

2009-02-27 Thread Nick Coghlan

Nick Coghlan  added the comment:

I'll be working on a PEP for 2.7/3.1 to try to get the semantics of with
statement changed as suggested.

http://mail.python.org/pipermail/python-dev/2009-February/086470.html

___
Python tracker 

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



[issue4136] merge json library with latest simplejson 2.0.x

2009-02-27 Thread Daniel Diniz

Daniel Diniz  added the comment:

FWIW, following simplejson's SVN history[1] makes understanding the
(bits of the) patch (that I had time to look at) much easier to me.

I recall other JSON packages having lots of cornercase tests, not sure
if they'd be relevant here. But sprinkling a few more tests around might
help digest these changes :)

[1] http://code.google.com/p/simplejson/source/list?start=123

--
nosy: +ajaksu2

___
Python tracker 

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



[issue1975] signals not always delivered to main thread, since other threads have the signal unmasked

2009-02-27 Thread Ross Hayden

Changes by Ross Hayden :


--
nosy: +ross

___
Python tracker 

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



[issue4715] optimize bytecode for conditional branches

2009-02-27 Thread Jeffrey Yasskin

Jeffrey Yasskin  added the comment:

Collin made some comments at http://codereview.appspot.com/20094. Here's
a new patch that fixes them. I plan to commit it over the weekend and
then start on issue 2459.

Added file: http://bugs.python.org/file13208/trunk-opt-cond-jump.patch

___
Python tracker 

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



[issue4715] optimize bytecode for conditional branches

2009-02-27 Thread Jeffrey Yasskin

Changes by Jeffrey Yasskin :


Removed file: http://bugs.python.org/file13182/trunk-opt-cond-jump.patch

___
Python tracker 

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



[issue5370] unpickling vs. __getattr__

2009-02-27 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

The __getattr__ method, as written, assumes that an attribute 'args' 
already exists. That's unsafe - a more robust approach would be:

def __getattr__(self, name):
if 'attrs' in self.__dict__ and name in self.attrs:
return self.attrs[name]
raise AttributeError(name)

The suggestion of using hasattr in pickle code doesn't work, because 
hasattr is implemented using getattr.

I could not reproduce it with 2.6, nor the trunk -- there is another 
recursion problem involving __subclasscheck__ but unpickling is 
unaffected. 3.0 does show this problem. FWIW, 2.2 did not.

--
nosy: +gagenellina

___
Python tracker 

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



[issue5390] Item 'Python x.x.x' in Add/Remove Programs list still lacks an icon

2009-02-27 Thread Retro

New submission from Retro :

I am reporting a bug which was not fixed in the closed issue #4389.
Martin v. Löwis, the fix you've made didn't fix the issue. Please open
your Add/Remove Programs list (hopefully your running Windows and have
Python installed there) and check whether your Python interpreters in
this list use Python's icon. Your fix was made before Python 2.5.4,
Python 2.6.1, and Python 3.0.1 were out. I don't know why these new
interpreters (installed on my Windows Vista Business 64-bit machine)
don't show Python's icon in the Add/Remove Programs list. Is this an
issue on my side or on Python's side?

--
messages: 82890
nosy: Retro, loewis
severity: normal
status: open
title: Item 'Python x.x.x' in Add/Remove Programs list still lacks an icon
versions: 3rd party, Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 
3.0, Python 3.1

___
Python tracker 

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



[issue5390] Item 'Python x.x.x' in Add/Remove Programs list still lacks an icon

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

Martin v. Löwis  added the comment:

What version specifically did you notice this in?

--
versions:  -3rd party, Python 2.4, Python 2.5

___
Python tracker 

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