[issue691291] codecs.open(filename, 'U', 'UTF-16') corrupts text

2009-12-02 Thread flox

Changes by flox :


Added file: http://bugs.python.org/file15435/issue691291.diff

___
Python tracker 

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



[issue691291] codecs.open(filename, 'U', 'UTF-16') corrupts text

2009-12-02 Thread flox

Changes by flox :


Removed file: http://bugs.python.org/file15422/issue691291.diff

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread flox

Changes by flox :


Removed file: http://bugs.python.org/file15434/issue7417_py3k_pep257.diff

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread flox

Changes by flox :


Removed file: http://bugs.python.org/file15428/issue7417_py3k.diff

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread flox

flox  added the comment:

Actually the docstring of _pyio.open Python function should not change.

The patch is smaller.

--
Added file: http://bugs.python.org/file15436/issue7417_py3k.diff

___
Python tracker 

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



[issue7418] hashlib : the names of the different hash algorithms

2009-12-02 Thread Carl Chenet

Carl Chenet  added the comment:

flox : You're right, sorry about that.

Here is a fixed patch.

--
Added file: 
http://bugs.python.org/file15437/algorithms_constant_value_in_hashlib_module.diff

___
Python tracker 

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



[issue7418] hashlib : the names of the different hash algorithms

2009-12-02 Thread Carl Chenet

Changes by Carl Chenet :


Removed file: 
http://bugs.python.org/file15437/algorithms_constant_value_in_hashlib_module.diff

___
Python tracker 

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



[issue7418] hashlib : the names of the different hash algorithms

2009-12-02 Thread Carl Chenet

Carl Chenet  added the comment:

The fixed file :
algorithms_constant_attribute_in_hashlib_module_update1.diff

--
Added file: 
http://bugs.python.org/file15438/algorithms_constant_attribute_in_hashlib_module_update1.diff

___
Python tracker 

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



[issue7327] format: minimum width: UTF-8 separators and decimal points

2009-12-02 Thread Stefan Krah

Stefan Krah  added the comment:

In python3.2, the output of decimal looks good. With float, the
separator is printed as two spaces on my Unicode terminal (export
LC_ALL=cs_CZ.UTF-8).

So decimal (3.2) interprets the separator string as a single UTF-8 char
and the final output is a UTF-8 string. I'd say that in C, this is the
intended way of using struct lconv.

If there is an agreement that the final output should be a UTF-8 string,
this looks correct to me.



Python 3.2a0 (py3k:76081M, Nov  6 2009, 15:23:48) 
[GCC 4.1.3 20080623 (prerelease) (Ubuntu 4.1.2-23ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale, decimal
>>> locale.setlocale(locale.LC_NUMERIC, 'cs_CZ.UTF-8')
'cs_CZ.UTF-8'
>>> x = format(decimal.Decimal("-1.5"),  '019.18n')
>>> y = format(float("-1.5"),  '019.18n')
>>> x
'-0\xa\xa\xa\xa0001,5'
>>> y
'-0ᅡᅠ000ᅡᅠ000ᅡᅠ001,5'
>>> print(x)
-0 000 000 000 001,5
>>> print(y)
-0ᅡᅠ000ᅡᅠ000ᅡᅠ001,5
>>>

--

___
Python tracker 

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



[issue7327] format: minimum width: UTF-8 separators and decimal points

2009-12-02 Thread Mark Dickinson

Mark Dickinson  added the comment:

So when the format string has type 'str' (as in Stefan's original example) 
rather than type 'unicode', I'd say Python is doing the right thing 
already:  everything in sight, including the separators coming from 
localeconv(), has type 'str', so trying to interpret things as unicode 
seems a bit of a stretch.

If the '\xc2\xa0' from localeconv()['thousands_sep'] is to be interpreted 
as a single unicode character, shouldn't it be a unicode
string already?

However, if localeconv()['thousands_sep'] *were* to give a unicode string, 
then I suppose Decimal.__format__ should be returning a unicode result;  I 
don't think it currently does this.  (Should this be true even if the 
number being formatted is so short that no thousands separators actually 
appear in it?)

--

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread Ulrik Sverdrup

Ulrik Sverdrup  added the comment:

import builtins; help(builtins)

Looking around, the new suggestion is absolutely unconventional. The
signature must be on the first line. One builtin function even uses two
lines; min:

min(iterable[, key=func]) -> value
min(a, b, c, ...[, key=func]) -> value

With a single iterable argument, return its smallest item.
With two or more arguments, return the smallest argument.

I would ack a two-line signature at the start of the docstring, however
I will also suggest an alternative:

Aligning open's signature description with the builtins module, this is
the style that is most common:

open(file[, mode[, buffering[, encoding[, errors[, newline[,
closefd]]) -> file object

perhaps even an abbreviation is allowed at the end?

open(file[, mode[, buffering[, encoding[, errors[, newline[,
closefd]..]) -> file object

However that open has so many kwargs should almost be a bug in itself.

--

___
Python tracker 

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



[issue7327] format: minimum width: UTF-8 separators and decimal points

2009-12-02 Thread Eric Smith

Eric Smith  added the comment:

I don't see any documentation that a struct lconv should be interpreted
as UTF-8. In fact Googling "struct lconv utf-8" gives this bug report as
the first hit.

lconv.thousands_sep is char*. It's never been clear to me if this means
"pointer to a single char", or "pointer to a null terminated string of
char". In Objects/stringlib/localeutil.h I treat it as a string of char.

--

___
Python tracker 

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



[issue1100942] Add datetime.time.strptime and datetime.date.strptime

2009-12-02 Thread Thomas Guettler

Changes by Thomas Guettler :


--
nosy: +guettli

___
Python tracker 

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



[issue7333] Add initgroups to the posix/os modules

2009-12-02 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

The documentation is os.rst is too laconic (coming from the Windows
world, I could not understand what the function is about).
The docstring is much better (at least I understand it's related to the
Unix security model), I suggest to use it for the documentation.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue7327] format: minimum width: UTF-8 separators and decimal points

2009-12-02 Thread Eric Smith

Eric Smith  added the comment:

In trunk, Modules/_localemodule.c also treats these as "string of char",
so at least we're consistent.

In py3k, mbstowcs is used and the result passed to PyUnicode_FromWideChar.

I'm not sure how you'd address this in locale in trunk, or if we want to
do something similar in localeutil.h in trunk (for the Unicode case).

--

___
Python tracker 

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



[issue7327] format: minimum width: UTF-8 separators and decimal points

2009-12-02 Thread Stefan Krah

Stefan Krah  added the comment:

Googling "multi-byte thousands separator" gives better results. From
those results, it is clear to me that decimal_point and thousands_sep
are strings that may be interpreted as multi-byte characters. The Czech
separator appears to be a no-break space multi-byte character.


http://sourceware.org/ml/libc-hacker/2007-01/msg5.html
http://drupal.org/node/353897


My point is that if a multi-byte character appears, it should be
counted as a single character for the purposes of calculating
min-width. Otherwise, the printed representation is too short.

--

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread flox

flox  added the comment:

Ulrik,

I agree that most builtins have the signature on first lines.
I will not apply this part of the PEP257.

But it seems that the "[...]" syntax is not enforced for all builtins.
See "help(print)", "help(sorted)" and "help(__import__)" examples:

>>> print(print.__doc__)
print(value, ..., sep=' ', end='\n', file=sys.stdout)

Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep:  string inserted between values, default a space.
end:  string appended after the last value, default a newline.

>>> print(sorted.__doc__)
sorted(iterable, key=None, reverse=False) --> new sorted list

>>> print(__import__.__doc__)
__import__(name, globals={}, locals={}, fromlist=[], level=-1) -> module

Import a module.  The globals are only used to determine the context;
they are not modified...



Patch is updated.

--
Added file: http://bugs.python.org/file15439/issue7417_py3k.diff

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread flox

Changes by flox :


Removed file: http://bugs.python.org/file15436/issue7417_py3k.diff

___
Python tracker 

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



[issue7333] Add initgroups to the posix/os modules

2009-12-02 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

New version attached which makes the os.rst docs the same as the
docstring.  Also fixes a conflict since introduced in trunk in configure.in.

--
Added file: http://bugs.python.org/file15440/initgroups-5.patch

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread flox

flox  added the comment:

Or I suggest something more verbose...


>>> print(open.__doc__)
open(filename) -> file object for reading in text mode

open(filename, mode=binary[, buffering]) -> file object in binary mode
open(filename[, mode=text][, buffering][,encoding][,errors][,newline])
 -> file object in text mode

open(file_descriptor[, ...][, closefd]) -> file object

Open file and return a stream.  Raise IOError upon failure.

filename is either a text or byte string giving the name (and the path
if the file isn't in the current working directory) of the file to
be opened.

file_descriptor is an integer file descriptor of the file to be
wrapped. The file descriptor is closed when the returned I/O object is
closed, unless closefd is set to False.)

mode is an optional string that specifies the mode in which the file
is opened...

--

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread flox

flox  added the comment:

(patch attached: explicit signature)

I vote +1 for something more explicit.
« Explicit is better than implicit. »

>>> help(open)
Help on built-in function open in module io:

open(...)
open(file_name_or_path) -> file object for reading in text mode
open(file_name_or_path, mode=binary_mode[, buffering]) -> file objec
open(file_name_or_path[, mode=text_mode[, buffering[, encoding
  [, errors[, newline]) -> file object
open(file_descriptor[, ...[, closefd]]) -> file object

Open file and return a stream.  Raise IOError upon failure.

file_name_or_path is either a text or byte string giving the name
(and the path if the file isn't in the current working directory)
of the file to be opened.

file_descriptor is an integer file descriptor of the file to be
wrapped. The file descriptor is closed when the returned I/O object
is closed, unless closefd is set to False.)

mode is an optional string that specifies the mode in which the file
is opened...

--
Added file: http://bugs.python.org/file15441/issue7417_py3k_explicit.diff

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread flox

Changes by flox :


Added file: http://bugs.python.org/file15442/issue7417_py3k_explicit.diff

___
Python tracker 

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



[issue7417] open builtin has no signature in docstring

2009-12-02 Thread flox

Changes by flox :


Removed file: http://bugs.python.org/file15441/issue7417_py3k_explicit.diff

___
Python tracker 

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



[issue7406] int arithmetic relies on C signed overflow behaviour

2009-12-02 Thread Mark Dickinson

Mark Dickinson  added the comment:

Fixed int_sub, int_add, int_mul, and the fast paths for BINARY_ADD and 
BINARY_SUB in ceval.c, in r76629 (trunk) and r76630 (release26-maint).

--

___
Python tracker 

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



[issue7094] Add alternate float formatting styles to new-style formatting.

2009-12-02 Thread Eric Smith

Eric Smith  added the comment:

When and if this is implemented, there's a test in test_float.py that
needs to be deleted. Search on "if not '#' in fmt:", added in r76632.

--

___
Python tracker 

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



[issue4482] 10e667.__format__('+') should return 'inf'

2009-12-02 Thread Eric Smith

Eric Smith  added the comment:

Added tests to trunk in r76632 and py3k in r76634.

Note that the only thing that was changed are the tests. The actual
functionality was fixed earlier when the float formatting was reworked
as part of the short float repr changes.

--
resolution:  -> accepted
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue6594] json C serializer performance tied to structure depth on some systems

2009-12-02 Thread Valentin Kuznetsov

Valentin Kuznetsov  added the comment:

Hi,
I'm sorry for delay, I was busy. Here is a test data file:
http://www.lns.cornell.edu/~vk/files/mangled.json

Its size is 150 MB, 50MB less of original, due to scrambled values I was 
forced to do.

The tests with stock json module in python 2.6.2 is 2GB
source = open('mangled.json', 'r')
data = json.load(source)

Using simplejson 2.0.9 from PyPi I saw the same performance, please note 
_speedups.so C module was compiled.

Using cjson module, I observed 180MB of RAM utilization
source = open('mangled.json', 'r')
data = cjson.encode(source.read())

cjson is about 10 times faster!

I re-factor code which deals with XML version of the same data and I was 
able to process it using cElementTree only using 20MB (!) of RAM.

--

___
Python tracker 

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



[issue1448060] gettext.py breaks on plural-forms header (PATCH)

2009-12-02 Thread Dave Malcolm

Changes by Dave Malcolm :


--
nosy: +dmalcolm

___
Python tracker 

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



[issue1747858] chown broken on 64bit

2009-12-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Looking at posixmodule.c, perhaps other instances of parsing an uid_t or
a gid_t should have been fixed too (lchown, fchown for example)?

--
nosy: +pitrou

___
Python tracker 

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



[issue7333] Add initgroups to the posix/os modules

2009-12-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Slightly modified and committed in r76636 (trunk) and r76637 (py3k).
Thank you.

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

___
Python tracker 

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



[issue7425] [PATCH] Improve the robustness of "pydoc -k" in the face of broken modules

2009-12-02 Thread Dave Malcolm

New submission from Dave Malcolm :

I see occasional failures where a broken module prevents "pydoc -k" ("apropos") 
from working.

Examples of failures (from our downstream bug tracker) are:
https://bugzilla.redhat.com/show_bug.cgi?id=461419 : "pydoc -k" yields 
"NameError: name 'wglUseFontBitmapsW' is not 
defined"
(a broken OpenGL/WGL/__init__.py module)

https://bugzilla.redhat.com/show_bug.cgi?id=447779 : "pydoc turbogears" doesn't 
work
(broken TurboGears module)

https://bugzilla.redhat.com/show_bug.cgi?id=246212 : "pydoc -k searchterm" 
MemoryError. permission denied.
(module only intended to be importable as "root" user)

In each case one or more of the many modules on the system are broken, and 
importing them leads to an exception being 
raised that isn't ImportError.

In each case, the exception bubbles up through the pydoc call ands leads to it 
exiting.

Obviously the broken modules should be fixed, but it seems to me that pydoc 
could be more robust against this situation.

I'm attaching a simple patch which makes "pydoc -k" more robust against this 
situation, by silently discarding all 
exceptions raised by imported modules.

How does this look?

One downstream bug report requested taking it further:
> Running "pydoc -k" should catch all exceptions while importing modules, and
> display failed modules _after_ all positive keyword matches (not in between).
> It also should redirect stdout/stderr while importing so error message e.a.
> don't clutter up the list of hits.  
to deal with broken modules that spew error messages (this was in 
https://bugzilla.redhat.com/show_bug.cgi?id=461419#c3 
); I've seen some do it to stdout and some to stderr.

How does this sound?  I can try to update the patch for this too, if this 
sounds sane to you.

--
components: Demos and Tools
files: make-pydoc-more-robust-001.patch
keywords: patch
messages: 95918
nosy: dmalcolm
severity: normal
status: open
title: [PATCH] Improve the robustness of "pydoc -k" in the face of broken 
modules
versions: Python 2.6
Added file: http://bugs.python.org/file15443/make-pydoc-more-robust-001.patch

___
Python tracker 

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



[issue2504] Add gettext.pgettext() and variants support

2009-12-02 Thread Wil Clouser

Changes by Wil Clouser :


--
nosy: +clouserw

___
Python tracker 

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



[issue6594] json C serializer performance tied to structure depth on some systems

2009-12-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Using cjson module, I observed 180MB of RAM utilization
> source = open('mangled.json', 'r')
> data = cjson.encode(source.read())
> 
> cjson is about 10 times faster!

This is simply wrong. You should be using cjson.decode(), not
cjson.encode().
If you do so, you will see that cjson tajes as much as memory as
simplejson and is actually a bit slower.

Looking at your json file, I would have a couple of suggestions:
- don't quote integers and floats, so that they are decoded as Python
ints and floats rather than strings
- if the same structure is used a large number of times, don't use
objects, use lists instead

--

___
Python tracker 

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



[issue6594] json C serializer performance tied to structure depth on some systems

2009-12-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

That said, it is possible to further improve json by reducing the number
of memory allocations and temporary copies. Here is an experimental
(meaning: not polished) patch which gains 40% in decoding speed in your
example (9 seconds versus 15).

We could also add an option to intern object keys when decoding (which
wins 400MB in your example); or, alternatively, have an internal "memo"
remembering already seen keys and avoiding duplicates.

--
keywords: +patch
Added file: http://bugs.python.org/file15444/json-opts.patch

___
Python tracker 

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



[issue6594] json C serializer performance tied to structure depth on some systems

2009-12-02 Thread Valentin Kuznetsov

Valentin Kuznetsov  added the comment:

Oops, that's explain why I saw such small memory usage with cjson. I 
constructed tests on a fly.

Regarding the data structure. Unfortunately it's out of my hands. The 
data comes from data-service. So, I can't do much and can only report to 
developers. 

I'll try your patch tomorrow. Obviously it's a huge gain, both in memory 
footprint and CPU usage.

Thanks.
Valentin.

--

___
Python tracker 

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



[issue2422] Automatically disable pymalloc when running under valgrind

2009-12-02 Thread Robert Collins

Changes by Robert Collins :


--
nosy: +rbcollins

___
Python tracker 

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



[issue7177] Unclear warning for subprocess.call

2009-12-02 Thread Philip Jenvey

Philip Jenvey  added the comment:

Improved in r76640 / r76641 to explicitly mention this applies to 
stdout/err=PIPE

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

___
Python tracker 

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



[issue2422] Automatically disable pymalloc when running under valgrind

2009-12-02 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Thank you. Applied in r76644.

--
nosy: +benjamin.peterson
resolution:  -> accepted
status: open -> closed

___
Python tracker 

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