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

2009-12-01 Thread flox

flox  added the comment:

Proposed patch following suggestion of And Clover.

Compliant with documentation:
«Files are always opened in binary mode, even if no binary mode was
specified. This is done to avoid data loss due to encodings using 8-bit
values. This means that no automatic conversion of '\n' is done on
reading and writing.»

--
keywords: +patch
nosy: +flox
Added 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



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

2009-12-01 Thread flox

Changes by flox :


Added file: http://bugs.python.org/file15423/issue691291_py3k.diff

___
Python tracker 

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



[issue7413] datetime.datetime.isoformat truncation problem

2009-12-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Here is a test + fix.

--
assignee:  -> amaury.forgeotdarc
keywords: +patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file15424/isoformat.patch

___
Python tracker 

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



[issue7416] select module compile errors breaks OS X multi-architecture builds

2009-12-01 Thread Ned Deily

New submission from Ned Deily :

Release blocker

The changes for Issue7211 to support 64-bit kevent ident fields
in 64-bit builds cause compile errors on those OS X multi-arch
builds which include both 32-bit and 64-bit variants.

Problem is reproducible by this simplified build config:

   configure --with-universal-archs=intel --enable-universalsdk=/
   make

To support C data types which vary between 32-bit and 64-bit builds,
Include/pymacconfig.h does some magic conditional type definitions
overriding the standard values derived from autoconf configure
processing.  Previously, SIZEOF_UINTPTR_T was not referenced in
the Python source; now that selectmodule.c uses it, it needs
to be added to pymacconfig.h.  The attached patch does that.

Although the select changes were only added to trunk (r76108)
and py3k (r76111), it would be better to apply this patch to the
maintenance branches as well in the event something else gets
added or backported to them.

--
assignee: ronaldoussoren
components: Library (Lib), Macintosh
files: issue-select-kevent-osx.txt
messages: 95851
nosy: ned.deily, pitrou, ronaldoussoren
severity: normal
status: open
title: select module compile errors breaks OS X multi-architecture builds
type: compile error
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file15425/issue-select-kevent-osx.txt

___
Python tracker 

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



[issue7380] uuid.UUID.bytes gives a bytearray() instead of bytes

2009-12-01 Thread flox

Changes by flox :


Added file: http://bugs.python.org/file15426/issue7380_py3k.diff

___
Python tracker 

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



[issue7380] uuid.UUID.bytes gives a bytearray() instead of bytes

2009-12-01 Thread flox

Changes by flox :


Removed file: http://bugs.python.org/file15388/issue7380.diff

___
Python tracker 

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



[issue7211] select module - kevent ident field 64 bit issue

2009-12-01 Thread Ned Deily

Ned Deily  added the comment:

This patch causes build errors on 32-bit/64-bit multi-architecture builds 
on OS X.  See Issue7416 for more info and a patch.

--
nosy: +ned.deily

___
Python tracker 

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



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2009-12-01 Thread egaudry

egaudry  added the comment:

I came across this (very) interesting thread after experiencing some
redistribution issue with a python(2.6)-based package built with msvc9
compiler.

I used to struggled with the SxS Microsoft policy in the past. After I
finally went for the private assembly/crt runtime redistribution
solution, I always succeeded to deliver a stand-alone package to any
windows host around (I got full control on what's actually build and
distribute). 

Having now (using the disutils module) the manifest file embedded in the
python extension actually forbids this redistribution solution, for the
reasons that have been posted here (SxS policy), unless a private
assembly/crt runtime is provided next to each built extension. IMHO,
this is not a convenient (and common) way to redistribute a software.

This is why I fully agree with the propositions that were made here,
i.e. not embedding manifest into a python extension built with the
distutils module and msvc.

Could anyone tell us if a decision has been made about such a change ?

Thanks,
Eloi

--
nosy: +egaudry

___
Python tracker 

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



[issue7413] datetime.datetime.isoformat truncation problem

2009-12-01 Thread Eric Smith

Eric Smith  added the comment:

The patch looks okay to me, and works on 2.7. Although it's slightly out
of date with respect to line numbers, it still applies cleanly.

My trivial suggestions are that I'd replace:
x += PyOS_snprintf(buffer + 8, bufflen - 8, ".%06d", us);
with
x += PyOS_snprintf(buffer + x, bufflen - x, ".%06d", us);
in the extremely unlikely event that the time format string ever
changes. I'd probably also throw in an assert(bufflen >= x).

But these 2 points are nits.

--
assignee: amaury.forgeotdarc -> 
components: +Extension Modules
nosy: +eric.smith
priority:  -> normal
stage:  -> patch review
type:  -> behavior
versions: +Python 2.6, Python 2.7

___
Python tracker 

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



[issue7401] os.write and os.close on pipe from separate threads hangs on Mac OS X

2009-12-01 Thread Hugh Secker-Walker

Hugh Secker-Walker  added the comment:

I have an ADC account that I only ever use to get XCode.  I'll file a
bug-report with Apple.

--

___
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-01 Thread ulrik

New submission from ulrik :

Python 3.1.1's open has no signature in the docstring so the
documentation for this builtin function is unfortunately very confusing
(IMO is missing the most important part).

>>> help(open)

open(...)
Open file and return a stream.  Raise IOError upon failure.

...



This must be a regression from the C port of the io module.

I'm keeping my eyes open for more issues like this. Python must be more
friendly to newcomers, but I have seen tendencies of confusing
documentation in Python 3.

--
components: Library (Lib)
messages: 95856
nosy: englabenny
severity: normal
status: open
title: open builtin has no signature in docstring
versions: Python 3.1

___
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-01 Thread Carl Chenet

New submission from Carl Chenet :

Hi,

The hashlib module could provide a tuple offering the names of the
different hash algorithms which are guaranteed to be supported.

The expected result: 

>>> import hashlib
>>> hashlib.algorithms
('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')

Here is a patch to do so. It also provides an update for the hashlib
documentation and a test case.

Bye,
Carl Chenet

--
components: Library (Lib)
files: algorithms_constant_attribute_in_hashlib_module.diff
keywords: patch
messages: 95857
nosy: chaica_
severity: normal
status: open
title: hashlib : the names of the different hash algorithms
type: feature request
versions: Python 3.2
Added file: 
http://bugs.python.org/file15427/algorithms_constant_attribute_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



[issue7417] open builtin has no signature in docstring

2009-12-01 Thread flox

flox  added the comment:

Proposed docstring patch.

--
keywords: +patch
nosy: +flox
versions: +Python 3.2
Added 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



[issue7416] select module compile errors breaks OS X multi-architecture builds

2009-12-01 Thread Michael Broghton

Changes by Michael Broghton :


--
nosy: +mbroughton

___
Python tracker 

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



[issue7416] select module compile errors breaks OS X multi-architecture builds

2009-12-01 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

I'm currently testing a patch that adds the required SIZEOF_ macros to 
pymacconfig.h, simular to how SIZEOF_LONG and SIZEOF_VOIDP are handled.

I expect to commit a fix later today to the 2.7 and 3.2 branches. The new 
SIZEOF_ macros are only needed for new functionality in selectmodule, and 
hence don't need to be backported to 2.6 or 3.1.

--

___
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-01 Thread flox

flox  added the comment:

I guess you missed the quotes.

$ ./python foo.py 
Traceback (most recent call last):
  File "foo.py", line 2, in 
from hashlib import *
TypeError: attribute name must be string, not 'tuple'

--
nosy: +flox

___
Python tracker 

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



[issue7401] os.write and os.close on pipe from separate threads hangs on Mac OS X

2009-12-01 Thread Hugh Secker-Walker

Changes by Hugh Secker-Walker :


Removed file: http://bugs.python.org/file15420/os_pipe_write_close_bug.c

___
Python tracker 

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



[issue7401] os.write and os.close on pipe from separate threads hangs on Mac OS X

2009-12-01 Thread Hugh Secker-Walker

Hugh Secker-Walker  added the comment:

Updated the C program to deal with command-line args.  This is the
version submitted to Apple Bug Reporter, issue 7433004.

--
Added file: http://bugs.python.org/file15429/os_pipe_write_close_bug.c

___
Python tracker 

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



[issue7416] select module compile errors breaks OS X multi-architecture builds

2009-12-01 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Hugh: why did you remove the .c file? 

I'd prefer to keep the .c file in the python tracker as, just in case 
someone else runs into the same issue and starts debugging the issue.

--

___
Python tracker 

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



[issue7419] Crash in _locale.setlocale on windows

2009-12-01 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc :

import _locale
_locale.setlocale(12345)

Crashes on Windows with exit code 0xc417, a.k.a
STATUS_INVALID_CRUNTIME_PARAMETER.
2.6 and 3.0 are not affected.

setlocale should check the category before passing it to the C runtime:
   LC_MIN <= category && category <= LC_MAX

--
components: Windows
messages: 95863
nosy: amaury.forgeotdarc
severity: normal
status: open
title: Crash in _locale.setlocale on windows
versions: Python 2.7, Python 3.1

___
Python tracker 

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



[issue7401] os.write and os.close on pipe from separate threads hangs on Mac OS X

2009-12-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Thanks, closing it here as third-party. Feel free to follow up here with
news on Apple's resolution of the issue.

--
resolution:  -> wont fix
status: open -> closed
versions: +3rd party

___
Python tracker 

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



[issue7401] os.write and os.close on pipe from separate threads hangs on Mac OS X

2009-12-01 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Hugh: never mind 


There is a workaround for this issue: use socketpair(2) instead of 
pipe(2). I haven't thought enough about the consequences yet to have an 
firm opinion on implementing os.pipe using socketpair(2) on OSX. My gut 
feeling is that we shouldn't because pipes and sockets can have slightly 
different behavior, especially w.r.t. buffering.

As a workaround for this issue you can at least use socket.socketpair 
instead of os.pipe.

--

___
Python tracker 

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



[issue7416] select module compile errors breaks OS X multi-architecture builds

2009-12-01 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Fixed in r76623 (trunk) and r76624 (3.2).

(The commit message mentions another issue, that's a copy-paste error on 
my end)

--
resolution:  -> fixed
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



[issue7317] Display full tracebacks when an error occurs asynchronously

2009-12-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Seconded. 
But such messages are also printed when the interpreter exits, when
poorly written __del__ methods access already disposed modules. Raising
a full traceback could cause users to think that the error is more
severe than it is.

Is there an already existing flag that could control this behaviour?
Otherwise, well, just ignore my remark.

--
nosy: +amaury.forgeotdarc

___
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-01 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue7420] turtle - turtle.update() doesn't override turtle.tracer()

2009-12-01 Thread "Dragon" Dave McKee

New submission from "Dragon" Dave McKee :

Problem:
Using the following code gives different behaviour on versions 2.6.4 and
3.0.1: nothing will be drawn under 3.0.1, but turtle.update() will force
the line to be drawn under 2.6.4. 2.6.4's behaviour is compatible with
the documentation: "turtle.update() - Perform a TurtleScreen update. To
be used when tracer is turned off."

import turtle
from time import sleep
turtle.tracer(100,0) # update screen after 100 drawings
turtle.fd(100)
turtle.update() # force update
sleep(100) # so you can see what's on the screen.

workaround:
use turtle.tracer(1) after drawing instead of turtle.update()

--
components: Extension Modules
messages: 95868
nosy: dragon
severity: normal
status: open
title: turtle - turtle.update() doesn't override turtle.tracer()
type: behavior
versions: Python 3.0

___
Python tracker 

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



[issue6974] test_posix getcwd test leaves tmp dir

2009-12-01 Thread R. David Murray

R. David Murray  added the comment:

This was fixed in response to another bug report a few months ago.

--
nosy: +r.david.murray
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-12-01 Thread R. David Murray

R. David Murray  added the comment:

I agree that this is not something that Popen should be doing.  If you
need the environment variable set, the correct thing to do is what you
did: set it in the environment you pass to Popen.

--
nosy: +r.david.murray
priority:  -> normal
resolution:  -> rejected
stage:  -> committed/rejected
status: open -> closed
type:  -> feature request

___
Python tracker 

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



[issue7421] Given

2009-12-01 Thread Angel

New submission from Angel :

# Area calculation program

print  "Show Area"
print  "--"
print

# Print out the menu:
print  "Please select a shape:"
print  "1  Rectangle"
print  "2  Circle"

# Get the user's choice:
shape = input (">  ")

# Calculate the area:
if shape  == 1:
height  = input ("Please enter the height:  ")
width  = input ("Please enter the width:  ")
area = height*width
print "The area is", area
else:
radius = input ("Please enter the radius:  ")
area = 3.14* (radius**2)
print "The area is", area

--
components: Windows
messages: 95871
nosy: Fallen
severity: normal
status: open
title: Given
versions: 3rd party

___
Python tracker 

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



[issue7421] Given

2009-12-01 Thread Eric Smith

Eric Smith  added the comment:

If you have a question to ask, this is not the proper forum. Please see
python-list http://mail.python.org/mailman/listinfo/python-list

--
nosy: +eric.smith
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue5027] xml namespace not understood by xml.sax.saxutils.XMLGenerator

2009-12-01 Thread Troy J. Farrell

Troy J. Farrell  added the comment:

I've duplicated the issue and the fix using Python 2.6.2.  I'm attaching 
Soren Roug's fix in patch form.  (I created the patch against r53754 of 
saxutils.py.)

--
keywords: +patch
nosy: +troy
versions: +Python 2.6
Added file: http://bugs.python.org/file15430/saxutils.issue5027.patch

___
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-01 Thread Eric Smith

Eric Smith  added the comment:

This patch has tests that currently pass on trunk. I think this is the
desired behavior. I need to augment the tests for format() testing.

--
Added file: http://bugs.python.org/file15431/issue4482_tests-1.patch

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

Mark Dickinson  added the comment:

Looks good to me, except that the second comment in the patch doesn't make 
a lot of sense any more.

--

___
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-01 Thread Eric Smith

Eric Smith  added the comment:

This version adds format() testing and fixes the comments (I hope).

--
Added file: http://bugs.python.org/file15432/issue4482_tests-2.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-01 Thread Georg Brandl

Georg Brandl  added the comment:

Looks good to me (module indentation).

--
assignee:  -> pitrou
nosy: +georg.brandl, pitrou

___
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-01 Thread Georg Brandl

Georg Brandl  added the comment:

Make that "modulo."

--

___
Python tracker 

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



[issue7422] Document inspect.get(full)argspec limitation to Python function

2009-12-01 Thread Terry J. Reedy

New submission from Terry J. Reedy :

"inspect.getargspec(func) 
Get the names and default values of a function’s arguments. "
"inspect.getfullargspec(func) 
Get the names and default values of a function’s arguments."

'Function' must be a Python function (or a bound method wrapper
thereof). (Some posted this 'discovery' on python-list today, so it is
not obvious to everyone.)

Suggestion: insert 'Python' before "function's"
or rewrite as
"Get the names and default values of the arguments of a Python function
or bound method."

This is a different request from #1748064, which requested that the
limitation be removed.

--
assignee: georg.brandl
components: Documentation
messages: 95879
nosy: georg.brandl, tjreedy
severity: normal
status: open
title: Document inspect.get(full)argspec limitation to Python function
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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

Mark Dickinson  added the comment:

LGTM.

--

___
Python tracker 

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



[issue7419] Crash in _locale.setlocale on windows

2009-12-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Fixed with r76625 (trunk), r76626 (py3k) and r76627 (relase31-maint)

--
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



[issue7413] datetime.datetime.isoformat truncation problem

2009-12-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Here is a new patch against a fresh trunk, and with the suggested changes: 
they indeed make the code more consistent with other parts.

--
keywords: +needs review
Added file: http://bugs.python.org/file15433/isoformat-2.patch

___
Python tracker 

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



[issue7413] datetime.datetime.isoformat truncation problem

2009-12-01 Thread Eric Smith

Eric Smith  added the comment:

I think you need to put an assert before the line with bufflen-x, since
that's the calculation you're trying to ensure doesn't underflow. And I
guess that technically you should inspect the result of PyOS_snprintf
for an error, but given that we know the buffer sizes it's not so important.

Other than that, looks good. Sorry for the piecemeal patch review.

--

___
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-01 Thread R. David Murray

R. David Murray  added the comment:

In python3:

>>> locale.setlocale(locale.LC_NUMERIC, "cs_CZ.UTF-8")
'cs_CZ.UTF-8'
>>> s = format(Decimal("-1.5"),  ' 019.18n')
>>> len(s)
20
>>> print(s)
-0 000 000 000 001,5

Python3 uses unicode for strings.  Python2 uses bytes.  To format
unicode in python2, you do:

>>> s2 = locale.format("% 019.18g", Decimal("-1.5"))
>>> len(s2)
19
>>> print s2
-0001,5

Not quite the same thing, clearly.  So, is there a way to access the
python3 unicode format semantics in python2?  Just passing format a
unicode format string results in a UnicodeDecodeError.

--
nosy: +r.david.murray
priority:  -> normal
type:  -> behavior
versions: +Python 2.6, Python 2.7

___
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-01 Thread flox

flox  added the comment:

Indentation is not easy on this part.
The list of arguments overflow the 79 chars limit.
With the proposed patch, the generated output is something like:


open(file, mode='r', buffering=None, encoding=None,
   errors=None, newline=None, closefd=True) -> file object

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

...


Is it wrong?

--

___
Python tracker 

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



[issue7420] turtle - turtle.update() doesn't override turtle.tracer()

2009-12-01 Thread R. David Murray

R. David Murray  added the comment:

I see a line when I try this on 3.1 and trunk.  There were some updates,
so I suppose this has been fixed.  3.0 has been replaced by 3.1 and is
no longer maintained.

--
nosy: +gregorlingl, r.david.murray
priority:  -> normal
resolution:  -> out of date
status: open -> closed

___
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-01 Thread Eric Smith

Eric Smith  added the comment:

In 2.7, I get:

$ ./python.exe 
Python 2.7a0 (trunk:76501, Nov 24 2009, 14:57:21) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_NUMERIC, "cs_CZ.UTF-8")
'cs_CZ.UTF-8'
>>> from decimal import Decimal
>>> s = format(Decimal("-1.5"),  ' 019.18n')
>>> s
'-0 000 000 000 001,5'
>>> len(s)
20
>>> s = format(Decimal("-1.5"),  u' 019.18n')   
>>> s
u'-0 000 000 000 001,5'
>>> len(s)
20
>>> 

Could you give more details on the UnicodeDecodeError you get? Any
traceback?

--

___
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-01 Thread R. David Murray

R. David Murray  added the comment:

Interesting.  My regular locale is LC_CTYPE=en_US.UTF-8, and here is
what I get:

Python 2.7a0 (trunk:76501, Nov 24 2009, 13:59:01) 
[GCC 4.4.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import local
>>> import locale
>>> locale.setlocale(locale.LC_NUMERIC, "cs_CZ.UTF-8")
'cs_CZ.UTF-8'
>>> from decimal import Decimal
>>> s = format(Decimal("-1.5"),  ' 019.18n')
>>> s
'-0\xc2\xa\xc2\xa\xc2\xa0001,5'
>>> len(s)
19
>>> print s
-0 000 000 001,5

sys.stdout.encoding gives 'UTF-8'.

And here's the traceback from trying to use unicode:

>>> s = format(Decimal("-1.5"),  u' 019.18n')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/rdmurray/python/trunk/Lib/decimal.py", line 3609, in
__format__
return _format_number(self._sign, intpart, fracpart, exp, spec)
  File "/home/rdmurray/python/trunk/Lib/decimal.py", line 5704, in
_format_number
return _format_align(sign, intpart+fracpart, spec)
  File "/home/rdmurray/python/trunk/Lib/decimal.py", line 5595, in
_format_align
result = unicode(result)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2:
ordinal not in range(128)

--

___
Python tracker 

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



[issue7422] Document inspect.get(full)argspec limitation to Python function

2009-12-01 Thread Brett Cannon

Brett Cannon  added the comment:

Just in case anyone else gets confused, Terry's desire for the 
clarification is that getargspec() won't work with functions originating 
from an extension module.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2009-12-01 Thread bogklug

New submission from bogklug :

The first of the two maps below gives strange result due to the nested
generator expression (I guess it should give the same result as the
second map).

In [1]: map(list, [(x+y for y in 'c') for x in 'ab'])
Out[1]: [['bc'], ['bc']]

In [2]: map(list, [[x+y for y in 'c'] for x in 'ab'])
Out[2]: [['ac'], ['bc']]

--
components: Interpreter Core
messages: 95890
nosy: bogklug
severity: normal
status: open
title: nested generator expression produces strange results
type: behavior
versions: Python 2.5

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2009-12-01 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

By using a generator expression, you are deferring evaluation of the
expression until map() is actually invoked. By that time, the closure
over 'x' has been changed to 'b', so when the genexp is forced, 'x'
yields 'b' each time.

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

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2009-12-01 Thread R. David Murray

R. David Murray  added the comment:

I'd already written then when Benjamin posted his answer, but rather
than waste having written it I'm going to post it anyway :)

You must remember that the purpose of a generator is to evaluate lazily.
 Your expression involving the generator would unwrap this way:

def g1():
for y in 'c':
yield x+y
l = []
for x in 'ab':
l.append(g1())
print l
print map(list, l)

If you run this you will note that 'l' is a pair of generator instances.
 These are not run until the 'map' is executed. By that point the for
loop has completed, and x has its final value, 'b'.  g1 is evaluated
twice, and both times x is 'b', so you get ['bc', 'bc']

--
nosy: +r.david.murray

___
Python tracker 

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



[issue7422] Document inspect.get(full)argspec limitation to Python function

2009-12-01 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Sorry, you confuse me a bit. get(full)argspec also does not work with
builtins. I am asking that the doc be clarified to match behavior so
that people are not surprised by
TypeError: arg is not a Python function
as in written in Python versus C.

--

___
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-01 Thread Eric Smith

Eric Smith  added the comment:

I can duplicate this on Linux. The difference is the values in the
locale for the separators, specifically,
locale.localeconv()['thousands_sep'].

>>> locale.localeconv()['thousands_sep']
'\xc2\xa0'

The question is: since a struct lconv contains char*s, how to interpret
them? The code in decimal interprets them as ascii, apparently. floats
do the same thing, so this isn't strictly a decimal problem. I'll have
to give it some thought.

--

___
Python tracker 

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



[issue7424] segmentation fault in listextend during install

2009-12-01 Thread Jon Buller

New submission from Jon Buller :

On a NetBSD/sparc-current system building from the 2.6.4.tgz file...

Compiling /usr/pkg/lib/python2.6/test/test_bool.py ...
Compiling /usr/pkg/lib/python2.6/test/test_bsddb.py ...
Compiling /usr/pkg/lib/python2.6/test/test_bsddb185.py ...
Compiling /usr/pkg/lib/python2.6/test/test_bsddb3.py ...
Compiling /usr/pkg/lib/python2.6/test/test_buffer.py ...
Compiling /usr/pkg/lib/python2.6/test/test_bufio.py ...
Compiling /usr/pkg/lib/python2.6/test/test_builtin.py ...
[1]   Segmentation fault (core dumped) PYTHONPATH=/usr/...
*** Error code 139

Stop.


and GDB says...

Reading symbols from /usr/lib/libc.so.12...(no debugging symbols
found)...done.
Loaded symbols for /usr/lib/libc.so.12
Reading symbols from
/usr/pkgsrc/lang/python26/work/Python-2.6.4/build/lib.netbsd-5.99.15-sparc-2.6/unicodedata.so...
(no debugging symbols found)...done.
Loaded symbols for
/usr/pkgsrc/lang/python26/work/Python-2.6.4/build/lib.netbsd-5.99.15-sparc-2.6/unicodedata.so
Reading symbols from /usr/libexec/ld.elf_so...(no debugging symbols
found)...done.
Loaded symbols for /usr/libexec/ld.elf_so

Core was generated by `python'.
Program terminated with signal 11, Segmentation fault.
#0  0x200b7bac in listextend ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6.so.1.0
(gdb) where
#0  0x200b7bac in listextend ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6.so.1.0
#1  0x20087b00 in PySequence_List ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6.so.1.0
#2  0x20129760 in assemble ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6..so.1.0
#3  0x2012e12c in compiler_function ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6.so.1.0
#4  0x2012e288 in compiler_body ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6.so.1.0
#5  0x2012e498 in compiler_class ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6.so.1.0
#6  0x2012e288 in compiler_body ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6.so.1.0
#7  0x2012e958 in PyAST_Compile ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6.so.1.0
#8  0x20142a48 in Py_CompileStringFlags ()
   from /usr/pkgsrc/lang/python26/work/Python-2.6.4/libpython2.6.so.1.0

...

--
components: Installation
messages: 95895
nosy: j...@bullers.net
severity: normal
status: open
title: segmentation fault in listextend during install
type: crash
versions: Python 2.6

___
Python tracker 

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



[issue7422] Document inspect.get(full)argspec limitation to Python function

2009-12-01 Thread Brett Cannon

Brett Cannon  added the comment:

That's basically what I said.

--

___
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-01 Thread flox

flox  added the comment:

According to PEP257:
«Multi-line docstrings consist of a summary line just like a one-line
docstring, followed by a blank line, followed by a more elaborate
description.»

Maybe this second patch is more conventional?

--
Added 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