[issue14419] Faster ascii decoding

2012-03-27 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 +#if SIZEOF_LONG = SIZEOF_VOID_P
 +if (!((size_t) p  LONG_PTR_MASK)) {
 
 I wrote q, not p. You have to check p and q alignement to be able
 to dereference p and q pointers.

Initial q (destination) is always pointer-aligned, because PyASCIIObject is 
pointer-aligned. If PyASCIIObject not aligned, then on this platform alignment 
does not matter. But initial p (source) can be non-aligned. If the initial p 
and q are not equally aligned, then they will not be able to be aligned in the 
future, and the whole loop shall be omitted.

 sizeof(long) = sizeof(void*) is always true.

Some memory models in I8086 processor had a 4-byte long and a 2-byte pointer. 
It is already in the past, but some modern processors can be 8-byte long and a 
4-byte pointer. I do not know, whether there are such. If you think this 
condition is unnecessary, we can remove it.

--

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



[issue13608] remove born-deprecated PyUnicode_AsUnicodeAndSize

2012-03-27 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

STINNER Victor wrote:
 
 STINNER Victor victor.stin...@gmail.com added the comment:
 
 The Py_UNICODE* type is deprecated but since Python 3.3, Py_UNICODE=wchar_t 
 and wchar_t* is a common type on Windows. PyUnicode_AsUnicodeAndSize() is 
 used to encode Python strings to call Windows functions.
 
 PyUnicode_AsUnicodeAndSize() is preferred over PyUnicode_AsWideCharString() 
 because PyUnicode_AsWideCharString() stores the result in the Unicode string 
 and the Unicode string releases the memory automatically later. Calling 
 PyUnicode_AsWideCharString() twice on the same string avoids also the need of 
 encoding the string twice because the result is cached.
 
 I proposed to add a new function using wchar_*t and storing the result in the 
 Unicode string, but the idea was rejected. I don't remember why.

Could you please clarify what you actually intend to do ? Which
function do you want to remove and why ?

The title and description of this ticket don't match :-)

--
nosy: +lemburg

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



[issue10079] idlelib for Python 3 with Guilherme Polo GSoC enhancements

2012-03-27 Thread Andrew Svetlov

Changes by Andrew Svetlov andrew.svet...@gmail.com:


--
nosy: +asvetlov

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



[issue14420] winreg SetValueEx DWord type incompatible with value argument

2012-03-27 Thread Tim Golden

Tim Golden m...@timgolden.me.uk added the comment:

Brian - I think this is your area

--
nosy: +brian.curtin, tim.golden

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



[issue14419] Faster ascii decoding

2012-03-27 Thread STINNER Victor

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

 +#if SIZEOF_LONG = SIZEOF_VOID_P
 +    if (!((size_t) p  LONG_PTR_MASK)) {

 I wrote q, not p. You have to check p and q alignement to be able
 to dereference p and q pointers.

 Initial q (destination) is always pointer-aligned, because PyASCIIObject is
 pointer-aligned. If PyASCIIObject not aligned, then on this platform alignment
 does not matter.

q is not the address of the Unicode string, but the address of the
data following the Unicode structure in memory. Strings created by
PyUnicode_New() are composed on one unique memory block: {structure,
data}. It's safer to check that q is aligned to sizeof(long). In
Python 3.2, it was different because the string data was always a
separated memory block (as not ready strings in Python 3.3).

We may change PyASCIIObject later to pack fields (to reduce memory consumption).

--

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



[issue11826] Leak in atexitmodule

2012-03-27 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 7c48bb929e6e by Stefan Krah in branch 'default':
Issue #11826: Fix memory leak in atexitmodule.
http://hg.python.org/cpython/rev/7c48bb929e6e

--
nosy: +python-dev

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



[issue14419] Faster ascii decoding

2012-03-27 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 q is not the address of the Unicode string, but the address of the
 data following the Unicode structure in memory. Strings created by
 PyUnicode_New() are composed on one unique memory block: {structure,
 data}.

I know all that.

#define _PyUnicode_COMPACT_DATA(op) \
(PyUnicode_IS_ASCII(op) ?   \
 ((void*)((PyASCIIObject*)(op) + 1)) :  \
 ((void*)((PyCompactUnicodeObject*)(op) + 1)))

q is ((void*)((PyASCIIObject*)(op) + 1)). (PyASCIIObject*)(op) + 1 is pointer 
to PyASCIIObject and has same alignment as PyASCIIObject. PyASCIIObject is 
aligned to sizeof(void *) 
because it starts with void * field. Consequently, q is aligned to sizeof(void 
*). It does not depend on the number and the size of the fields in 
PyASCIIObject, except for the 
first one.

Of course, if _PyUnicode_COMPACT_DATA definition is changed, it will cease to 
be true. Then apply my first patch, which may be a bit less effective for short 
strings 
(performance for short strings is bad measureable through Python). However, for 
short strings, we can put a size limit:

if (size = 2 * SIZEOF_LONG  ((size_t) p  LONG_PTR_MASK) == ((size_t) q  
LONG_PTR_MASK)) {

--

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



[issue11826] Leak in atexitmodule

2012-03-27 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
versions:  -Python 3.2

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



[issue14288] Make iterators pickleable

2012-03-27 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Okay, I'll go ahead, fix the 'iter()' trick api name and apply the patch.  Then 
we'll see what happens :).
Any suggestion towards what documentation changes are needed?  I don't think 
the list of pickleable objects is made explicit anywhere, it is largely a trial 
and error thing.  But obviously Misc/News is the prime candidate.
Thanks

--

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



[issue14288] Make iterators pickleable

2012-03-27 Thread Antoine Pitrou

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

 Okay, I'll go ahead, fix the 'iter()' trick api name and apply the
 patch.  Then we'll see what happens :).

Please wait for reviews.

--

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



[issue14288] Make iterators pickleable

2012-03-27 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Raymond had already reviewed it, and sbt.  I wasn't aware of any more pending 
reviews, but I'll wait for yours, of course.

--

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



[issue14422] Pack PyASCIIObject fields to reduce memory consumption of pure ASCII strings

2012-03-27 Thread STINNER Victor

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

It is possible to reduce PyASCIIObject.state to 8 bits instead of 32, move it 
to the end (exchange wstr and state) of the structure and pack the structure. 
As a result, the structure size is reduced by 3 bytes (state type changes from 
int to char).

I expect a low or not overhead on performances because only PyASCIIObject.state 
field is affected and this field size is 8 bits.

See also the issue #14419 which relies on memory alignment (of the ASCII string 
data) to optimize the ASCII decoder. If I understand correctly, my patch 
disables the possibility of this optimization.

--

Example on Linux 32 bits:

$ cat x.c 
#include Python.h

int main()
{
printf(sizeof(PyASCIIObject)=%u bytes\n, sizeof(PyASCIIObject));
printf(sizeof(PyCompactUnicodeObject)=%u bytes\n, 
sizeof(PyCompactUnicodeObject));
printf(sizeof(PyUnicodeObject)=%u bytes\n, sizeof(PyUnicodeObject));
return 0;
}

# unpatched
$ gcc -I Include/ -I . x.c -o x  ./x
sizeof(PyASCIIObject)=24 bytes
sizeof(PyCompactUnicodeObject)=36 bytes
sizeof(PyUnicodeObject)=40 bytes

# pack the 3 structures
$ gcc -I Include/ -I . x.c -o x  ./x
sizeof(PyASCIIObject)=21 bytes
sizeof(PyCompactUnicodeObject)=33 bytes
sizeof(PyUnicodeObject)=37 bytes

--

We might also pack PyCompactUnicodeObject and PyUnicodeObject but it would have 
a bad impact on performances because utf8_length, utf8, wstr_length and data 
would not be aligned anymore.

--
components: Interpreter Core
files: pack_pyasciiobject.patch
keywords: patch
messages: 156905
nosy: haypo, loewis, pitrou, storchaka
priority: normal
severity: normal
status: open
title: Pack PyASCIIObject fields to reduce memory consumption of pure ASCII 
strings
versions: Python 3.3
Added file: http://bugs.python.org/file25037/pack_pyasciiobject.patch

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



[issue14288] Make iterators pickleable

2012-03-27 Thread Antoine Pitrou

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

Well, please take a look at the review link. There are already some comments 
there.

--

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



[issue13165] Integrate stringbench in the Tools directory

2012-03-27 Thread STINNER Victor

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

Please integrate stringbench into the HG repository. I will try to improve 
after its inclusion.

--

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



[issue14422] Pack PyASCIIObject fields to reduce memory consumption of pure ASCII strings

2012-03-27 Thread STINNER Victor

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

iobench and stringbench results on unpatched Python:

$ ./python Tools/iobench/iobench.py -t
Preparing files...
Python 3.3.0a1+ (default:51016ff7f8c9, Mar 27 2012, 13:19:52) 
[GCC 4.6.1]
Unicode: PEP 393
Linux-3.0.0-16-generic-pae-i686-with-debian-wheezy-sid
Text unit = one character (utf8-decoded)

** Text input **

[ 400KB ] read one unit at a time...5.4 MB/s
[ 400KB ] read 20 units at a time... 68 MB/s
[ 400KB ] read one line at a time...174 MB/s
[ 400KB ] read 4096 units at a time...  289 MB/s

[  20KB ] read whole contents at once...315 MB/s
[ 400KB ] read whole contents at once...332 MB/s
[  10MB ] read whole contents at once...292 MB/s

[ 400KB ] seek forward one unit at a time...  0.304 MB/s
[ 400KB ] seek forward 1000 units at a time...  312 MB/s

** Text append **

[  20KB ] write one unit at a time...  3.05 MB/s
[ 400KB ] write 20 units at a time...43 MB/s
[ 400KB ] write 4096 units at a time... 554 MB/s
[  10MB ] write 1e6 units at a time...  450 MB/s

** Text overwrite **

[  20KB ] modify one unit at a time... 1.18 MB/s
[ 400KB ] modify 20 units at a time... 18.9 MB/s
[ 400KB ] modify 4096 units at a time...400 MB/s

$ ./python stringbench/stringbench.py 
stringbench v2.0
3.3.0a1+ (default:51016ff7f8c9, Mar 27 2012, 13:19:52) 
[GCC 4.6.1]
2012-03-27 13:21:01.217823
bytes   unicode
(in ms) (in ms) %   comment
== case conversion -- dense
0.370.3897.9(WHERE IN THE WORLD IS CARMEN SAN DEIGO?*10).lower() 
(*1000)
0.380.3899.3(where in the world is carmen san deigo?*10).upper() 
(*1000)
== case conversion -- rare
0.380.3899.9(Where in the world is Carmen San Deigo?*10).lower() 
(*1000)
0.430.38113.6   (wHERE IN THE WORLD IS cARMEN sAN dEIGO?*10).upper() 
(*1000)
== concat 20 strings of words length 4 to 15
1.761.69104.2   s1+s2+s3+s4+...+s20 (*1000)
== concat two strings
0.080.07107.7   Andrew+Dalke (*1000)
== count AACT substrings in DNA example
2.152.13100.7   dna.count(AACT) (*10)
== count newlines
0.650.58110.8   ...text.with.2000.newlines.count(\n) (*10)
== early match, single character
0.200.19107.9   (A*1000).find(A) (*1000)
0.360.05745.8   A in A*1000 (*1000)
0.180.1996.4(A*1000).index(A) (*1000)
0.180.2185.5(A*1000).partition(A) (*1000)
0.210.20103.6   (A*1000).rfind(A) (*1000)
0.210.3069.8(A*1000).rindex(A) (*1000)
0.370.21171.7   (A*1000).rpartition(A) (*1000)
0.380.3998.4(A*1000).rsplit(A, 1) (*1000)
0.370.37100.7   (A*1000).split(A, 1) (*1000)
== early match, two characters
0.200.19107.7   (AB*1000).find(AB) (*1000)
0.360.05702.1   AB in AB*1000 (*1000)
0.180.1996.9(AB*1000).index(AB) (*1000)
0.200.2483.9(AB*1000).partition(AB) (*1000)
0.200.20103.6   (AB*1000).rfind(AB) (*1000)
0.200.19102.9   (AB*1000).rindex(AB) (*1000)
0.200.2386.7(AB*1000).rpartition(AB) (*1000)
0.390.4097.7(AB*1000).rsplit(AB, 1) (*1000)
0.400.4294.4(AB*1000).split(AB, 1) (*1000)
== endswith multiple characters
0.170.1992.6Andrew.endswith(Andrew) (*1000)
== endswith multiple characters - not!
0.170.1895.2Andrew.endswith(Anders) (*1000)
== endswith single character
0.170.1892.3Andrew.endswith(w) (*1000)
== formatting a string type with a dict
N/A 0.910.0 The %(k1)s is %(k2)s the 
%(k3)s.%{k1:x,k2:y,k3:z,} (*1000)
== join empty string, with 1 character sep
N/A 0.040.0 A.join() (*100)
== join empty string, with 5 character sep
N/A 0.040.0 ABCDE.join() (*100)
== join list of 100 words, with 1 character sep
1.371.7180.0A.join([Bob]*100)) (*1000)
== join list of 100 words, with 5 character sep
1.501.8680.8ABCDE.join([Bob]*100)) (*1000)
== join list of 26 characters, with 1 character sep
0.480.4999.6A.join(list(ABC..Z)) (*1000)
== join list of 26 characters, with 5 character sep
0.490.5491.3ABCDE.join(list(ABC..Z)) (*1000)
== join string with 26 characters, with 1 character sep
N/A 1.170.0 A.join(ABC..Z) (*1000)
== join string with 26 characters, with 5 character sep
N/A 1.220.0 ABCDE.join(ABC..Z) (*1000)
== late match, 100 characters
8.488.46100.2   s=ABC*33; ((s+D)*500+s+E).find(s+E) (*100)
4.193.50119.9   s=ABC*33; ((s+D)*500+E+s).find(E+s) (*100)
5.305.11103.7   s=ABC*33; (s+E) in ((s+D)*300+s+E) (*100)
8.478.45

[issue13165] Integrate stringbench in the Tools directory

2012-03-27 Thread Antoine Pitrou

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

What, do you mean, please? This is exactly what this issue is about.

--

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



[issue14422] Pack PyASCIIObject fields to reduce memory consumption of pure ASCII strings

2012-03-27 Thread STINNER Victor

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

Compare stringio total: 160.84 (unpatched) vs 160.53 (patched). I don't see any 
difference in the benchmarks results. The small differnces are just the noise 
of the benchmark.

--

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



[issue13165] Integrate stringbench in the Tools directory

2012-03-27 Thread STINNER Victor

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

 What, do you mean, please? This is exactly what this issue is about.

I mean that it is a good idea to integrate the tool, I want it in
Python source tree! Go ahead.

--

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



[issue14399] zipfile and creat/update comment

2012-03-27 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

The bug only occurs for non-empty archives.

There are two ways of fixing this bug -- very simple and no so simple. Patches 
are attached.

--
keywords: +patch
nosy: +storchaka
Added file: http://bugs.python.org/file25038/fix_zipfile_comment_simple.patch

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



[issue14399] zipfile and creat/update comment

2012-03-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


Added file: http://bugs.python.org/file25039/fix_zipfile_comment_complex.patch

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



[issue14423] Getting the starting date of iso week from a week number and a year.

2012-03-27 Thread Esben Agerbæk Black

New submission from Esben Agerbæk Black esbe...@gmail.com:

An enhancement request to make available the date of the first iso weekday of 
any week of any year.

--
files: weekdate.py
hgrepos: 117
messages: 156913
nosy: Esben.Agerbæk.Black
priority: normal
severity: normal
status: open
title: Getting the starting date of iso week from a week number and a year.
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file25040/weekdate.py

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



[issue14419] Faster ascii decoding

2012-03-27 Thread STINNER Victor

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

New tests. I'm not conviced by the patch: it slows down the decoder for short 
strings. I don't understand which kind of ASCII encoded strings (specific 
length or content?) are optimized by the patch.

Unpatched:

$ ./python -m timeit -n 5 -r 100 -s 'data=open(README, 
r).read().encode(ascii)' 'data.decode(ASCII)'
5 loops, best of 100: 1.41 usec per loop

$ ./python -m timeit -n 1000 -s 'import codecs; d = codecs.getdecoder(ascii); 
x = bytes(range(128))*10' 'd(x)'
1000 loops, best of 3: 0.564 usec per loop

$ ./python -m timeit -n 1000 -s 'import codecs; d = codecs.getdecoder(ascii); 
x = bytes(range(128))*1000' 'd(x)'
1000 loops, best of 3: 24.4 usec per loop

$ ./python -m timeit -n 10 -s 'import codecs; d = codecs.getdecoder(ascii); x 
= bytes(range(128))*10' 'd(x)'
10 loops, best of 3: 10.9 msec per loop

$ ./python -m timeit -n 1000 -s 'enc = ascii; import codecs; d = 
codecs.getdecoder(enc); x = (\u0020 * 100).encode(enc)' 'd(x)'
1000 loops, best of 3: 722 usec per loop

Patched:

$ ./python -m timeit -n 5 -r 100 -s 'data=open(README, 
r).read().encode(ascii)' 'data.decode(ASCII)'
5 loops, best of 100: 1.74 usec per loop

$ ./python -m timeit -n 1000 -s 'import codecs; d = codecs.getdecoder(ascii); 
x = bytes(range(128))*10' 'd(x)'
1000 loops, best of 3: 0.597 usec per loop

$ ./python -m timeit -n 1000 -s 'import codecs; d = codecs.getdecoder(ascii); 
x = bytes(range(128))*1000' 'd(x)'
1000 loops, best of 3: 27.3 usec per loop

$ ./python -m timeit -n 10 -s 'import codecs; d = codecs.getdecoder(ascii); x 
= bytes(range(128))*10' 'd(x)'
10 loops, best of 3: 8.32 msec per loop

$ ./python -m timeit -n 1000 -s 'enc = ascii; import codecs; d = 
codecs.getdecoder(enc); x = (\u0020 * 100).encode(enc)' 'd(x)'
1000 loops, best of 3: 479 usec per loop

--

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



[issue14288] Make iterators pickleable

2012-03-27 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Btw, regarding compatibility:  The docs say  The pickle serialization format 
is guaranteed to be backwards compatible across Python releases.

I take this to mean the serialization format itself.  I don't think there is a 
broader guarantee that pickles generated by one version can be read by another, 
since objects can change their internal representation, types can even 
disappear or change.

In that sense, pickles made by 2.7 can be read by 3.2, in the sense that they 
will correctly return an error when they can't construct a 'str' object.

If I misunderstand things, then at least I think that the pickle documentation 
should be made clearer, that not only is the protocol supposed to be read, but 
also that entire pickles should always be readable _and_ instantiatable, by 
future versions

--

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



[issue14416] syslog missing constants

2012-03-27 Thread Federico Reghenzani

Changes by Federico Reghenzani feder...@reghe.net:


--
nosy: +Federico.Reghenzani

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



[issue14416] syslog missing constants

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

That's probably reasonable (we have precedents for that in other modules), 
except that that's not how the older possibly-not-there constants work.  For 
backward compatibility reasons we can't change the older constants, but I don't 
see any reason we can't do it for the new ones.

We can fix the omission of SYSLOG in the 2.7 and 3.2 docs.  That should be a 
separate patch.

--

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



[issue14424] document PyType_GenericAlloc

2012-03-27 Thread Eli Bendersky

New submission from Eli Bendersky eli...@gmail.com:

PyType_GenericAlloc is not documented in 
http://docs.python.org/dev/c-api/type.html

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 156917
nosy: docs@python, eli.bendersky
priority: low
severity: normal
status: open
title: document PyType_GenericAlloc
type: behavior
versions: Python 3.2, Python 3.3

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



[issue14416] syslog missing constants

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Frederico: thanks for the patch.  Do you want to do the doc patches as well?

--

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



[issue14399] zipfile and creat/update comment

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Thanks for the patch.

The advantage of the more complicated way being that you get an immediate 
TypeError instead of a delayed one?  Is there any other advantage? (That's 
probably enough reason, though :)

Now we just need a unit test for this.

--
stage: needs patch - test needed

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



[issue14420] winreg SetValueEx DWord type incompatible with value argument

2012-03-27 Thread Brian Curtin

Changes by Brian Curtin br...@python.org:


--
assignee:  - brian.curtin
components: +Extension Modules
stage:  - needs patch

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



[issue14416] syslog missing constants

2012-03-27 Thread Federico Reghenzani

Federico Reghenzani feder...@reghe.net added the comment:

Done. I'm a newbie, I hope I did it right :)

--
Added file: http://bugs.python.org/file25041/syslog_doc.patch

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



[issue14416] syslog missing constants

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Close.  We either need to mention that LOG_AUTHPRIV is only defined if the 
platform defines it, or we need to change the implementation so that it is 
always defined (by mapping it to some other facility if it doesn't exist).  I'm 
of mixed mind about it: the former makes some sense to me, but the module 
precedent is clearly intentionally the latter.

In the absence of a good reason to do otherwise, I think we should follow the 
module precedent.

Anyone else have an opinion?

--

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



[issue14419] Faster ascii decoding

2012-03-27 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 New tests. I'm not conviced by the patch: it slows down the decoder for
 short strings. I don't understand which kind of ASCII encoded strings
 (specific length or content?) are optimized by the patch.

May be you forgot the -r? Add -r 100 or -r 1000 and run tests a few times to 
evaluate the dispersion.

I get the acceleration in all cases. For `bytes(range(128))*10` it barely 
exceeds variation (second patch is slightly faster than first one), for 
`bytes(range(128))*1000` it is 1.7x 
faster. For more short strings (under short I knew the length of the order of 
10) measurement is thus quite impossible.

This may also depend on the processor and compiler. I have AMD Athlon 64 X2 
4600+ (2-core, 2.4GHz, 512 KB cache) and use gcc 4.4.3 on 32-bit Linux.

--

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



[issue14419] Faster ascii decoding

2012-03-27 Thread Antoine Pitrou

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

 This may also depend on the processor and compiler. I have AMD Athlon
 64 X2 4600+ (2-core, 2.4GHz, 512 KB cache) and use gcc 4.4.3 on 32-bit 
 Linux.

Then by choosing a string length that exceeds the L2 cache size, you may have 
found an ideal case for your optimization. Basically you're doing the error 
checking and the memcpy in one single pass.

Honestly I'm not sure that's worth the hassle. ASCII-decoding is already very 
fast for shorter strings.

(no need to pass -n or -r to timeit, it will figure out adequate numbers by 
itself)

--

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



[issue14390] Tkinter single-threaded deadlock

2012-03-27 Thread John Bollinger

John Bollinger john.bollin...@stjude.org added the comment:

For what it's worth, I can convert my standalone test into a PyUnit testcase 
easily enough (or so it appears).  I'm having trouble, however, figuring out 
how to get the extension it depends on built and accessible to the test, yet 
not installed with the normal modules.

--

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



[issue14399] zipfile and creat/update comment

2012-03-27 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

This is the second advantage. The first one is that nothing is to be written 
when zipfile opened in a mode a, if we don't change anything.

--

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



[issue14399] zipfile and creat/update comment

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Got you.  We'll definitely go with the more complete fix, then.

--

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



[issue14386] Expose dictproxy as a public type

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue14390] Tkinter single-threaded deadlock

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I believe there is an example in the packaging unit tests of building an 
extension module in a test (but I'm not 100% sure).

Also, the fact that the test will deadlock if it fails is not a deal breaker: 
the test should pass normally, and if it fails the buildbots will eventually 
time out and we'll see the error.

--
nosy: +r.david.murray

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



[issue13749] socketserver can't stop

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue14288] Make iterators pickleable

2012-03-27 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

I've incorporated antoine's comments and the proposed internal function name 
into a new patch.

A lot of the changes concerned thecking the type() of the unpickled iterator.  
Now, it wasn't a specific design goal to get the exact same objects back, only 
_equivalent_ objects.  In particular, dicts and sets have problems, so a 
dictiter to a partially consumed dict cannot be pickled as it is.

so, I've added type cases everywhere, but for those cases.
Now, how important do you think type consistency is?  when using iterators, 
does one ever look at it and test its type?  if this is important, I _could_ 
take another look at dicts and seta and create fresh iterators to the dicts and 
sets made out of the remainder of the items, rather than iterators to lists.

Any thoughs?

--
Added file: http://bugs.python.org/file25042/pickling2.patch

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



[issue14412] Sqlite Integer Fields

2012-03-27 Thread Mendez

Mendez goatsofmen...@users.sourceforge.net added the comment:

I've done some more checking

2.7.3rc1 32-bit works as expected.

If I replace

sqlite3.dll
_sqlite3.lib

in rc2 32-bit with those from rc1 then that fixes the problem.

--

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



[issue5824] SocketServer.DatagramRequestHandler Broken under Linux

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue1767511] SocketServer.DatagramRequestHandler

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue12184] socketserver.ForkingMixin collect_children routine needs to collect only it's children

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue14422] Pack PyASCIIObject fields to reduce memory consumption of pure ASCII strings

2012-03-27 Thread Martin v . Löwis

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

-1. Using packed structures may violate all kinds of expectations in extension 
modules. I consider it important that the data block of a string is 
well-aligned.

--

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



[issue14399] zipfile and creat/update comment

2012-03-27 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

Fixed patch with tests attached.

--
Added file: http://bugs.python.org/file25043/fix_zipfile_comment_2.patch

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



[issue14425] Improve handling of 'timeout' parameter default in urllib.urlopen

2012-03-27 Thread R. David Murray

New submission from R. David Murray rdmur...@bitdance.com:

Currently the prototype uses timeout=socket._GLOBAL_DEFAULT_TIMEOUT, and the 
docs give the prototype as:

  urlopen(url, data=None[, timeout], *, cafile=None, capath=None)

which is unlike most other Python function prototypes in the docs, and makes no 
sense from a python syntax point of view.  The current implementation makes it 
impossible to explicitly request the default timeout unless you look in the 
code and use the marked-private attribute of the socket module.

I suggest the prototype be changed to either timeout=None with an explanation 
that that means use the default socket timeout, or to some public sentinel 
that can be passed explicitly.  I believe there are a number of other examples 
in the stdlib of None meaning use the default, so I favor the former.

--
components: Library (Lib)
messages: 156932
nosy: orsenthil, r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: Improve handling of 'timeout' parameter default in urllib.urlopen
type: enhancement
versions: Python 3.3

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



[issue14288] Make iterators pickleable

2012-03-27 Thread Antoine Pitrou

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

 Now, how important do you think type consistency is?  when using
 iterators, does one ever look at it and test its type?  if this is
 important, I _could_ take another look at dicts and seta and create
 fresh iterators to the dicts and sets made out of the remainder of the
 items, rather than iterators to lists.

I think type consistency is important if it can be achieved reasonably
simply.
In the dict and set case, I'm not sure you can recreate the internal
table in the same order (even accross interpreter restarts). In this
case, you should just check that the unpickled data is a subclass of
collections.abc.Iterator.

--

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



[issue14386] Expose dictproxy as a public type

2012-03-27 Thread Antoine Pitrou

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

There's already a weak proxy class in the weakref module. Not sure a separate 
module for the other proxies is a good idea.

--
nosy: +pitrou

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



[issue14420] winreg SetValueEx DWord type incompatible with value argument

2012-03-27 Thread Bob

Bob r_sanf...@verizon.net added the comment:

Likewise, the winreg.QueryValueEx method returns a signed 32 bit value, instead 
of a 32 bit unsigned value.

--

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



[issue14386] Expose dictproxy as a public type

2012-03-27 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

If we do create a proxy module I'd like to suggest adding all or part of 
Phillip Eby's ProxyTypes:

http://pypi.python.org/pypi/ProxyTypes

I haven't used it directly, but did read through it a while ago and have ended 
up re-implementing chunks of it myself several times.

--
nosy: +michael.foord

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



[issue14375] Add socketserver running property

2012-03-27 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

(I have not used socketserver so my response is somewhat theoretical.)

.__running seems partly if not completely redundant as the negation of 
.__is_shutdown. However, I do not see that exposed. I suspect that this was not 
thought to be needed because the api design is that the user tells the server 
what state to be in without worrying about what state it is in. File objects 
have a .closed attribute, but they cannot be reopened when they are, to make 
sure that they are. A .shutdown attribute might be added.

Is the server status actually trivalent? new (never started), running, 
shutdown? If so, perhaps there should be one trivalent status attribute.

I disagree that telling the server to be in the state it is already in *is* an 
error. Whether or not to make it an error is a design philosophy and an api 
choice. For instance, closing a closed file is not an error. In any case, 
changing the api design is a change, one that could break code. So it would 
require a compelling reason, a deprecation warning, and a deprecation period. 
Without a compelling reason stronger than 'IMO', I think that part of the 
request should be rejected.

Making an exception part of the api of .server_activate, which explicitly 'May 
be overridden.', would impose a requirement on overriding methods in 
subclasses, including those already written.

The doc for RuntimeError says (This exception is mostly a relic from a 
previous version of the interpreter; it is not used very much any more.). I 
believe the usual practice is to define a module-specific exception subclass. 
There is not one now because the current api philosophy does not need one.

The representation of a file does not include is open/closed status. On the 
other hand, there is the .closed attribute. So if no attribute is added, 
putting something in the representation might be done.

--
nosy: +terry.reedy

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



[issue14416] syslog missing constants

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Thinking about this some more, I think that AUTHPRIV is special.  You don't 
want to inadvertently log AUTHPRIV stuff to some other facility.  So I think 
the code patch is good, and we should add a note to the docs that AUTHPRIV may 
not exist on all platforms.

--

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



[issue14416] syslog missing constants

2012-03-27 Thread Federico Reghenzani

Federico Reghenzani feder...@reghe.net added the comment:

We can define AUTHPRIV as AUTH if it doesn't exist in that platform and insert 
a note in the docs.

--

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



[issue14412] Sqlite Integer Fields

2012-03-27 Thread Martin v . Löwis

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

I can't reproduce that. Your test script, with the released 2.7.3rc2, on 
Windows 7, gives 

12349 type 'int'

for me, as it should.

--

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



[issue14416] syslog missing constants

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

From what I understand, that defeats the purpose of AUTHPRIV, which is to log 
messages that should be logged in a safer location than AUTH.  That's why I 
said it was a special case.  In other words, if an application is going to be 
logging, say, a password, it is better that it fail than that it log the 
password insecurely.

--

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



[issue14390] Tkinter single-threaded deadlock

2012-03-27 Thread John Bollinger

John Bollinger john.bollin...@stjude.org added the comment:

I looked at the packaging tests (thanks), but I didn't find anything useful to 
me.  There were a couple whose names looked promising, but they turned out to 
be stubs.  As far as I can tell, none of those tests actually invoke the 
system's C compiler, even indirectly.  They are numerous, however, so I could 
have overlooked something.

It occurs to me that because the extension only needs to provide one function, 
I could just add that to _tkinter.  That would ease testing without adding 
anything to the *public* API, but it seems a bit smelly to me because the point 
is that a user extension can trigger the bug.  Also, the added function would 
be accessible to programs that choose to ignore privacy convention.

Also, I am assuming that tests only need to be runnable by developers and build 
automatons -- i.e. someone who can and did build Python from source.  If they 
need also to be runnable by end users then a compiled version of any extension 
the tests depend upon needs to be included in binary distributions.

--

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



[issue14390] Tkinter single-threaded deadlock

2012-03-27 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

For examples of tests that build extension modules, see 
Lib/packaging/tests/test_command_build_ext.py or the Distutils equivalent, 
Lib/distutils/tests/test_build_ext.py.  These tests are also runnable from 
installed versions of Python, assuming the user has the necessary build tools 
(compiler, etc) installed.

--
nosy: +ned.deily

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



[issue14399] zipfile and creat/update comment

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

The tests don't seem to be included in the new patch.  Also, you could 
modernize the property definition (@property, @comment.setter).

--

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



[issue14425] Improve handling of 'timeout' parameter default in urllib.urlopen

2012-03-27 Thread Jeff McNeil

Jeff McNeil j...@jmcneil.net added the comment:

Quick little patch to change the default to None and update the corresponding 
documentation.

--
keywords: +patch
nosy: +mcjeff
Added file: http://bugs.python.org/file25044/urllib_urlopen_default.patch

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



[issue14426] Lib/Cookie.py date format problem

2012-03-27 Thread Müte Invert

New submission from Müte Invert valtron2...@gmail.com:

Cookie.py doesn't format the expiry date correctly. The problematic line is: 
http://hg.python.org/cpython/file/2.7/Lib/Cookie.py#l393, which should read 
'return %s, %02d %3s %4d %02d:%02d:%02d GMT % \' (spaces instead of dashes). 
The RFC specifying the date format is 
http://tools.ietf.org/html/rfc2616#section-3.3.1; you can see that with dashes, 
only a 2-digit year is allowed (date2).

--
components: Library (Lib)
messages: 156946
nosy: Müte.Invert
priority: normal
severity: normal
status: open
title: Lib/Cookie.py date format problem
type: behavior
versions: Python 2.7

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



[issue14425] Improve handling of 'timeout' parameter default in urllib.urlopen

2012-03-27 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Thanks.  Looks good to me.  I'll give Senthil a little time to comment, in case 
he disagrees with my proposal, before committing it.

We could conceivably apply this as a bug fix to 3.2, since I don't think there 
is any backward compatibility issue.

--
stage: needs patch - commit review

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



[issue14425] Improve handling of 'timeout' parameter default in urllib.urlopen

2012-03-27 Thread Federico Reghenzani

Federico Reghenzani feder...@reghe.net added the comment:

I think the same change is needed in function open(url, data=None[, timeout]) 
of OpenerDirector. I added this other patch.

--
nosy: +federico.reghenzani
Added file: http://bugs.python.org/file25045/OpenDirector.patch

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



[issue14426] Lib/Cookie.py date format problem

2012-03-27 Thread Federico Reghenzani

Federico Reghenzani feder...@reghe.net added the comment:

The same problem is present in newest version of Python. I attacched a patch 
for python 3.

--
nosy: +federico.reghenzani
versions: +Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file25046/cookie_3.py

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



[issue14399] zipfile and creat/update comment

2012-03-27 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

My fault.

--
Added file: http://bugs.python.org/file25047/fix_zipfile_comment_3.patch

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



[issue14423] Getting the starting date of iso week from a week number and a year.

2012-03-27 Thread Esben Agerbæk Black

Changes by Esben Agerbæk Black esbe...@gmail.com:


--
hgrepos:  -117

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



[issue14423] Getting the starting date of iso week from a week number and a year.

2012-03-27 Thread Esben Agerbæk Black

Changes by Esben Agerbæk Black esbe...@gmail.com:


Removed file: http://bugs.python.org/file25040/weekdate.py

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



[issue14423] Getting the starting date of iso week from a week number and a year.

2012-03-27 Thread Esben Agerbæk Black

Esben Agerbæk Black esbe...@gmail.com added the comment:

I have made a patch as per the Lifecycle of a patch quick guide.
(http://docs.python.org/devguide/patch.html#lifecycle-of-a-patch)

--
keywords: +patch
Added file: http://bugs.python.org/file25048/isodates.patch

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



[issue14423] Getting the starting date of iso week from a week number and a year.

2012-03-27 Thread Esben Agerbæk Black

Changes by Esben Agerbæk Black esbe...@gmail.com:


--
components: +Library (Lib)

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



[issue7652] Merge C version of decimal into py3k.

2012-03-27 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

I have a couple of questions about the proposed capsule C API. In order to
be useful, it should be possible to set temporary contexts and pass them
to functions. For example, PyDec_Add could look like:

   PyDec_Add(PyObject *a, PyObject *b, PyObject *context);


To stay sane, either access macros or access functions to the context would
need to be provided:

  CTX(workcontext)-prec = 100;
  PyDec_SetPrec(workcontext, 100);
  PyDecContext_SetPrec(workcontext, 100);


Probably flags would need to be checked at some point:

  if (CTX(workcontext)-status  MPD_Underflow)
  if (PyDec_GetStatus(workcontext)  MPD_Underflow)
  if (PyDecContext_GetStatus(workcontext)  MPD_Underflow)



I wonder if users would not be better off if libmpdec functions and
access macros were exposed instead. The big advantage is that errors
(even malloc errors) propagate in the form of NaNs, so it is not
necessary to do repeated error checking.

Also, I find things like (status  MPD_Underflow) more readable than
the alternatives above.


I've attached a short (fake) example to demonstrate what I mean.

--
Added file: http://bugs.python.org/file25049/api-demo.c

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



[issue14427] urllib.request.Request get_header and header_items not documented

2012-03-27 Thread R. David Murray

New submission from R. David Murray rdmur...@bitdance.com:

These appear from the source to be public methods (and I certainly want to be 
able to use get_header), but they aren't documented.

--
assignee: docs@python
components: Documentation
messages: 156953
nosy: docs@python, r.david.murray
priority: normal
severity: normal
status: open
title: urllib.request.Request get_header and header_items not documented
type: behavior
versions: Python 3.2, Python 3.3

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



[issue14399] zipfile and creat/update comment

2012-03-27 Thread Ethan Furman

Ethan Furman et...@stoneleaf.us added the comment:

I see a comment around line 240 that says:

# It is assumed that the end of central directory magic
# number does not appear in the comment.

Any reason not to add that check to comment.setter?

--
nosy: +stoneleaf

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



[issue14425] Improve handling of 'timeout' parameter default in urllib.urlopen

2012-03-27 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
nosy: +eric.smith

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



[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2012-03-27 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue14136] Simplify PEP 409 command line test and move it to test_cmd_line_script

2012-03-27 Thread Ethan Furman

Ethan Furman et...@stoneleaf.us added the comment:

Nick Coghlan wrote:
 Nick Coghlan ncogh...@gmail.com added the comment:
 
 Hah, I've been dealing with Python's regression test suite for 8+ years and 
 there are still cases where I don't understand the rationale for testing 
 things a particular way (beyond it must have seemed like a good idea at the 
 time). It has a lot more historical cruft than the standard library does :)
 
 The proper location for a particular test can be a bit of a coin toss in 
 many cases, but one useful guide (which applies in this case) is to try to 
 avoid adding *new* standard library dependencies to a test module if there's 
 an alternate suitable location that already has those dependencies.

I just checked the patch and it still applies cleanly with the two 
effected tests passing.

Nick, any chance of getting this checked in and closed?

--

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



[issue14419] Faster ascii decoding

2012-03-27 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

Python script too rough tool to measure decoding performance on short strings. 
To do this I used C.

The benchmark scheme is as follows. Taken a big enough chunk of memory to 
reduce effect of processor cache. This area is splitted into many pieces with 
the same offset over long aligned block. Then measured a time of decoding all 
pieces of a certain size with a certain offset. Calculated an average time (ms) 
and decoding speed (MB/s).

Run benchmark:
gcc -Wall -O3 -I Include/ -I . -Xlinker -export-dynamic decode_ascii_bench.c 
libpython3.3m.a -lpthread -ldl -lutil -lm -lrt -o decode_ascii_bench  
./decode_ascii_bench

--
Added file: http://bugs.python.org/file25050/decode_ascii_bench.c

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



[issue14419] Faster ascii decoding

2012-03-27 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

As you can see, the unpatched code does not depend on the alignment. With 
patches aligned data (which constitute the vast majority, if not all) decoded 
much faster and non-aligned data decoded sometimes slightly slower. Time of 
decoding 2-10-bytes practically does not depend on the string length, most of 
the time (0.1 ms) occupy the overhead of function calls and objects creation 
and destruction. But even in this case, the patches show a steady increase in 
performance. When the overhead costs are reduced advantage becomes stronger. 
For short strings the second patch is better the first patch, as expected.

--
Added file: http://bugs.python.org/file25051/decode_ascii_compare.ods

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



[issue14136] Simplify PEP 409 command line test and move it to test_cmd_line_script

2012-03-27 Thread Ethan Furman

Ethan Furman et...@stoneleaf.us added the comment:

Modified test name to test_pep_409_verbiage(); modified test body to use same 
pattern as other tests, thus eliminating the dangling test script files after 
the test was run.

--
Added file: http://bugs.python.org/file25052/raise_from_none_test_cleanup_3.diff

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



[issue14412] Sqlite Integer Fields

2012-03-27 Thread Mendez

Mendez goatsofmen...@users.sourceforge.net added the comment:

Is that with the 32-bit Python on a 64-bit copy of Windows?

I've tried it on a different machine, again running Windows 7 64-bit and I'm 
getting the same incorrect results.

--

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



[issue14428] Implementation of the PEP 418

2012-03-27 Thread STINNER Victor

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

Attached patch implements the PEP 418: add time.monotonic() and time.hires(). 
In practice, it replaces time.steady() by time.hires() and 
time.steady(strict=True) by time.monotonic().

--
components: Library (Lib)
files: pep418.patch
keywords: patch
messages: 156960
nosy: haypo
priority: normal
severity: normal
status: open
title: Implementation of the PEP 418
versions: Python 3.3
Added file: http://bugs.python.org/file25053/pep418.patch

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



[issue12857] Expose called function on frame object

2012-03-27 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

It's been a while and I probably need to clean up that last patch a little.  I 
also need to address the questions of:

1. f_func for class/module execution
2. thread-safety

see:
http://mail.python.org/pipermail/python-ideas/2011-August/011321.html
and
http://mail.python.org/pipermail/python-ideas/2011-August/011064.html

--

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



[issue12857] Expose called function on frame object

2012-03-27 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

for reference, a related issue:

  http://bugs.python.org/issue13672

--

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



[issue14357] Distutils2 does not work with virtualenv

2012-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Just logged into your machine to try to reproduce, could not (check the 
~merwok/.bash_history file).

--

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



[issue13959] Re-implement parts of imp in pure Python

2012-03-27 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

(Éric, I'd reply in the review if reitveld recognized my current username -- 
see http://psf.upfronthosting.co.za/roundup/meta/issue402.  FYI, I also did not 
get an email for your review, which is likely related to that issue.)

Regarding __all__, I didn't realize that about being a tuple.  I'll fix it. 

As to the dm in the SOABI value, that is definitely something we'll have to 
factor in.  There are actually a few such places in the current patch that rely 
on problematic data.   It's either hidden in C or not available during 
bootstrapping.  That's something we'll have to iron out before the solution for 
this issue gets committed.

--

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



[issue13614] setup.py register fails if long_description contains ReST

2012-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for the report.  The suggested fix on the Ubuntu report looks indeed 
good.  A test is needed to confirm it.  I’ll be leading a sprint in Montreal 
soon and will put this bug on the list.

--

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



[issue10374] distutils[2] should recreate scripts in the build tree

2012-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I now think that this should be fixed in d1 too.  We could just always rebuild 
scripts (it’s just a file copy), or implement the matching idea from my 
previous message.

To answer my own question:
 Or is there a rule that says build_* command only look at timetamps to decide 
 that?
I think a command is free to do whatever inspection it needs to determine is 
something needs rebuilding.

Tests would need to exercise both the --executable option of build_scripts and 
default value.  Thankfully the code uses sys.executable and we can inject a 
custom value in a test.  Adding the easy keyword, I think this is a good 
candidate for the upcoming Montreal sprint.

--
assignee: tarek - eric.araujo
components: +Distutils
keywords: +easy
nosy: +alexis
stage:  - test needed
title: setup.py caches outdated scripts in the build tree - distutils[2] 
should recreate scripts in the build tree
type: enhancement - behavior
versions: +Python 2.7, Python 3.2, Python 3.3

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



[issue14357] Distutils2 does not work with virtualenv

2012-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Alex and I found the real issue: it’s about caching of scripts in the build 
directory.

d2 works in a virtualenv, closing :)

--
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - distutils[2] should recreate scripts in the build tree

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



[issue14408] Support the load_tests protocol in the stdlib tests

2012-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I’m a bit disappointed to see that the files after the change are as long.  I 
hoped we could avoid explicitly listing test cases, thanks to auto-discovery of 
TestCase subclasses combined with skips for specific platforms or optional 
modules.  Of course this would remove the possibility to run things like 
“../../python test_shutil.py” (and I do use these kinds of calls to run tests 
from my editor all the time), forcing us to always call “./python -m unittest 
test.test_shutil”.  Michael, do you think this should go to python-dev or do 
you disapprove (or think people will disapprove)?

--
nosy: +eric.araujo
versions:  -Python 3.2

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



[issue14136] Simplify PEP 409 command line test and move it to test_cmd_line_script

2012-03-27 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Yup, I plan to get a few things like this incorporated once I have broadband 
access at home again. Probably won't be early enough to get things into alpha 
2, but they should make it for alpha 3.

--

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



[issue14408] Support the load_tests protocol in the stdlib tests

2012-03-27 Thread Matt Joiner

Matt Joiner anacro...@gmail.com added the comment:

I think if you can correctly construct the same test case list using discovery 
then that's far superior. But I haven't tried this, and don't know if you can 
correctly predicate the support classes using only class decorators.

--

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



[issue14418] Document differences in SocketServer between Python 2.6 and 2.7

2012-03-27 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
stage:  - needs patch
versions:  -Python 2.6

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



[issue14386] Expose dictproxy as a public type

2012-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

weakref.mappingview sounds nice to me.

--
nosy: +eric.araujo

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



[issue14426] date format problem in Cookie/http.cookies

2012-03-27 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +orsenthil
stage:  - test needed
title: Lib/Cookie.py date format problem - date format problem in 
Cookie/http.cookies
versions:  -Python 3.1

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



[issue14412] Sqlite Integer Fields

2012-03-27 Thread Martin v . Löwis

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

 Is that with the 32-bit Python on a 64-bit copy of Windows?

No, it was the 64-bit version.

--

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