[issue7625] bytearray needs more tests for b.some_method()[0] is not b

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Patch for some additional test cases attached.

The bug b.partition('.')[0] is b is fixed with the patch proposed on 
issue7622.

--
keywords: +patch
Added file: http://bugs.python.org/file15733/issue7625_tests.diff

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



[issue7630] Strange behaviour of decimal.Decimal

2010-01-04 Thread Mark Dickinson

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

You don't say what behaviour you were expecting!   :)

By design, almost all Decimal operations (but not creation of a Decimal from an 
integer or string) round to the precision given by the current context.  By 
default that precision is 28 significant digits.  See the documentation, 
particularly the quick-start tutorial,

http://docs.python.org/library/decimal.html#quick-start-tutorial

for more information, including how to change the default precision.

--
nosy: +mark.dickinson
resolution:  - invalid
status: open - closed

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

There's some reference leaking somewhere...
Will investigate.

~ $ ./python Lib/test/regrtest.py -R 2:3: test_unicode
test_unicode leaked [7, 7, 7] references, sum=21

--

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



[issue2698] Extension module build fails for MinGW: missing vcvarsall.bat

2010-01-04 Thread Daniel

Daniel daniel.mon...@free.fr added the comment:

Thanks for your response!
I'm back after holidays :)

Yappy new year everybody!!!

Conserning our problem:
.../...
adding base module named weakref
running build
running build_py
running build_ext
Traceback (most recent call last):
  File setup.py, line 240, in module
license = Python Software Foundation License)
  File c:\python31\lib\distutils\core.py, line 149, in setup 
dist.run_commands()
  File c:\python31\lib\distutils\dist.py, line 919, in run_commands 
self.run_command(cmd)
  File c:\python31\lib\distutils\dist.py, line 938, in run_command 
cmd_obj.run()
  File c:\python31\lib\distutils\command\build.py, line 128, in run 
self.run_command(cmd_name)
  File c:\python31\lib\distutils\cmd.py, line 315, in run_command 
self.distribution.run_command(command)
  File c:\python31\lib\distutils\dist.py, line 938, in run_command 
cmd_obj.run()
  File c:\python31\lib\distutils\command\build_ext.py, line 358, in run 
force=self.force)
  File c:\python31\lib\distutils\ccompiler.py, line 1106, in new_compiler 
return klass(None, dry_run, force)
  File c:\python31\lib\distutils\cygwinccompiler.py, line 280, in __init__ 
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File c:\python31\lib\distutils\cygwinccompiler.py, line 124, in __init__ if 
self.ld_version = 2.10.90: TypeError: unorderable types: NoneType() = str()

I will also analyse and look at a solution.


Daniel.

--

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



[issue7630] Strange behaviour of decimal.Decimal

2010-01-04 Thread Mark Dickinson

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

It might also help to note that, with decimal, what you see (from repr() of a 
Decimal instance) is *exactly* what you get.  So when you see

 dec
Decimal('1.797693134862315907729305191E+308')

that number really is exactly what's stored in dec:  there are no 'hidden'  
digits waiting to appear.

--

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



[issue7462] Implement fastsearch algorithm for rfind/rindex

2010-01-04 Thread Fredrik Lundh

Fredrik Lundh fred...@effbot.org added the comment:

Thanks Florent!

 Are there any simple, common cases that are made slower by this patch? 

The original fastsearch implementation has a couple of special cases to make 
sure it's faster than the original code in all cases.  The reason it wasn't 
implemented for reverse search was more a question of developer time 
constraints; reverse search isn't nearly as common as forward search, and we 
had other low-hanging fruit to deal with.

(btw, while it's great that someone finally got around to fix this, it wouldn't 
surprise me if replacing the KMP implementation in SRE with a fastsearch would 
save as many CPU cycles worldwide as this patch :)

--

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



[issue7462] Implement fastsearch algorithm for rfind/rindex

2010-01-04 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue7631] undefined label: bltin-file-objects

2010-01-04 Thread Ezio Melotti

New submission from Ezio Melotti ezio.melo...@gmail.com:

~/dev/py3k-wide/Doc$ make html
[...]
/home/wolf/dev/py3k-wide/Doc/library/filesys.rst:30: WARNING: undefined
label: bltin-file-objects -- if you don't give a link caption the label
must precede a section header.  
/home/wolf/dev/py3k-wide/Doc/library/socket.rst:578: WARNING: undefined
label: bltin-file-objects -- if you don't give a link caption the label
must precede a section header.  
/home/wolf/dev/py3k-wide/Doc/library/tokenize.rst:19: WARNING: undefined
label: bltin-file-objects -- if you don't give a link caption the label
must precede a section header. 
/home/wolf/dev/py3k-wide/Doc/reference/datamodel.rst:784: WARNING:
undefined label: bltin-file-objects -- if you don't give a link caption
the label must precede a section header.
 
/home/wolf/dev/py3k-wide/Doc/using/cmdline.rst:238: WARNING: undefined
label: bltin-file-objects -- if you don't give a link caption the label
must precede a section header.
[...]

This is because http://docs.python.org/library/stdtypes.html#bltin-file-objects 
doesn't exist anymore in py3k

--
assignee: georg.brandl
components: Documentation
messages: 97201
nosy: ezio.melotti, georg.brandl, pitrou
severity: normal
status: open
title: undefined label: bltin-file-objects

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



[issue7631] undefined label: bltin-file-objects

2010-01-04 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
assignee: georg.brandl - pitrou

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



[issue3745] _sha256 et al. encode to UTF-8 by default

2010-01-04 Thread Marc-Andre Lemburg

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

Gregory P. Smith wrote:
 
 Gregory P. Smith g...@krypto.org added the comment:
 
 trunk r77252 switches python 2.7 to use 's*' for argument parsing.  unicodes 
 can be hashed (encoded to the system default encoding by s*) again.
 
 This change has been blocked from being merged into py3k unless someone 
 decides we actually want this magic unicode encoding behavior to exist there 
 as well.

Thanks for updating the implementation.

--

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



[issue3745] _sha256 et al. encode to UTF-8 by default

2010-01-04 Thread Marc-Andre Lemburg

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

Gregory P. Smith wrote:
 
 Gregory P. Smith g...@krypto.org added the comment:
 
 In order to get a -3 PyErr_WarnPy3k warning for unicode being passed to 
 hashlib objects (a nice idea) I suggest creating an additonal 's*' like thing 
 ('s3' perhaps?) in Python/getargs.c for that purpose rather than modifying 
 all of the hashlib modules to accept an O, type check it and warn, and then 
 re-parse it as a s* (that'd be a lot of tedious code duplication).

Good idea. We're likely going to need this in more places, so I'm +1 on
adding an s3 parser marker.

--

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Refleak fixed in PyUnicode_Splitlines.

--
stage:  - patch review
Added file: http://bugs.python.org/file15734/stringlib_split_replace_v3c.diff

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file15732/stringlib_split_replace_v3b.diff

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-04 Thread Stefan Krah

New submission from Stefan Krah stefan-use...@bytereef.org:

In a debug build:

Python 3.2a0 (py3k:76671M, Dec 22 2009, 19:41:08) 
[GCC 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-23ubuntu3)] on linux2
Type help, copyright, credits or license for more information.
 s = 2183167012312112312312.23538020374420446192e-370
[30473 refs]
 f = float(s)
oversize b in quorem

--
messages: 97205
nosy: eric.smith, mark.dickinson, skrah
severity: normal
status: open
title: dtoa.c: oversize b in quorem
versions: Python 3.2

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-04 Thread Mark Dickinson

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

Nice catch!  I'll take a look.  We should find out whether this is something 
that happens with Gay's original code, or whether it was introduced in the 
process of adapting that code for Python.

--
assignee:  - mark.dickinson
priority:  - critical
versions: +Python 2.7

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-04 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
components: +Interpreter Core
stage:  - needs patch
type:  - crash

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



[issue7633] decimal.py: type conversion in context methods

2010-01-04 Thread Stefan Krah

New submission from Stefan Krah stefan-use...@bytereef.org:

I think that context methods should convert arguments regardless of position:

Python 2.7a0 (trunk:76132M, Nov  6 2009, 15:20:35) 
[GCC 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-23ubuntu3)] on linux2
Type help, copyright, credits or license for more information.
 from decimal import *
 c = getcontext()
 c.add(8, Decimal(9))
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/decimal.py, line 3866, in add
return a.__add__(b, context=self)
TypeError: wrapper __add__ doesn't take keyword arguments
 
 c.add(Decimal(9), 8)
Decimal('17')
 


Also, perhaps c.add(9, 8) should be allowed, too.

--
messages: 97207
nosy: mark.dickinson, skrah
severity: normal
status: open
title: decimal.py: type conversion in context methods

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Marc-Andre Lemburg

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

A few comments on coding style:

 * please keep the existing argument formats as they are, e.g.

count = countstring(self_s, self_len,
from_s, from_len,
0, self_len, FORWARD, maxcount);

   or

  /* helper macro to fixup start/end slice values */
  -#define FIX_START_END(obj)  \
  -if (start  0)  \
  -start += (obj)-length; \
  -if (start  0)  \
  -start = 0;  \
  -if (end  (obj)-length)\
  -end = (obj)-length;\
  -if (end  0)\
  -end += (obj)-length;   \
  -if (end  0)\
  -end = 0;
  +#define ADJUST_INDICES(start, end, len) \
  +if (end  len) end = len;   \
  +else if (end  0) { end += len; if (end  0) end = 0; } \
  +if (start  0) { start += len; if (start  0) start = 0; }



   and use similar formatting for the replacement function
   calls/macros

 * make sure that the name of a symbol matches the value, e.g.

   #define LONG_BITMASK (LONG_BIT-1)
   #define BLOOM(mask, ch) ((mask  (1  ((ch)  LONG_BITMASK

   LONG_BITMASK has a value of 0x1f (31) - that's a single byte, not
   a long value. In this case, 0x1f is an implementation detail of
   the simplified Bloom filter used for set membership tests in the
   Unicode implementation.

   When adjusting the value to be platform dependent, please check
   that the implementation does work for platforms that have
   more than 31 bits available for (signed) longs.

   Note that you don't need to expose that value separately if
   you stick to using BLOOM() directly.

 * use BLOOM() macro in fastsearch.c

 * when declaring variables with initial values, keep these on separate lines, 
e.g. don't use this style:

Py_ssize_t i, j, count=0;
PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)), *sub;

   instead, write:

Py_ssize_t i, j;
Py_ssize_t count=0;
PyObject *list = PyList_New(PREALLOC_SIZE(maxcount))
PyObject *sub;

 * always place variable declarations at the top of a function, not into the 
function body:

  +stringlib_split(
  +PyObject* str_obj, const STRINGLIB_CHAR* str, Py_ssize_t str_len,
  +const STRINGLIB_CHAR* sep, Py_ssize_t sep_len, Py_ssize_t  maxcount
  +)
  +{
  +if (sep_len == 0) {
  +PyErr_SetString(PyExc_ValueError, empty separator);
  +return NULL;
  +}
  +else if (sep_len == 1)
  +return stringlib_split_char(str_obj, str, str_len, sep[0],   
maxcount);
  +
  +Py_ssize_t i, j, pos, count=0;
  +PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)), *sub;
  +if (list == NULL)
  +return NULL;
   
 * function declarations should not put parameters on new lines:

  +stringlib_splitlines(
  +PyObject* str_obj, const STRINGLIB_CHAR* str, Py_ssize_t str_len,
  +int keepends
  +)
  +{

 instead use this style:

  -static
  -PyObject *rsplit_substring(PyUnicodeObject *self,
  -   PyObject *list,
  -   PyUnicodeObject *substring,
  -   Py_ssize_t maxcount)
  -{

--
components: +Unicode
nosy: +lemburg

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-04 Thread Mark Dickinson

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

I can reproduce this on OS X 10.6 (64-bit), both in py3k and trunk debug 
builds.  In non-debug builds it appears to return the correct result (0.0), so 
the oversize b appears to have no ill effects.  So this may just be an 
overeager assert;  it may be a symptom of a deeper problem, though.

--
priority: critical - high

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-04 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

I'm testing on a Fedora Core 6 i386 box and an Intel Mac 32-bit 10.5 box. I 
only see this on debug builds. I've tested trunk, py3k, release31-maint, and 
release26-maint (just for giggles).

The error shows up in debug builds of trunk, py3k, and release31-maint on both 
machines, and does not show up in non-debug builds.

--
versions: +Python 3.1

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

 A few comments on coding style:

Thank you for your remarks. I will update the patch accordingly.

 * make sure that the name of a symbol matches the value, e.g.

   #define LONG_BITMASK (LONG_BIT-1)
   #define BLOOM(mask, ch) ((mask  (1  ((ch)  LONG_BITMASK

   LONG_BITMASK has a value of 0x1f (31) - that's a single byte, not
   a long value. In this case, 0x1f is an implementation detail of
   the simplified Bloom filter used for set membership tests in the
   Unicode implementation.

   When adjusting the value to be platform dependent, please check
   that the implementation does work for platforms that have
   more than 31 bits available for (signed) longs.

   Note that you don't need to expose that value separately if
   you stick to using BLOOM() directly.

Since the same value is used to build the mask, I assume it's better to keep 
the value around (or use (LONG_BIT-1) directly?).
mask |= (1  (ptr[i]  LONG_BITMASK));

s/LONG_BITMASK/BLOOM_BITMASK/ is not confusing?

--

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Antoine Pitrou

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

 I copied the style of stringlib/partition.h for this part.
 Should I update style of partition.h too?

No, it's ok for stringlib to have its own consistent style and there's no 
reason to change it IMO.

More interesting would be benchmark results showing how much this improves the 
various methods :-)

--

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Patch updated:
 * coding style
 * added macros BLOOM_ADD to unicodeobject.c and fastsearch.h
   (and removed LONG_BITMASK)

--
Added file: http://bugs.python.org/file15735/stringlib_split_replace_v4.diff

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file15734/stringlib_split_replace_v3c.diff

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

And now, the figures.

There's no gain for the string methods.
Some unicode methods are faster: split/rsplit/replace:


Most significant results:

--- bench_slow.log  Trunk
+++ bench_fast.log  Patched

 string unicode
 (ms)   (ms)comment

 == late match, 100 characters
-13.30  20.51   s=ABC*33; (E+s+(D+s)*500).rsplit(E+s, 1) (*100)
-16.12  29.88   s=ABC*33; ((s+D)*500+s+E).split(s+E, 1) (*100)
+13.27  14.38   s=ABC*33; (E+s+(D+s)*500).rsplit(E+s, 1) (*100)
+16.19  17.61   s=ABC*33; ((s+D)*500+s+E).split(s+E, 1) (*100)

 == quick replace multiple character match
-4.51   159.78  (A + (Z*128*1024)).replace(AZZ, BBZZ, 1) (*100)
+3.67   7.30(A + (Z*128*1024)).replace(AZZ, BBZZ, 1) (*100)

 == quick replace single character match
-3.73   50.61   (A + (Z*128*1024)).replace(A, BB, 1) (*100)
+3.72   7.18(A + (Z*128*1024)).replace(A, BB, 1) (*100)

(full benchmark diff is attached)

And we save 1000 lines of code cumulated
(stringobject.c/unicodeobject.c/bytearrayobject.c)

--
Added file: http://bugs.python.org/file15736/benchmark_split_replace.diff

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Antoine Pitrou

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

I don't think you should remove such blocks:

-/*
-  Local variables:
-  c-basic-offset: 4
-  indent-tabs-mode: nil
-  End:
-*/

There probably are people relying on them :-)

--

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



[issue7319] Silence DeprecationWarning by default

2010-01-04 Thread Antoine Pitrou

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

Just FYI, there are tabs in your spaces in _warnings.c.

--
nosy: +pitrou

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Marc-Andre Lemburg

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

Florent Xicluna wrote:
  
  Florent Xicluna la...@yahoo.fr added the comment:
  
  * function declarations should not put parameters on new lines:
 
   +stringlib_splitlines(
   +PyObject* str_obj, const STRINGLIB_CHAR* str, Py_ssize_t str_len,
   +int keepends
   +)
   +{
  
  I copied the style of stringlib/partition.h for this part.
  Should I update style of partition.h too?

I'd prefer if you change the coding style to what we use elsewhere
in Python C code.

See http://www.python.org/dev/peps/pep-0007/ for more C coding
style suggestions.

--

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

I think we should use whatever style is currently being used in the code. If we 
want to go back through this code (or any other code) and PEP7-ify it, that 
should be a separate task.

Alternately, we could PEP7-ify it first, then apply these changes.

--

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Marc-Andre Lemburg

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

Eric Smith wrote:
  
  Eric Smith e...@trueblade.com added the comment:
  
  I think we should use whatever style is currently being used in the code. 
  If we want to go back through this code (or any other code) and PEP7-ify 
  it, that should be a separate task.
  
  Alternately, we could PEP7-ify it first, then apply these changes.

For any new files added, PEP 7 should always be used.

For PEP7-ifying the existing code, we could open a separate ticket or just 
apply the change as separate patch.

--

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



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

2010-01-04 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
priority: deferred blocker - release blocker

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



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

2010-01-04 Thread Antoine Pitrou

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

In issue7092_lib_many_fixes.diff: why did you change some of the warning 
messages?

In issue7092_pprint.diff: I'm not sure these changes are right, because they 
could modify existing behaviour. Raymond, what do you think?

--
nosy: +rhettinger

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



[issue7631] undefined label: bltin-file-objects

2010-01-04 Thread Antoine Pitrou

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

Fixed in r77300.

--
resolution:  - fixed
status: open - closed

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



[issue6071] no longer possible to hash arrays

2010-01-04 Thread Ezio Melotti

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

Even if it's fixed a patch with tests should be submitted before closing this 
issue.

--
nosy: +ezio.melotti
priority: deferred blocker - normal
stage: needs patch - test needed

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Fixed a problem with the splitlines optimization: use PyList_Append instead of 
PyList_SET_ITEM because there's no preallocated list
in this case.

--
Added file: http://bugs.python.org/file15737/stringlib_split_replace_v4b.diff

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



[issue3340] optparse print_usage(),.. methods are not documented

2010-01-04 Thread Ezio Melotti

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

Fixed in r77306 (trunk), r77307 (release26-maint), r77308 (py3k) and r77309 
(release31-maint).

--
assignee: georg.brandl - ezio.melotti
nosy: +ezio.melotti
priority:  - normal
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.5

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-04 Thread Mark Dickinson

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

The bug is present in the current version of dtoa.c from 
http://www.netlib.org/fp, so I'll report it upstream.  As far as I can tell, 
though, it's benign, in the sense that if the check is disabled then nothing 
bad happens, and the correct result is eventually returned (albeit after some 
unnecessary computation).

I suspect that the problem is in the if block around lines 1531--1543 of 
Python/dtoa.c:  a subnormal rv isn't being handled correctly here---it should 
end up being set to 0.0, but is instead set to 2**-968.

--

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



[issue7319] Silence DeprecationWarning by default

2010-01-04 Thread Ezio Melotti

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

The second paragraph (There is also the issue...) is IMO redundant, 
especially the third sentence (But because Python is an interpreted 
language...).

--
nosy: +ezio.melotti

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file15735/stringlib_split_replace_v4.diff

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



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

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Updated lib_many_fixes patch:
 * added filterwarning for pprint
 * added fixes for Lib/sunau.py and Lib/unittest/case.py

Ready for review and merge:
 * issue7092_lib_many_fixes_v2.diff
 * issue7092_compiler.diff

--
Added file: http://bugs.python.org/file15738/issue7092_lib_many_fixes_v2.diff

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



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

2010-01-04 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file15627/issue7092_lib_many_fixes.diff

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



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

2010-01-04 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file15629/issue7092_pprint.diff

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



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

2010-01-04 Thread Antoine Pitrou

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

One thing: lambda k: k in selfdata can be replaced with
selfdata.__contains__. It may have better performance characteristics
too.

--

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



[issue7610] Cannot use both read and readline method in same ZipExtFile object

2010-01-04 Thread Nir Aides

Nir Aides n...@winpdb.org added the comment:

Right, I was reading the 3.1 docs by mistake.

I updated the patch. This time universal newlines are supported.

On my dataset (75MB 650K lines log file) the readline() speedup is x40 for 'r' 
mode and x8 for 'rU' mode, and you can get an extra bump by using the io module 
wrappers.

I added tests for interleaved use of readline() and read() (which add ~2 
seconds to running time)

--
Added file: http://bugs.python.org/file15739/zipfile_7610_py27.diff

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



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

2010-01-04 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file15738/issue7092_lib_many_fixes_v2.diff

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



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

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

I learned something.

--
Added file: http://bugs.python.org/file15740/issue7092_lib_many_fixes_v3.diff

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

The test case for the previous issue.

--
Added file: http://bugs.python.org/file15741/issue7622_test_splitlines.diff

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



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

2010-01-04 Thread Antoine Pitrou

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

Looks good, thank you.

--
resolution:  - accepted
stage:  - commit review

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



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

2010-01-04 Thread Antoine Pitrou

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

Both patches have been committed in r77310.

--
stage: commit review - committed/rejected
status: open - pending

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



[issue7610] Cannot use both read and readline method in same ZipExtFile object

2010-01-04 Thread Antoine Pitrou

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

 I updated the patch. This time universal newlines are supported.

Thank you. Are you sure the Shortcut common case in readline() is
useful? BufferedIOBase.readline() in itself should be rather fast.

--

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



[issue7610] Cannot use both read and readline method in same ZipExtFile object

2010-01-04 Thread Antoine Pitrou

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

Also, I'm not sure what happens in readline() in universal mode when the
chunk ends with a '\r' and there's a '\n' in the following chunk (see
the ugly check that your patch removes). Is there a test for that?

--

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



[issue7615] unicode_escape codec does not escape quotes

2010-01-04 Thread Richard Hansen

Richard Hansen rhan...@bbn.com added the comment:

I thought about raw_unicode_escape more, and there's a way to escape quotes:  
use unicode escape sequences (e.g., ur'\u0027').  I've attached a new patch 
that does the following:

 * backslash-escapes single quotes when encoding with the unicode_escape codec 
(the original subject of this bug)
 * replaces single quotes with \u0027 when encoding with the raw_unicode_escape 
codec (a separate bug not related to the original report, but brought up in 
comments)
 * replaces backslashes with \u005c when encoding with the raw_unicode_escape 
codec (a separate bug not related to the original report)
 * fixes a corner-case bug where the UTF-16 surrogate pair decoding logic could 
read past the end of the provided Py_UNICODE character array (a separate bug 
not related to the original report)
 * eliminates redundant code in PyUnicode_EncodeRawUnicodeEscape() and 
unicodeescape_string()
 * general cleanup in unicodeescape_string()

The changes in the patch are non-trivial and have only been lightly tested.

--
Added file: http://bugs.python.org/file15742/unicode_escape_reorg.patch

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



[issue6071] no longer possible to hash arrays

2010-01-04 Thread Benjamin Peterson

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

Done in r77313.

--
nosy: +benjamin.peterson
resolution:  - fixed
status: open - closed

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



[issue7634] next/previous links in documentation skip some sections

2010-01-04 Thread Gabriel Genellina

New submission from Gabriel Genellina gagsl-...@yahoo.com.ar:

The next/previous links in the documentation skip some sections. This happens 
both in HTML format and the CHM Windows help file.

e.g.: in the Library Reference, section 8.5 StringIO [next] points to 8.7 
textwrap, skipping section 8.6 cStringIO. And section 9.12 UserDict [next] 
points to 9.15 Types, skipping sections 9.13 and 9.14 (UserList and 
UserString). Same with their reverse links: 9.15 [previous] points to 9.12.

It seems those links connect *files*, not *sections*, and such logic fails when 
a single file contains more than a section. From a user POV that's not the 
expected behavior: the next/previous links should navigate the complete 
document, regardless of its physical implementation (the actual .rst files).

(In that case this might be a Sphinx bug rather than a Python one)

--
assignee: georg.brandl
components: Documentation
messages: 97239
nosy: gagenellina, georg.brandl
severity: normal
status: open
title: next/previous links in documentation skip some sections
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue7635] 19.6 xml.dom.pulldom doc: stub?

2010-01-04 Thread Terry J. Reedy

New submission from Terry J. Reedy tjre...@udel.edu:

The short doc for 19.6. xml.dom.pulldom has lots of ...s that appear to 
indicate missing text. If so, this issue is a flag for a future project for 
someone who knows what to fill in.

If nothing is missing and the section is intended to be understood in its 
cryptic state, it should say so.

--
assignee: georg.brandl
components: Documentation
messages: 97240
nosy: georg.brandl, tjreedy
severity: normal
status: open
title: 19.6 xml.dom.pulldom doc: stub?
versions: Python 3.1, Python 3.2

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



[issue1495229] W3C - Python DOM type mapping docs need updating

2010-01-04 Thread Terry J. Reedy

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

'IntType' refers to the 2.x alias types.IntType for int.
Such aliases were removed in the 3.x types module, so 'IntType' is a 
meaningless term in 3.x docs and should be changed to 'int' therein.

If the Python type for IDL boolean cannot be changed to 'bool', then please 
make it 'bool or int' so that people will know that they might get either and 
so that the doc and minidom will agree with each other.

--
nosy: +tjreedy
versions: +Python 3.1, Python 3.2 -Python 2.6, Python 3.0

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



[issue7636] Add a set update action to optparse

2010-01-04 Thread steven Michalske

New submission from steven Michalske smichal...@gmail.com:

As a complement to the append action, an update action would update a set with 
new values.


update
update a set with this option’s argument

justification:
adding email addresses at the command line, makes it less code to have a unique 
list.

--
messages: 97242
nosy: hardkrash
severity: normal
status: open
title: Add a set update action to optparse
type: feature request

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



[issue7319] Silence DeprecationWarning by default

2010-01-04 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

warnings_rst_reword.diff proposes slightly different wording on the Updating 
Code... section of documentation.

--
nosy: +brian.curtin
Added file: http://bugs.python.org/file15743/warnings_rst_reword.diff

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



[issue7637] Improve 19.5. xml.dom.minidom doc

2010-01-04 Thread Terry J. Reedy

New submission from Terry J. Reedy tjre...@udel.edu:

1. When you are finished with a DOM, you should clean it up. This is necessary 
because some versions of Python do not support garbage collection of objects 
that refer to each other in a cycle. Until this restriction is removed from all 
versions of Python, it is safest to write your code as if cycles would not be 
cleaned up.

This appears to refer to early 2.x CPython versions without the gc module. Such 
(cryptic) back references are not appropriate for 3.x docs. Even in 3.x, 
immediate unlink might be a good idea, especially for CPython (which would then 
clean up immediately). But none of these issues are specific to DOM objects. 
Suggested replacement for the above and the current next sentence (The way to 
clean up a DOM is to call its unlink() method:)

When you are finished with a DOM, you can call the unlink method to encourage 
early cleanup of unneeded objects:

Anything more is redundant with the doc for the method.
'''
dom1.unlink()
dom2.unlink()
dom3.unlink()
'''
One example at most is quite sufficient.

2. '''Node.toxml([encoding]) 
Return the XML that the DOM represents as a string.

With no argument, the XML header does not specify an encoding, and the result 
is Unicode string if the default encoding cannot represent all characters in 
the document. Encoding this string in an encoding other than UTF-8 is likely 
incorrect, since UTF-8 is the default encoding of XML.

With an explicit encoding [1] argument, the result is a byte string in the 
specified encoding. It is recommended that this argument is always specified. 
To avoid UnicodeError exceptions in case of unrepresentable text data, the 
encoding argument should be specified as “utf-8”.
'''
I find this API a bit confusing.

In 3.x, Return ... a string. means str (unicode), but the rest implies that 
'string' should be 'string or bytes'.

default encoding: what is it? ascii, utf-8 as almost implied, something in 
sys module (if so, please specify).

A cleaner API would have been 1. always return str (unicode) or 2. always 
return bytes, with encoding='utf-i' default or 3. return str if no encoding 
given or bytes if one is given, with no default.

3. Revision of following antipattern example would be for 2.x also:
'''
def getText(nodelist):
rc = 
for node in nodelist:
if node.nodeType == node.TEXT_NODE:
rc = rc + node.data
return rc
'''
should be (not tested, but pretty straightforward)

def getText(nodelist):
rc = []
for node in nodelist:
if node.nodeType == node.TEXT_NODE:
rc.append(node.data)
return ''.join(rc)

--
assignee: georg.brandl
components: Documentation
messages: 97244
nosy: georg.brandl, tjreedy
severity: normal
status: open
title: Improve 19.5. xml.dom.minidom doc
versions: Python 3.1, Python 3.2

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



[issue7638] Counterintuitive str.splitlines() inconsistency.

2010-01-04 Thread David

New submission from David vencabot_tep...@hotmail.com:

Qualifier: This is the first issue that I've raised, so I apologise before-hand 
for any protocol flubs.

str.splitlines()'s implementation jives unexpectedly with str.split().

In this code snippet, a server buffers input until it receives a blank line, 
and then it processes the input:

request_buffer = 

while request_buffer.split(\n)[-1] !=  or request_buffer == :
request_buffer += self.conn.recv(1024)
print(Got a line!)

print(Got an empty line!)
self.handleRequest(request_buffer)


I found out the hard way that this code isn't prepared to handle clients that 
use a different new line standard, such as those that send \r. I discovered 
str.splitlines() at that point and found that, to some extent, it works as 
advertised: splitting lines regardless of exactly what new line character is 
being used.

However, this code doesn't work:

request_buffer = 

while request_buffer.splitlines[-1] !=  or request_buffer == :
request_buffer += self.conn.recv(1024)
print(Got a line!)

print(Got an empty line!)
self.handleRequest(request_buffer)


Python complains that -1 is out of request_buffer.splitlines()'s range. I know 
that str.splitlines() treats empty lines, because I've used it on longer 
strings for testing trailing blank lines before; it only refuses to count a 
line as being blank if there isn't another line after it. derp.splitlines() 
has a length of 1, but .splitlines() has a length of 0. derp\n.splitlines() 
also has a length of 1, thus excluding the trailing blank line.

In my opinion, .splitlines() should have 1 element. derp.splitlines() 
should persist as having 1 element, but derp\n.splitlines() should have 2 
elements. This would result in the same functionality as str.split(\n) (where 
\n.split(\n) results in two empty-string elements), but it would have the 
benefit of working predictably with all line-breaking standards, which I assume 
was the idea all along.

--
messages: 97245
nosy: vencabot_teppoo
severity: normal
status: open
title: Counterintuitive str.splitlines() inconsistency.
type: behavior
versions: Python 2.6

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



[issue7638] Counterintuitive str.splitlines() inconsistency.

2010-01-04 Thread David

David vencabot_tep...@hotmail.com added the comment:

I typoed when copying my second snippet.

while request_buffer.splitlines[-1] !=  or request_buffer == :


It should be:

while request_buffer.splitlines()[-1] !=  or request_buffer == :


This code has the problem that I'm complaining of. I only failed at copying 
by-hand into the form.

--

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



[issue1495229] W3C - Python DOM type mapping docs need updating

2010-01-04 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. fdr...@acm.org added the comment:

I presume you're referring to the documentation for the xml.dom
package (as found at
http://docs.python.org/library/xml.dom.html#type-mapping) rather than
the Python -- OMG IDL mapping (the link for which appears to have
gone stale).

I'd support the changes you recommend for the xml.dom documentation.

--

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



[issue7638] Counterintuitive str.splitlines() inconsistency.

2010-01-04 Thread R. David Murray

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

No apologies needed, but you probably aren't going to like the answer :)

First of all, a change like you propose would be unlikely to be accepted since 
it would create considerable backward-compatibility pain.

That aside, however, splitlines and split are not meant to be parallel.  They 
do two very different jobs.  splitlines is *line* oriented, and lines are 
understood to end with line ends.  The file equivalent of  has length zero, 
and the unix 'wc' command reports it has having 0 lines.  A file containing 
derp\n' is reported by wc to have one line, not two.  Files without a final 
line end are arguably broken, but all good tools accept that final line as a 
line, though some complain about it.  (And other tools break in various odd 
ways.)

If you want something parallel to split that handles line ends 'universally', 
try re.split with an appropriate regex.

--
nosy: +r.david.murray
priority:  - normal
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue7638] Counterintuitive str.splitlines() inconsistency.

2010-01-04 Thread David

David vencabot_tep...@hotmail.com added the comment:

Thank you for the clarification, David. I thought that it might have been a 
calculated decision beyond my understanding, and I can rest easy knowing that 
this behavior isn't accidental. I was thinking that I might have to do 
something like a regular expression, and I probably will. Thanks for the advice.

Have a good one!

--

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



[issue7636] Add a set update action to optparse

2010-01-04 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

The name should probably be add rather than update, sticking with the name 
of the action being done on the underlying set (as update takes an iterable). 
Agree/disagree?

I need to add tests and docs to the patch I wrote up - I'll put it up here 
tomorrow.

--
nosy: +brian.curtin

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



[issue7610] Cannot use both read and readline method in same ZipExtFile object

2010-01-04 Thread Nir Aides

Nir Aides n...@winpdb.org added the comment:

 Thank you. Are you sure the Shortcut common case in readline() 
 is useful? BufferedIOBase.readline() in itself should be rather fast.

On my dataset the shortcut speeds up readline() 400% on top of the default C 
implementation. 

I can take a look to why the C implementation is slow (although it is 
documented as slowish).

 Also, I'm not sure what happens in readline() in universal mode when 
 the chunk ends with a '\r' and there's a '\n' in the following chunk 
 (see the ugly check that your patch removes). Is there a test for that?

The regular pattern returns either a line chunk or a newline (sequence) but not 
both. To read a line there is therefore a minimum of two peek() calls. One for 
the line content and the last for the newline. Since the peek is called with a 
value of 2, the newline sequence \r\n should be retrieved as is. There is no 
test for that.

--

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



[issue7638] Counterintuitive str.splitlines() inconsistency.

2010-01-04 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

IMHO this code will do the trick:

while not request_buffer.endswith(('\r', '\n')):
request_buffer += self.conn.recv(1024)
print(Got a line!)

print(Got an empty line!)
self.handleRequest(request_buffer)

--
nosy: +flox

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Added file: http://bugs.python.org/file15744/issue7622_test_splitlines.diff

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



[issue7622] [patch] improve unicode methods: split() rsplit() and replace()

2010-01-04 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file15741/issue7622_test_splitlines.diff

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



[issue7634] next/previous links in documentation skip some sections

2010-01-04 Thread Ezio Melotti

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

I think the purpose of the 'next' and 'previous' is to move to the 
next/previous page (i.e. file) and not another section in the same page. If you 
read a page till the end and then you press 'next' you probably want to go to 
the next page, not to next section that is in the middle of the page that you 
just read.
I agree that sometimes it looks weird though, especially in the index.
The only thing that IMHO could be fixed is limiting the number of sections in 
a page to 1, otherwise I'd just close this as won't fix.

--
nosy: +ezio.melotti
priority:  - normal
status: open - pending

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