[issue1717] Get rid of more references to __cmp__

2009-01-28 Thread Mark Dickinson

Mark Dickinson  added the comment:

Can anyone who uses tkinter give me some advice?  Does PyTclObject in 
_tkinter.c need to have its tp_richcompare method implemented?  And if so, 
how do I go about testing the implementation?  It seems that PyTclObjects 
aren't directly exposed to Python under 'import tkinter'.

I'll hold off on any more checkins until the 3.0.1 thread on python-dev 
has resolved itself.

___
Python tracker 

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



[issue4707] round(25, 1) should return an integer, not a float

2009-01-28 Thread Mark Dickinson

Mark Dickinson  added the comment:

For myself, I strongly prefer that round(int, int) return an integer in 
Python 3.x.  Here ar\
e three reasons:

(1) Interoperability with Decimal (and, to a lesser extent, Fraction): 
the decimal module is\
 carefully designed so that Decimals interact well with integers.  If 
round(int, int) return\
s an integer then someone working with Decimals can use round freely, 
without worrying about\
 whether his or her numbers are actually integers or Decimals.  If 
round(int, int) returns a\
 float then that someone is likely to get a nasty shock doing 
round(Decimal, int) when it tu\
rns out that the Decimal was actually just a plain integer.

(2) Accuracy:  currently, for example, we have

>>> round(10**16+1, 0)
1.0

If the return type is changed to int, there's no need for this loss of 
accuracy.

(3) Consistency:  in 3.x, round(my_decimal, n) returns a Decimal;  
round(my_fraction, n) ret\
urns a Fraction.  That is, for all Python's numeric types other than 
int, the value returned\
 from two-argument round has the same type as the first argument.

___
Python tracker 

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



[issue4707] round(25, 1) should return an integer, not a float

2009-01-28 Thread STINNER Victor

STINNER Victor  added the comment:

marketdickinson> (2) Accuracy

I see int/float like bytes/characters: it's not a good idea to mix 
them. If you use float, you know that you loose precision (digits) 
after some operations. Whereas I suppose the operations on int are 
always exact.

I like round(int,int)->int (same input/output types). To get a float, 
use round(float(int), int)->float.

--
nosy: +haypo

___
Python tracker 

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



[issue4707] round(25, 1) should return an integer, not a float

2009-01-28 Thread Mark Dickinson

Mark Dickinson  added the comment:

Apologies for the poor formatting in the last comment.  Bad
cut-and-paste job.

One more reason:

(4) "In the face of ambiguity, refuse the temptation to guess."
Why should round(int, int) be float, rather than Decimal, or Fraction?
This was the one argument against the integer division change that I 
found somewhat compelling.  But of course there's a big difference:  1/2 
had to have *some* type, and it couldn't be an integer.  In contrast, 
given that round(34, n) is always integral, there's an obvious choice 
for the return type. 

I'll shut up now.

___
Python tracker 

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



[issue4707] round(25, 1) should return an integer, not a float

2009-01-28 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

It's settled then.  Input type dictates output type.  No dependency on
the actual values.

--
resolution:  -> accepted

___
Python tracker 

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



[issue4707] round(25, 1) should return an integer, not a float

2009-01-28 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> marketdickinson

___
Python tracker 

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



[issue5088] optparse: inconsistent default value for append actions

2009-01-28 Thread Fons Dijkstra

New submission from Fons Dijkstra :

Although it is possible to specify a default value for an append action,  
either directly or through the set_default() function, it is not handled 
correctly when this default is overruled by the user. Take for example 
the following code:

  import optparse
  parser = optparse.OptionParser()
  parser.add_option("-o", "--option", action = "append")
  parser.set_defaults(option = ["a"])
  options, args = parser.parse_args()
  print options

When this is called without arguments the following is printed:
  {'option': ['a']} # as expected

But when it is called with for example with -ob the following is 
printed:
  {'option': ['a', 'b']} # expected {'option': ['b']}

So the default option is also appended, even if the option is explicitly 
defined by the user.

--
components: Library (Lib)
messages: 80704
nosy: pycurry
severity: normal
status: open
title: optparse: inconsistent default value for append actions
type: behavior
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



[issue5089] Error in atexit._run_exitfuncs [...] Exception expected for value, tuple found

2009-01-28 Thread Mark Dickinson

New submission from Mark Dickinson :

When running the test-suite (using "make test") for a 32-bit debug build 
of py3k on OS X 10.5/Core 2 Duo, I occasionally (perhaps 1 time in 10) get 
the following output at the end of a (successful) test_run:

...
test_zipimport_support
test_zlib
301 tests OK.
22 tests skipped:
test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp
test_codecmaps_kr test_codecmaps_tw test_curses test_dbm_gnu
test_epoll test_largefile test_nis test_normalization
test_ossaudiodev test_pep277 test_socketserver test_startfile
test_timeout test_urllib2net test_urllibnet test_winreg
test_winsound test_xmlrpc_net test_zipfile64
Those skips are all expected on darwin.
Error in atexit._run_exitfuncs:
TypeError: print_exception(): Exception expected for value, tuple found
[1264638 refs]


I assume that there's a genuine exception here that we're not seeing;  
i.e., that there's a shallow error (tuple instead of exception) that's 
masking output of information from a deeper error.

--
components: Tests
messages: 80705
nosy: marketdickinson
severity: normal
status: open
title: Error in atexit._run_exitfuncs [...] Exception expected for value, tuple 
found
type: behavior
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



[issue1717] Get rid of more references to __cmp__

2009-01-28 Thread Guilherme Polo

Guilherme Polo  added the comment:

Mark,

I'm not a very huge user of tkinter, but I can tell you it would be
tricky to try getting a PyTclObject. It needs to be exposed if you want
to test it without relying on Tcl, but, to me they are just a
"temporary" object that serves to indicate the caller that it needs to
be converted to something else since _tkinter itself wasn't able to do
it. For this reason I would actually prefer to them not be comparable.

--
nosy: +gpolo

___
Python tracker 

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



[issue2983] Ttk support for Tkinter

2009-01-28 Thread Guilherme Polo

Guilherme Polo  added the comment:

Added in python-trunk now: r69050

I will be merging it into py3k now, and my bad for taking so long to do
this.

___
Python tracker 

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



[issue3997] zipfile and winzip

2009-01-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Yes, the correction went in r68678, r68700, r68734 and r68735

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



[issue1717] Get rid of more references to __cmp__

2009-01-28 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks, Guilherme.

> For this reason I would actually prefer to them not be comparable.

That's fine with me, so long as we can be sure that there's no existing 
code that depends on them being comparable.  I can't figure out whether 
there's any legitimate way that the tp_compare slot (which is currently 
implemented) of a PyTclObject could ever be called.

___
Python tracker 

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



[issue5090] import tkinter library Visual C++ Concepts:C Run-Time Error R6034 when embeded python in c++

2009-01-28 Thread wang

New submission from wang :

import tkinter library Visual C++ Concepts:C Run-Time Error R6034 when 
embeded python in c++

--
components: Tkinter
messages: 80710
nosy: guxianminer
severity: normal
status: open
title: import tkinter library Visual C++ Concepts:C Run-Time Error R6034 when 
embeded python in c++
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



[issue5091] Segfault in PyObject_Malloc(), address out of bounds

2009-01-28 Thread Christian Heimes

New submission from Christian Heimes :

One of our application recently started to segfault in
PyObject_Malloc(). The cause of the problem could be tracked down to an
overflowing internal cache.

However I was astonished that Python was segfaulting instead of raising
a memory exception. I did some post mortem debugging with gdb and found
an address out of bounds problem. I think the issue is caused by the
limited heap of a 32bit Python process.

(gdb) bt
...
#7  
#8  PyObject_Malloc (nbytes=40) at Objects/obmalloc.c:747
#9  0xb7edfba5 in _PyObject_GC_Malloc (basicsize=28) at
Modules/gcmodule.c:1322
#10 0xb7e79867 in PyType_GenericAlloc (type=0xb7606d40, nitems=0) at
Objects/typeobject.c:454
...

(gdb) up 8
#8  PyObject_Malloc (nbytes=40) at Objects/obmalloc.c:747
747 if ((pool->freeblock = *(block **)bp) !=
NULL) {
(gdb) print pool
$1 = (poolp) 0x17ecc000
(gdb) print pool->freeblock
$2 = (block *) 0xecc778b7 
(gdb) print bp
$3 = (block *) 0xecc778b7 

Python: 2.5.2 (32bit)
OS: SuSE Linux 2.6.16.60-0.33-bigsmp

--
components: Interpreter Core
messages: 80711
nosy: christian.heimes
priority: normal
severity: normal
stage: test needed
status: open
title: Segfault in PyObject_Malloc(), address out of bounds
type: crash
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



[issue2983] Ttk support for Tkinter

2009-01-28 Thread Guilherme Polo

Guilherme Polo  added the comment:

r69051 in py3k

Now only samples are missing, I will be doing these later today I think.
And there is an issue regarding regrtest (gui resource), see issue5083.

___
Python tracker 

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



[issue5083] New resource ('gui') for regrtest

2009-01-28 Thread Guilherme Polo

Guilherme Polo  added the comment:

Uhm, maybe this 'gui' resource is too special to live in use_resources ?
Maybe a new option in regrtest would be better ?

___
Python tracker 

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



[issue5083] New resource ('gui') for regrtest

2009-01-28 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Do the tests require human interaction? If so, it should definitely be
another option.

Otherwise, I'm don't know if we'll be wreaking havok with the buildbots
by including it in -uall even if it is automatic.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue5083] New resource ('gui') for regrtest

2009-01-28 Thread Guilherme Polo

Guilherme Polo  added the comment:

> Do the tests require human interaction? If so, it should definitely be
> another option.
>

No interaction is needed for the current ones.

> Otherwise, I'm don't know if we'll be wreaking havok with the buildbots
> by including it in -uall even if it is automatic.
>

I'm worried that those buildbots systems are not really supposed to
have all the libraries required installed, the only exception would be
the ones running under Windows.

___
Python tracker 

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



[issue2983] Ttk support for Tkinter

2009-01-28 Thread Guilherme Polo

Guilherme Polo  added the comment:

samples: r69053 and r69055

Closing the issue now, thanks.

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



[issue4753] Faster opcode dispatch on gcc

2009-01-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

For the record, I've compiled py3k on an embarassingly fast Core2-based
server (Xeon E5410), and the computed gotos option gives a 16% speedup
on pybench and pystone.

(with gcc 4.3.2 in 64-bit mode)

___
Python tracker 

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



[issue2995] Idle, some Linuxes, cannot position Cursor by mouseclick

2009-01-28 Thread Darrell

Darrell  added the comment:

I'm using Mandriva 2009.0 and can confirm this problem. RMeyers
suggested testing further by loading and running idlelibs/IOBinding.py.

On my Linux system I find that the mouse clicks and selection works fine
when running IOBinding.py. Being that this module appears to be built
upon Tkinter, it would seem that the bug is at a higher level?

--
nosy: +dbarabash

___
Python tracker 

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



[issue5057] Unicode-width dependent optimization leads to non-portable pyc file

2009-01-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Is this related to issue3297 ?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue5057] Unicode-width dependent optimization leads to non-portable pyc file

2009-01-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I don't think so. Issue 3297 seems related to the way unicode objects
are marshalled/unmarshalled, even if the build settings don't change.

___
Python tracker 

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



[issue5083] New resource ('gui') for regrtest

2009-01-28 Thread Brett Cannon

Brett Cannon  added the comment:

Well, if the libraries for Ttk are not included then the tests should
get skipped when the import fails.

A key reason to leaving something out of 'all' is if it takes a REALLY
long time like the zipfile64 tests.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue4631] urlopen returns extra, spurious bytes

2009-01-28 Thread Te-jé Rodgers

Changes by Te-jé Rodgers :


--
nosy: +trodgers

___
Python tracker 

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



[issue4631] urlopen returns extra, spurious bytes

2009-01-28 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone :


--
nosy:  -exarkun

___
Python tracker 

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



[issue5090] import tkinter library Visual C++ Concepts:C Run-Time Error R6034 when embeded python in c++

2009-01-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Please be more specific. What did you try exactly?
If you embed python in a C++ application, which compiler did you use?

A sample that reproduce the problem would be most useful.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue5083] New resource ('gui') for regrtest

2009-01-28 Thread Guilherme Polo

Guilherme Polo  added the comment:

> Well, if the libraries for Ttk are not included then the tests should
> get skipped when the import fails.
>

Ah yes, good you said that because I wasn't doing it.

> A key reason to leaving something out of 'all' is if it takes a REALLY
> long time like the zipfile64 tests.

I will add a 'gui' resource on regrtest then.

___
Python tracker 

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



[issue5075] bdist_wininst should not depend on the vc runtime?

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

Martin v. Löwis  added the comment:

Looks fine to me, please apply.

As all the IO is done with Win32 directly, you might as well call
DeleteFile instead of remove (unless I miss something).

--
keywords:  -needs review
resolution:  -> accepted

___
Python tracker 

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



[issue5083] New resource ('gui') for regrtest

2009-01-28 Thread Guilherme Polo

Guilherme Polo  added the comment:

Added in r69063

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



[issue5076] bdist_wininst fails on py3k

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

Martin v. Löwis  added the comment:

This patch is fine, please apply.

I wish it wouldn't be necessary to widen char*, but start off with
wchar_t from the beginning. AFAICT, this would work fine for argv[1]
(there are only two arguments, anyway), but might get complicated for
argv[0].

--
keywords:  -needs review
resolution:  -> accepted

___
Python tracker 

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



[issue4707] round(25, 1) should return an integer, not a float

2009-01-28 Thread Mark Dickinson

Mark Dickinson  added the comment:

Committed in r69068 (py3k), r69069 (release30-maint).

The original bug with round(float, n) (loss of accuracy arising from 
intermediate floating-point rounding errors) is still present;  I think 
further discussion for that can go into issue 1869 (which should probably 
have its priority upgraded).

--
status: open -> closed

___
Python tracker 

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



[issue1869] Builtin round function is sometimes inaccurate for floats

2009-01-28 Thread Mark Dickinson

Mark Dickinson  added the comment:

See also issue 4707.

--
priority: low -> normal

___
Python tracker 

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



[issue2047] shutil.destinsrc returns wrong result when source path matches beginning of destination path

2009-01-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Adding a test as well would be nice.

--
nosy: +pitrou

___
Python tracker 

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



[issue5058] stop pgen.exe from generating CRLF-ended files and causing mayhem with win32-based patch submissions

2009-01-28 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc :


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



[issue4920] Inconsistent usage of next/__next__ in ABC collections; collections.Iterator is not compatible with Python 2.6 iterators.

2009-01-28 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Fixed in r69070 and r69071.

Thanks for the bug report and patch!

--
versions: +Python 2.7

___
Python tracker 

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



[issue4920] Inconsistent usage of next/__next__ in ABC collections; collections.Iterator is not compatible with Python 2.6 iterators.

2009-01-28 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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



[issue5092] weird memory usage in multiprocessing module

2009-01-28 Thread Jerzy

New submission from Jerzy :

Hi

I am using the multiprocessing mudule and I found a very weird thing.
It seems that that the result of one fragment of the code depends on the
fragment of the code that is after it, which should not happen. 

My script looks like this

import time
import multiprocessing
import sys

def f():
  sys.stderr.write(str(len(l))+"\n")
  print len(l)
  #del l
  while(True):
time.sleep(1)
l=[]
for i in range(2*1000*1000):
  l.append(str(i))
process = multiprocessing.Process(target=f)
process.start()

while(True):
  time.sleep(1)

And its output is as expected:
200
200
but when I uncoment the 'del l' line I get:

  File
"/home/jerzyo/programs/python2.6/Python-2.6.1/Lib/multiprocessing/process.py",
line 231, in _bootstrap
self.run()
  File
"/home/jerzyo/programs/python2.6/Python-2.6.1/Lib/multiprocessing/process.py",
line 88, in run
self._target(*self._args, **self._kwargs)
  File "bin/momory.py", line 6, in f
sys.stderr.write(str(len(l))+"\n")
UnboundLocalError: local variable 'l' referenced before assignment


How is that? The line that deletes l is after the printing line. How
python interpreter knows that l will be deleted. This is a very anomalus
behaviour and should never happen.

By the way. Is there any way to free some parts of memory in child
process. Suppose I wand to create 100 child processes that do not use
the l list. How can I avoid making 100 copies of l in child processes.

That is my firs post and won't come here very often, so please answer
also to my email (if it is not automaic). I am running python 2.6.1 on
ubuntu 8.04 32bit.

jerzy

--
messages: 80731
nosy: Orlowski
severity: normal
status: open
title: weird memory usage in multiprocessing module
type: resource usage
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



[issue4948] Make heapq work with all mutable sequences

2009-01-28 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

With no compelling use cases, it's not worth slowing down the module. 
Am sticking with the original design decision.

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



[issue5093] 2to3 with a pipe on non-ASCII script

2009-01-28 Thread STINNER Victor

New submission from STINNER Victor :

If Python output is redirected to a pipe, sys.stdout encoding is 
ASCII. So "2to3 script.py|cat" will write the patch in ASCII. If the 
script contains a non-ASCII character, 2to3 fails with:
  ...
  File ".../lib2to3/refactor.py", line 238, in refactor_file
self.processed_file(str(tree)[:-1], filename, write=write)
  File ".../lib2to3/refactor.py", line 342, in processed_file
self.print_output(diff_texts(old_text, new_text, filename))
  File ".../main.py", line 48, in print_output
print(line)
UnicodeEncodeError: 'ascii' codec can't encode character '\xfb' in 
position 11: ordinal not in range(128)

Should we consider the input file and stdout as binary files? 
Workaround: modify the files in place (-w option) but don't write the 
patch to stdout (no such option yet).

A project may contain scripts in ASCII, Latin-1 and UTF-8 (eg. Python 
source code ;-)).

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 80733
nosy: haypo
severity: normal
status: open
title: 2to3 with a pipe on non-ASCII script

___
Python tracker 

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



[issue5093] 2to3 with a pipe on non-ASCII script

2009-01-28 Thread STINNER Victor

STINNER Victor  added the comment:

Example of workaround: don't write the patch if the option -w is used. 
I don't need the patch if I choosed to modify the files in place.

--
keywords: +patch
Added file: http://bugs.python.org/file12887/2to3_write.patch

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2009-01-28 Thread Brett Cannon

New submission from Brett Cannon :

When you call datetime.datetime.utcnow() you get back a naive datetime
object. But why? You asked for UTC as the timezone based on what method
call you made. And UTC is a very concrete timezone that never changes.

It would be nice to have a concrete UTC tzinfo class that utcnow() uses
so that at least those datetime instances are non-naive.

If people have no issues with making this happen I will write the code
for the concrete UTC tzinfo instance and make the appropriate changes to
utcnow().

--
components: Extension Modules
messages: 80735
nosy: brett.cannon
severity: normal
status: open
title: datetime lacks concrete tzinfo impl. for UTC
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



[issue2263] struct.pack() + numpy int raises SystemError

2009-01-28 Thread engelbert gruber

engelbert gruber  added the comment:

on ubuntu 8.04, Python 2.7a0 (trunk:69044) and numpy 1.2.1
("." is OK, "e" means SystemError)

* signed always works, longlong also.
* unsigned native works half of the time
* unsigned little/big endian never works
* the numpy type does seam to have any effect.

signed char  b   'int16'   .  <.  >.  'uint32'   .  <.  >. 
sys:1: DeprecationWarning: struct integer overflow masking is deprecated
unsigned charB   'int16'   .  e  'uint32'   .  e 
signed short h   'int16'   .  <.  >.  'uint32'   .  <.  >. 
unsigned short   H   'int16'   .  e  'uint32'   .  e 
signed int   i   'int16'   .  <.  >.  'uint32'   .  <.  >. 
unsigned int I   'int16'   e  e  'uint32'   e  e 
signed long  l   'int16'   .  <.  >.  'uint32'   .  <.  >. 
unsigned longL   'int16'   e  e  'uint32'   e  e 
signed long long q   'int16'   .  <.  >.  'uint32'   .  <.  >. 
unsigned long long   Q   'int16'   .  <.  >.  'uint32'   .  <.  >.

--
nosy: +grubert
versions: +Python 2.7
Added file: http://bugs.python.org/file12888/issue2263-numpy.py

___
Python tracker 

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



[issue2159] dbmmodule inquiry function is performance prohibitive

2009-01-28 Thread johansen

johansen  added the comment:

I haven't been able to find any of the patches listed in the comments,
but it does look like providing a nb_nonzero method in the module would
solve our issue.  PyObject_IsTrue checks the tp_as_number methods before
the sequence and mapping methods.  I'm not sure if it's safe to count on
this behavior as always being true, but for 2.4 and the dbmmodule, it
would work.

___
Python tracker 

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



[issue5092] weird memory usage in multiprocessing module

2009-01-28 Thread David W. Lambert

David W. Lambert  added the comment:

The del statement makes the variable local, as alluded to by

http://docs.python.org/dev/3.0/reference/simple_stmts.html#the-del-
statement

The manual is clearer about assignments, which are local unless declared 
global or nonlocal.


For other question, me thinks you need to write slightly cleverer code 
that passes only required data.  I have experience with 
multiprocessing.Pool().map which lets me control the arguments I pass to 
functions.

--
nosy: +LambertDW

___
Python tracker 

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



[issue5092] weird memory usage in multiprocessing module

2009-01-28 Thread David W. Lambert

David W. Lambert  added the comment:

My second answer is irrelevant.  Function receives the global data as 
well as the arguments.

___
Python tracker 

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



[issue2159] dbmmodule inquiry function is performance prohibitive

2009-01-28 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2009-01-28 Thread Daniel Diniz

Daniel Diniz  added the comment:

Brett,
It might be worth to update tzinfo-examples.py to use your concrete UTC
then: 

http://svn.python.org/view/python/trunk/Doc/includes/tzinfo-examples.py?rev=62214&view=markup

--
nosy: +ajaksu2

___
Python tracker 

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



[issue5092] weird memory usage in multiprocessing module

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

Martin v. Löwis  added the comment:

As David says, this is not a bug. del l indicates that there is a local
variable to be deleled, but when the del statement is executed, there is
no local variable. The error message is confusing in this case: there
actually is no later assignment to l (in the function at all).
Typically, when you have an unbound local, it is because of a later
assignment, such as

def foo():
  a = l + 1
  l = 2

In this specific example, there is no later assignment - yet it is still
an unbound local.

So that you get the exception is not a bug.

I was going to suggest that the error message could be better, but I
can't think of any other error message that is better and still correct,
hence closing it as won't fix.

--
nosy: +loewis
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue4676] python3 closes + home keys

2009-01-28 Thread Guilherme Polo

Guilherme Polo  added the comment:

> Weeble added the comment:
>
> In summary, Tk 8.5 changed the name of the "anchor" mark to be unique to
> each Text widget. The code to make the home key toggle between column 0
> and the start of the text tries to make use of the "anchor" mark and
> gets confused.
>
> In the email I proposed a simple fix which I'm testing out right now.
> Should I attach it as a patch?
>

I see your simple fix depends on a unsupported proc provided by tk,
how good is to depend on it ?
And I don't think that is backwards compatible till tk 8.2, is it ?

___
Python tracker 

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



[issue5095] msi missing from "bdist --help-formats"

2009-01-28 Thread Steven Bethard

New submission from Steven Bethard :

The bdist_msi command is documented in the distutils reference:

http://docs.python.org/distutils/apiref.html#module-distutils.command.bdist_msi

But it does not show up with "bdist --help-formats"

$ python setup.py bdist --help-formats
List of available distribution formats:
  --formats=rpm  RPM distribution
  --formats=gztargzip'ed tar file
  --formats=bztarbzip2'ed tar file
  --formats=ztar compressed tar file
  --formats=tar  tar file
  --formats=wininst  Windows executable installer
  --formats=zip  ZIP file

This probably exists in 3.0 too, but I haven't checked.

--
components: Distutils
messages: 80743
nosy: bethard
severity: normal
stage: needs patch
status: open
title: msi missing from "bdist --help-formats"
versions: Python 2.5, Python 2.6, 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



[issue5095] msi missing from "bdist --help-formats"

2009-01-28 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
assignee:  -> tarek
nosy: +tarek

___
Python tracker 

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



[issue5090] import tkinter library Visual C++ Concepts:C Run-Time Error R6034 when embeded python in c++

2009-01-28 Thread wang

wang  added the comment:

my compile is gcc 4.2.1
system is windows xp

some other library can be import.
such as:sys os

c++ code line:
Py_Initialize();
Py_SetProgramName(L"MyProgram");
module=PyImport_ImportModule("__main__");
moduledict=PyModule_GetDict(dodule);
PySys_SetArgv(1,wxargv);
PyRun_StringFlags("\
import tkinter\n\
",Py_file_input,moduledict,moduledict,NULL);
Py_finalize();

the urllib.request also can not import.

--
type:  -> crash

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2009-01-28 Thread Brett Cannon

Brett Cannon  added the comment:

On Wed, Jan 28, 2009 at 18:17, Daniel Diniz  wrote:
>
> Daniel Diniz  added the comment:
>
> Brett,
> It might be worth to update tzinfo-examples.py to use your concrete UTC
> then:

I will if people are generally okay with the idea of adding this class.

___
Python tracker 

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



[issue5090] import tkinter library Visual C++ Concepts:C Run-Time Error R6034 when embeded python in c++

2009-01-28 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

os and sys are builtin modules. See if you can import any other pure 
Python module.
Also, see #4566

--
nosy: +gagenellina

___
Python tracker 

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



[issue5090] import tkinter library Visual C++ Concepts:C Run-Time Error R6034 when embeded python in c++

2009-01-28 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

(In case the fix in #4566 works for you, please let us know)

___
Python tracker 

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



[issue2578] Figure out what to do with unittest's redundant APIs

2009-01-28 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

FYI - As a side note to this issue of removing the clutter of alternate
names - I intend to gather up the worthy non-clutter additional unittest
assertFoo APIs that we have at Google to contribute towards 3.1/2.7, my
goal is to do this before PyCon this year.

This thread from last spring summarizes the types of things I'd like
include already.

 http://mail.python.org/pipermail/python-dev/2008-April/078716.html

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue2578] Figure out what to do with unittest's redundant APIs

2009-01-28 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
assignee: purcell -> gregory.p.smith

___
Python tracker 

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



[issue2578] Figure out what to do with unittest's redundant APIs

2009-01-28 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
priority:  -> normal
versions: +Python 2.7, Python 3.1 -Python 3.0

___
Python tracker 

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