[issue5092] weird memory usage in multiprocessing module

2009-01-30 Thread Jerzy

Jerzy  added the comment:

OK, I see and if don't want l to exist in f() I have to:

def f():
   pass

def a():
   l=[]
   f()

a()



Jurek

Martin v. Löwis wrote:
> Martin v. Löwis  added the comment:
> 
>> I still do not understand what is going on when python executed thic 
>> code. I have a local variable l in my parent process. 
> 
> No, you don't. It's a global variable, not a local one.
> 
>> When I create a 
>> child process, program makes first makes a copy of memory. Than what?
> 
> It doesn't have to do anything with the multiprocessing at all.
> For comparison, just run the Python script
> 
> def f():
>   del l
> l = []
> f()
> 
> It produces the same error, with no multiprocessing involved.
> 
> ___
> Python tracker 
> 
> ___
> 
> 
>

___
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-30 Thread Jerzy

Jerzy  added the comment:

And anyway, for me it's not OK if something in a code of a function like 
'del' affect how variables are affected in whole function.

It is really illogical. There code is in lines and line are one below 
another. The logical way is that a line of code affects the program ONLY 
when it is executed and ONLY from the time it is executed. A statement 
that is not executed (python never reach the place) should not affect 
the program in ANY way.

You may think what you think, but for me it is a big bug in the heart of 
python

Jerzy

Martin v. Löwis wrote:
> Martin v. Löwis  added the comment:
> 
>> I still do not understand what is going on when python executed thic 
>> code. I have a local variable l in my parent process. 
> 
> No, you don't. It's a global variable, not a local one.
> 
>> When I create a 
>> child process, program makes first makes a copy of memory. Than what?
> 
> It doesn't have to do anything with the multiprocessing at all.
> For comparison, just run the Python script
> 
> def f():
>   del l
> l = []
> f()
> 
> It produces the same error, with no multiprocessing involved.
> 
> ___
> Python tracker 
> 
> ___
> 
> 
>

___
Python tracker 

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



[issue5108] Invalid UTF-8 ("%s") length in PyUnicode_FromFormatV()

2009-01-30 Thread STINNER Victor

New submission from STINNER Victor :

PyUnicode_FromFormatV() doesn't count correctly the unicode length of 
an UTF-8 string. Commit r57837 "Change %s argument for 
PyUnicode_FromFormat to be UTF-8. Fixes #1070." introduced the bug. To 
compute the length, it uses a a complex code to compute the length of 
the UTF-8 string, whereas PyUnicode_DecodeUTF8(p, 
strlen(p), "replace") + Py_UNICODE_COPY() is used to copy the string. 
The problem may comes from the error handling ("replace").

Valgrind show that the error occurs at Py_UNICODE_COPY(): Invalid 
write of size 1. Since it's only one byte, Python does not always 
crash.

To reproduce the crash, use PyUnicode_FromFormatV() or function using 
it: PyUnicode_FromFormat(), PyErr_Format(), ...

Example 1:

import grp

x=["\uDBE7\u8C99", 
"\u9C31\uF8DC\u3EC5\u1804\u629D\uE748\u68C8\uCF74\u9E63\uF647\uBF7A\uED63"]
x=str(x)
grp.getgrnam(x)

Example 2:

import unicodedata
x 
= "\\udbe7\u8c99', 
'\u9c31\\uf8dc\u3ec5\u1804\u629d\\ue748\u68c8\ucf74\u9e63\\uf647\ubf7a\\ued63"
unicodedata.lookup(x)

I wrote a patch reusing PyUnicode_DecodeUTF8(p, strlen(p), "replace") 
+ PyUnicode_GET_SIZE() to get the real length of the converted UTF-8 
string.

A better patch should reuse code used to convert UTF-8 to Unicode with 
the "replace" error handling.

--
components: Unicode
messages: 80814
nosy: haypo
severity: normal
status: open
title: Invalid UTF-8 ("%s") length in PyUnicode_FromFormatV()
versions: Python 3.0, Python 3.1

___
Python tracker 

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



[issue5108] Invalid UTF-8 ("%s") length in PyUnicode_FromFormatV()

2009-01-30 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +patch
Added file: http://bugs.python.org/file12892/unicode_format.patch

___
Python tracker 

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



[issue5109] array.array constructor very slow when passed an array object.

2009-01-30 Thread Malcolm Purvis

New submission from Malcolm Purvis :

Copying an array.array object via the array constructor is some 100x
slower than using slicing or even converting the array to a string and
then passing that string to the array constructor.

Running the attached program on a 2.2GHz MacBook Pro (OSX 10.5.5, 4GB
RAM) produces this output:

$ python2.6 array_test.py
Constructor:  18.5617749691
Slice:  0.169251918793
String:  0.375015974045

>From a look at arraymodule.c it seems that array_new() does not have a
special case for the array type and therefore uses the generic sequence
copy code rather than using memcpy(), like it can for slicing.

--
components: Library (Lib)
files: array_test.py
messages: 80815
nosy: malcolmp
severity: normal
status: open
title: array.array constructor very slow when passed an array object.
type: performance
versions: Python 2.6
Added file: http://bugs.python.org/file12893/array_test.py

___
Python tracker 

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



[issue4908] adding a get_metadata in distutils

2009-01-30 Thread Floris Bruynooghe

Changes by Floris Bruynooghe :


--
nosy: +flub

___
Python tracker 

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



[issue3610] Fix gdbinit for Python 3.0

2009-01-30 Thread Skip Montanaro

Skip Montanaro  added the comment:

The gdbinit file for Python 3 is still broken.  I've not been able to
figure out how to get a string encoded as utf-8 from a Unicode object
without needing a process around.  If you require a process then
gdbinit becomes much less useful since it won't work with core files.

--
nosy: +skip.montanaro

___
Python tracker 

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



[issue3783] dbm.sqlite proof of concept

2009-01-30 Thread Skip Montanaro

Skip Montanaro  added the comment:

Unassigning myself.  I don't have time for this.  I've taken my sandbox
version about as far as I can, and the subject of this ticket has
gone a bit far afield from just adding a sqlite module to the dbm pkg.

--
assignee: skip.montanaro -> 

___
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-30 Thread David W. Lambert

David W. Lambert  added the comment:

The alternative is unreasonable.  I doubt you'd be happy with this:


a = 'Something'

def variable_both_global_and_local()->Exception('No good!'):
del a# delete a from global name space
a = 'anotherthing'  # define a in local name space

___
Python tracker 

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



[issue5107] built-in open(..., encoding=vague_default)

2009-01-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

It is more complicated than that. The algorithm is currently as follows
(copied from TextIOWrapper.__init__):

if encoding is None:
try:
encoding = os.device_encoding(buffer.fileno())
except (AttributeError, UnsupportedOperation):
pass
if encoding is None:
try:
import locale
except ImportError:
# Importing locale may fail if Python is being built
encoding = "ascii"
else:
encoding = locale.getpreferredencoding()

--
nosy: +pitrou

___
Python tracker 

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread Ezio Melotti

New submission from Ezio Melotti :

In Py2.x
>>> u'\2620'
outputs u'\2620' whereas
>>> print u'\2620'
raises an error.

Instead, in Py3.x, both
>>> '\u2620'
and
>>> print('\u2620')
raise an error if the terminal doesn't use an encoding able to display
the character (e.g. the windows terminal used for these examples).

This is caused by the new string representation defined in the PEP3138[1].

Consider also the following example:
Py2:
>>> [u'\u2620']
[u'\u2620']
Py3:
>>> ['\u2620']
UnicodeEncodeError: 'charmap' codec can't encode character '\u2620' in
position 9: character maps to 

This means that there is no way to print lists (or other objects) that
contain characters that can't be encoded.
Two workarounds may be:
1) encode all the elements of the list, but it's not practical;
2) use ascii(), but it adds extra "" around the output and escape
backslashes and apostrophes (and it won't be possible to use _[0] in the
next line).
 
Also note that in Py3
>>> ['\ud800']
['\ud800']
>>> _[0]
'\ud800'
works, because U+D800 belongs to the category "Cs (Other, Surrogate)"
and it is escaped[2].

The best solution is probably to change the default error-handler of the
Python3 interactive interpreter to 'backslashreplace' in order to avoid
this behavior, but I don't know if it's possible only for ">>> foo" and
not for ">>> print(foo)" (print() should still raise an error as it does
in Py2).

This proposal has already been refused in the PEP3138[3] but there are
no links to the discussion that led to this decision.

I think this should be rediscussed and possibly changed, because, even
if can't see the "listOfJapaneseStrings"[4], I still prefer to see a
sequence of escaped chars than a UnicodeEncodeError.

[1]: http://www.python.org/dev/peps/pep-3138/
[2]: http://www.python.org/dev/peps/pep-3138/#specification
[3]: http://www.python.org/dev/peps/pep-3138/#rejected-proposals
[4]: http://www.python.org/dev/peps/pep-3138/#motivation

--
components: Unicode
messages: 80820
nosy: ezio.melotti
severity: normal
status: open
title: Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)
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



[issue5109] array.array constructor very slow when passed an array object.

2009-01-30 Thread David W. Lambert

David W. Lambert  added the comment:

memcpy won't work if the data type changes.  (possibly signed <-> 
unsigned same-byte-count works).

--
nosy: +LambertDW

___
Python tracker 

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread STINNER Victor

STINNER Victor  added the comment:

To be clear, this issue only affects the interpreter.

> 2) use ascii(), but it adds extra "" around the output

It doesn't ass extra "" if you replace repr() by ascii() in the 
interpreter code (sys.displayhook)?

> The best solution is probably to change the default error-handler 
> of the Python3 interactive interpreter to 'backslashreplace' 
> in order to avoid this behavior, (...)

Hum, it implies that sys.stdout has a different behaviour in the 
interpreter and when running a script. We can expect many bugs ports 
from newbies "the example works in the terminal/IDLE, but not in my 
script, HELP!". So I prefer ascii().

--
nosy: +haypo

___
Python tracker 

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread STINNER Victor

STINNER Victor  added the comment:

You change change the display hook with a site.py script (which have 
to be in sys.path) :
-
import sys

def hook(message):
print(ascii(message))

sys.displayhook = hook
-

Example (run python in an empty environment to get ASCII charset):
-
$ env -i PYTHONPATH=$PWD ./python
Python 3.1a0 (py3k:69105M, Jan 30 2009, 10:36:27)
>>> import sys
>>> sys.stdout.encoding
'ANSI_X3.4-1968'
>>> "\xe9"
'\xe9'
>>> print("\xe9")
Traceback (most recent call last):
  (...)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' (...)
-

___
Python tracker 

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread Ezio Melotti

Ezio Melotti  added the comment:

This seems to solve the problem, but apparently the interactive "_"
doesn't work anymore.

___
Python tracker 

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread STINNER Victor

STINNER Victor  added the comment:

Oh yeah, original sys.displayhook uses a special hack for the _ global 
variable:
-
import sys
import builtins

def hook(message):
if message is None:
return
builtins._ = message
print(ascii(message))

sys.displayhook = hook
-

___
Python tracker 

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread STINNER Victor

STINNER Victor  added the comment:

Here is a patch to use ascii() directly in sys_displayhook() (with an 
unit test!).

--
keywords: +patch
Added file: http://bugs.python.org/file12894/display_hook_ascii.patch

___
Python tracker 

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



[issue3783] dbm.sqlite proof of concept

2009-01-30 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue5111] httplib: wrong Host header when connecting to IPv6 loopback

2009-01-30 Thread Guillaume Desmottes

New submission from Guillaume Desmottes :

To reproduce:
- Launch a HTTP server listening on an Inet6 socket on, say, port 
- Try to connect using the IPv6 loopback: 
http = httplib.HTTPConnection('[::1]:')
http.request('GET', '/foo')
r = http.getresponse()
print r.status
- You get 400 (bad-request) instead of 404

It seems that's because the HTTP request is wrong. Python sends this header:
Host: ::1:
but it should be:
Host: [::1]:

I'm using python 2.5.2-1ubuntu1 on Intrepid.

--
components: Library (Lib)
messages: 80827
nosy: gdesmott
severity: normal
status: open
title: httplib: wrong Host header when connecting to IPv6 loopback
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



[issue4753] Faster opcode dispatch on gcc

2009-01-30 Thread Kevin Watters

Kevin Watters  added the comment:

Does anyone know the equivalent ICC command line option for GCC's -fno-
gcse? (Or if it has one?) I can't find a related option in the docs.

It looks like ICC hits the same combining goto problem, as was 
mentioned: without changing any options, I applied pitrou_dispatch_2.7.patch to 
release-26maint and pybench reported 
literally no difference, +0.0%.

Even if stock Python is built with MSVC, devs like myself who ship 
Python would like to see the benefit.

___
Python tracker 

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



[issue5111] httplib: wrong Host header when connecting to IPv6 litteral URL

2009-01-30 Thread Guillaume Desmottes

Guillaume Desmottes  added the comment:

Actually, this bug is present when you try to connect to any URL
containing an IP6 and a port.

So, we have the same problem when using, for example:
http = httplib.HTTPConnection('[2a01:8790:16d:0:218:de87:164:8745]:')

but
http = httplib.HTTPConnection('[2001:4860:0:1001::68]:80')

does work. Probably because we use the default HTTP port.

--
title: httplib: wrong Host header when connecting to IPv6 loopback -> httplib: 
wrong Host header when connecting to IPv6 litteral URL

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

Mark Dickinson  added the comment:

Here's stage 2:  remove uses of tp_compare from Objects and Modules, and
replace uses of PyObject_Compare with PyObject_RichCompareBool.
PyObject_Compare, cmp and friends still haven't been removed at this
stage.

In detail:
  - for cell objects, method wrapper objects, PyTclObjects, and
PyST_Objects (in the parser module), remove the defined tp_compare
methods and implement tp_richcompare instead.
  - add tests for cell comparisons and PyST_Object comparisons;  
reenable
tests for method wrapper comparisons.  There are no tests for the
PyTclObject comparisons.
  - remove tp_compare method from sets (all it did was emit an error
message about the nonsensicality of doing order comparisons on sets)
  - in Objects/rangeobject.c and ElementTree, replace uses of
PyObject_Compare with PyObject_RichCompareBool

Added file: http://bugs.python.org/file12895/1717_stage2.patch

___
Python tracker 

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



[issue3783] dbm.sqlite proof of concept

2009-01-30 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file12896/dbsqlite.py

___
Python tracker 

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



[issue5112] Incorrect documentation for PyErr_BadInternalCall

2009-01-30 Thread Michael Welsh Duggan

New submission from Michael Welsh Duggan :

Documentation says that this call is shorthand for
PyErr_SetString(PyExc_TypeError, message), but is instead shorthand for
PyErr_SetString(PyExc_SystemError, message).

--
assignee: georg.brandl
components: Documentation
messages: 80831
nosy: georg.brandl, md5i
severity: normal
status: open
title: Incorrect documentation for PyErr_BadInternalCall
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0

___
Python tracker 

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

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

Mark Dickinson  added the comment:

The x86 gentoo buildbot is failing to compile, with error:

/Python/makeopcodetargets.py ./Python/opcode_targets.h
  File "./Python/makeopcodetargets.py", line 28
f.write(",\n".join("\t&&%s" % s for s in targets))
  ^
SyntaxError: invalid syntax
make: *** [Python/opcode_targets.h] Error 1

I suspect that it's because the system Python on this buildbot is Python 
2.3, which doesn't understand generator expressions.  Are there any 
objections to me adding a couple of square brackets to this line to turn 
the argument of join into a list comprehension?

--
nosy: +marketdickinson

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

Mark Dickinson  added the comment:

One other thought:  it seems that as a result of this change, the py3k 
build process now depends on having some version of Python already 
installed;  before this, it didn't.  Is this true, or am I misinterpreting 
something?

Might it be worth adding the file Python/opcode_targets.h to the 
distribution to avoid this problem?

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

Mark Dickinson  added the comment:

Sorry:  ignore that last.  Python/opcode_targets.h is already part of the 
distribution.  I don't know what I was doing wrong.

___
Python tracker 

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



[issue5113] 2.5.4.3 / test_posix failing on HPUX systems

2009-01-30 Thread Andreas Kupries

New submission from Andreas Kupries :

The 'test_posix' of Python's 2.5.4.3 testsuite fails on HPUX. This has
happened on parisc and ia64 systems. On the parisc system failure occurs
for both parisc1.1 and parisc2.0w builds. The HPUX versions are 11.00
(parisc) and 11.22 (ia64).

The attached file contains the output of executing

./apy/bin/python2.5 ./apy/lib/python2.5/test/regrtest.py -v test_posix

--
components: Tests
files: bug-test_posix-hpux.log
messages: 80835
nosy: andreask
severity: normal
status: open
title: 2.5.4.3 / test_posix failing on HPUX systems
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file12897/bug-test_posix-hpux.log

___
Python tracker 

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



[issue5114] 2.5.4.3 / test_threading hangs

2009-01-30 Thread Andreas Kupries

New submission from Andreas Kupries :

On two machines I have seen test_threading hang in ...
HPUX 11.22 ia64,
Solaris 5.8 sparc

The attached file contains the output of running

./apy/bin/python2.5 ./apy/lib/python2.5/test/regrtest.py -v test_threading

on the problematic machines.

It is necessary to kill one of the subprocesses to force forward
progress. A partial output of 'ps -ef' on the HPUX machine is

andreask 26601 26552  0 12:13:50 pts/1 0:00 ./apy/bin/python2.5
./apy/lib/python2.5/test/regrtest.py -v tes
andreask 26657 26601  0 12:14:26 pts/1 0:00
/home/andreask/tmp/autotest/apy/bin/python2.5 -c if 1:^J
andreask 26658 26657  0 12:14:26 pts/1 0:00
/home/andreask/tmp/autotest/apy/bin/python2.5 -c if 1:^J

And I usually kill the bottom most process.

--
components: Tests
files: bug-test_threading-hpux-solaris.log
messages: 80836
nosy: andreask
severity: normal
status: open
title: 2.5.4.3 / test_threading hangs
versions: Python 2.5
Added file: http://bugs.python.org/file12898/bug-test_threading-hpux-solaris.log

___
Python tracker 

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



[issue4375] inspect.getsource doesn't work with PYTHONPATH and source compiled from a different dir

2009-01-30 Thread Erick Tryzelaar

Erick Tryzelaar  added the comment:

I just checked, and the latest svn version of python has fixed this. Could 
someone close this bug for me?

___
Python tracker 

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



[issue4673] Distutils should provide an uninstall command

2009-01-30 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue1205239] Let shift operators take any integer value

2009-01-30 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +marketdickinson

___
Python tracker 

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



[issue5107] built-in open(..., encoding=vague_default)

2009-01-30 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue5103] ssl.SSLSocket timeout not working correctly when remote end is hanging

2009-01-30 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
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-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Mark:

"""Are there any objections to me adding a couple of square brackets to
this line to turn the argument of join into a list comprehension?"""

No problems for me. You might also add to the top comments of the file
that it is 2.3-compatible.

___
Python tracker 

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



[issue4124] Patch for adding "default" to itemgetter and attrgetter

2009-01-30 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Will take a look at it next week.

--
assignee:  -> rhettinger
nosy: +rhettinger
type:  -> feature request

___
Python tracker 

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



[issue4124] Patch for adding "default" to itemgetter and attrgetter

2009-01-30 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Am curious about your use cases.  ISTM that in every case I've every
used either function, I've always known that the attribute or item is
going to be there.  For instance, the original motivating use cases were
to support the key= argument to
min/max/sorted/nlargest/nsmallest/groupby and to support iterator
algebra with itertools:

def powerset(iterable):
'''Iterate over all subsets.

>>> list(powerset('abc'))
[set([]), set(['a']), set(['b']), set(['a', 'b'])]

'''
# Only 1 initial call to PyObject_Hash().  
# No trips around the eval-loop.
# Memory friendly.
seq = map(set, list(iterable)[::-1])
selector_stream = product([False, True], repeat=len(seq))
newsets, ns1 = tee(starmap(set, repeat((
components = imap(compress, repeat(seq), selector_stream)
sets_and_components = imap(chain, izip(newsets), components)
results = starmap(set.update, sets_and_components)
return imap(itemgetter(0), izip(ns1, results))

___
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-30 Thread Jerzy

Jerzy  added the comment:

I am not an expert. But for me it is much better.
If you cannot delete the global variable in a function (del makes the 
variable local anyway). So trying to delete a global variable should 
raise an exception "Cannot delete a global variable" or something like 
that. In a function variable should be global till the place when you 
define a local one.

Example:

a='Something'

def f():
  print a   #prints the global variable a
  del a #Make an exception that a is global so it cannot be deleted
  a='anotherthing' #make a local a
  print a  #print local a
  del a#delete local a
  print a  #print global a

f()

Also, if there are two variable (global and local) with seme name, there 
should be a way to access either of them like 'print loc(a)' and 'print 
glob(a)'. This is just a suggestion

Another way of resolving the problem would be making it impossible to 
make a local variable when there is anothe one with the same name.

David W. Lambert pisze:
> David W. Lambert  added the comment:
> 
> The alternative is unreasonable.  I doubt you'd be happy with this:
> 
> 
> a = 'Something'
> 
> def variable_both_global_and_local()->Exception('No good!'):
> del a# delete a from global name space
> a = 'anotherthing'  # define a in local name space
> 
> ___
> Python tracker 
> 
> ___
> 
> 
>

___
Python tracker 

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



[issue5097] asyncore.dispatcher_with_send undocumented

2009-01-30 Thread Josiah Carlson

Josiah Carlson  added the comment:

Feel like writing some documentation?

___
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-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I haven't stared very closely but it looks ok.
("spanish armada" might be replaced with "spanish inquisition", though)

___
Python tracker 

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



[issue4704] Update pybench for python 3.0

2009-01-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Since cmp is slated for removal, this should also be done for 3.0.1.

--
nosy: +pitrou
priority:  -> release blocker

___
Python tracker 

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

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

Martin v. Löwis  added the comment:

Victor, I'm not sure whether you are proposing that
display_hook_ascii.patch is included into Python. IIUC, this patch
breaks PEP3138, so it clearly must be rejected.

Overall, I fail to see the bug in this report. Python 3.0 works as
designed as shown here.

--
nosy: +loewis

___
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-30 Thread Martin v. Löwis

Martin v. Löwis  added the comment:

> Another way of resolving the problem would be making it impossible to 
> make a local variable when there is anothe one with the same name.

Please trust that there really is no problem. If you don't understand
how Python works, ask on a mailing list. If you want to propose a change
to Python, contact python-ideas. Don't be surprised when everybody tells
you that things are fine the way they are.

___
Python tracker 

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



[issue5105] sqlite3.Row class, handling duplicate column names resulting from a SQL join

2009-01-30 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

I think this is a sqlite issue, not a Python one.
cursor.description should return unique column names.

--
nosy: +gagenellina

___
Python tracker 

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



[issue5103] ssl.SSLSocket timeout not working correctly when remote end is hanging

2009-01-30 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
assignee:  -> janssen
nosy: +janssen

___
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-30 Thread David W. Lambert

David W. Lambert  added the comment:

#Ah!  Not a problem.  You need globals() and locals() dictionaries.
# as a python3 script, this message produces next couple lines output.

#method one
#yup, global a is gone
#method two
#{'gv': 'local here', 'name': 'gv'}
#yup, global gv is gone

print('method one')

a = ''

def Delete_a_global_variable():
global a
del a

Delete_a_global_variable()

try:
a
print('whoops!  this can never happen')
except NameError:
print('yup, global a is gone')

print('method two')

gv = '' # global variable

def delete_chosen_variable(name):
del globals()[name]
gv = 'local here'
print(locals())

delete_chosen_variable('gv')

try:
gv
print('whoops!  this can never happen')
except NameError:
print('yup, global gv is gone')

___
Python tracker 

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



[issue5105] sqlite3.Row class, handling duplicate column names resulting from a SQL join

2009-01-30 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

See http://www.sqlite.org/cvstrac/tktview?tn=3221

Try upgrading to the latest sqlite release. Or set "pragma 
full_column_names=ON;"

import sqlite3
conn = sqlite3.connect(':memory:')
cursor = conn.cursor()
cursor.execute("create table T (a, b, c)")
cursor.execute("insert into T values (1, 2, 3)")
cursor.execute("insert into T values (2, 3, 4)")
conn.commit()
cursor.execute("pragma short_column_names=OFF;")
cursor.execute("pragma full_column_names=ON;")
cursor.execute("select * from T T1, T T2 where T1.a=T2.b")
print [d[0] for d in cursor.description]
# output: ['T1.a', 'T1.b', 'T1.c', 'T2.a', 'T2.b', 'T2.c']

___
Python tracker 

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



[issue5115] Extend subprocess.kill to be able to kill process groups

2009-01-30 Thread Erick Tryzelaar

New submission from Erick Tryzelaar :

It would be really handy to add a way to portably kill process groups of 
a process spawned with subprocess.Popen. My project starts a process, 
which then starts other long running processes. Because of this process 
tree, there's no way for me to portably kill all of those processes. 
Would it be possible to extend subprocess with these features? I did 
find someone who's already implemented this [1], and it's working well 
in my project. There was some discussion about adding this, but it seems 
no one actually committed a patch to implement it.

Anyway, I've attached a patch against python3.0's svn branch that 
implements this. I don't have access to windows, so I'm not able to make 
sure that the TerminateJobObject is correct, and works.

[1]: http://benjamin.smedbergs.us/blog/2006-12-11/killableprocesspy/
[2]: http://mail.python.org/pipermail/python-list/2008-April/487588.html

--
components: Library (Lib)
files: killpg.patch
keywords: patch
messages: 80850
nosy: erickt
severity: normal
status: open
title: Extend subprocess.kill to be able to kill process groups
type: feature request
versions: Python 3.0
Added file: http://bugs.python.org/file12899/killpg.patch

___
Python tracker 

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



[issue5036] xml.parsers.expat make a dictionary which keys are broken if buffer_text is False.

2009-01-30 Thread Takeshi Matsuyama

Takeshi Matsuyama  added the comment:

Could someone close this?

___
Python tracker 

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



[issue5036] xml.parsers.expat make a dictionary which keys are broken if buffer_text is False.

2009-01-30 Thread Benjamin Peterson

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread Ezio Melotti

Ezio Melotti  added the comment:

This seems to fix the problem:
--
import sys
import builtins

def hook(message):
if message is None:
return
builtins._ = message
try:
print(repr(message))
except UnicodeEncodeError:
print(ascii(message))

sys.displayhook = hook
--
Just to clarify:
* The current Py3 behavior works fine in UTF8 terminals
* It doesn't work on non-UTF8 terminals if they can't encode the chars
(they raise an error)
* It only affects the interactive interpreter
* This new patch escapes the chars instead of raise an error only on
non-UTF8 terminal and only when printed as ">>> foo" (without print())
and leaves the other behaviors unchanged
* This is related to Py3 only

Apparently the patch provided by Victor always escapes the non-ascii
chars. This new hook function prints the Unicode chars if possible and
escapes them if not. On a UTF8 terminal the behavior is unchanged, on a
non-UTF8 terminal all the chars that can not be encoded will now be escaped.

This only changes the behavior of ">>> foo", so it can not lead to
confusion ("It works in the interpreter but not in the script"). In a
script one can't write "foo" alone but "print(foo)" and the behavior of
"print(foo)" is the same in both the interpreter and the scripts (with
the patch applied):

>>> ['\u2620']
['\u2620']
>>> print(['\u2620'])
UnicodeEncodeError: 'charmap' codec can't encode character '\u2620' in
position 2: character maps to 

I think that the PEP3138 didn't consider this issue. Its purpose is to
have a better output (Unicode chars instead of escaped chars), but it
only works with UTF8 terminals, on non-UTF8 terminals the output is
worse (UnicodeEncodeError instead of escaped chars).

This is an improvement and I can't see any negative side-effect.

Attached there's a txt with more example, on Py2 and Py3, on
Windows(non-UTF8 terminal) and Linux (UTF8 terminal), with and without
my patch.

Added file: http://bugs.python.org/file12900/issue5110.txt

___
Python tracker 

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



[issue5105] sqlite3.Row class, handling duplicate column names resulting from a SQL join

2009-01-30 Thread Brandon Adams

Brandon Adams  added the comment:

Ah, that's it.  Thanks for the tip, this issue can be closed now.

___
Python tracker 

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



[issue5106] Update Naming & Binding statement for 3.0

2009-01-30 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r69132.

--
nosy: +benjamin.peterson
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



[issue5099] subprocess.POpen.__del__() AttributeError (os module == None!)

2009-01-30 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

At interpreter shutdown, the module's global variables are set to None 
before the module itself is released. __del__ methods may be called in 
those precaries circumstances, and should not rely on any global state.

A temporary fix would be to make Popen._internal_poll and 
Popen._handle_exitstatus keep a reference to the os module (just add a 
default argument os=os, like sys=sys in __del__). But this is just a 
hack; the real fix would be to avoid defining __del__ at all.

A patch for subprocess.py is attached.

--
components: +Library (Lib)
keywords: +patch
nosy: +gagenellina
Added file: http://bugs.python.org/file12901/subprocess.diff

___
Python tracker 

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



[issue5099] subprocess.POpen.__del__() AttributeError (os module == None!)

2009-01-30 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

Patch and test case against trunk

--
versions: +Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file12902/test_subprocess.diff

___
Python tracker 

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



[issue5102] urllib2.py timeouts do not propagate across redirects for 2.6.1 (and 3.x?)

2009-01-30 Thread Gabriel Genellina

Changes by Gabriel Genellina :


--
nosy: +gagenellina

___
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-30 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

Seems perfectly reasonable to me.

--
nosy: +gagenellina

___
Python tracker 

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



[issue5116] expose _CrtSetReportMode via the msvcrt module

2009-01-30 Thread Mark Hammond

New submission from Mark Hammond :

In bug 4804, there is some debate about how desirable it is for Python
to unconditionally disable all CRT assertions on Windows - however,
there is agreement that exposing the ability to enable and disable these
assertions via the msvcrt module is reasonable - so I'm attaching a
patch for exactly that.  I'd also like to nominate this for the 2.6 and
py3k branches.

--
assignee: mhammond
files: msvcrt_crtsetreportmode.patch
keywords: needs review, patch, patch
messages: 80858
nosy: mhammond
priority: normal
severity: normal
status: open
title: expose _CrtSetReportMode via the msvcrt module
type: feature request
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file12903/msvcrt_crtsetreportmode.patch

___
Python tracker 

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



[issue5116] expose _CrtSetReportMode via the msvcrt module

2009-01-30 Thread Mark Hammond

Changes by Mark Hammond :


--
components: +Windows

___
Python tracker 

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



[issue4804] Python on Windows disables all C runtime library assertions

2009-01-30 Thread Mark Hammond

Mark Hammond  added the comment:

I created bug 5116 with a patch to expose CrtSetDebugMode via the msvcrt
module.  I didn't attach it to this patch as it doesn't address the
fundamental point in this bug, just offers a workaround to reinstate the
default if desired.  If there *was* agreement to change Python so only
the test suite disabled the CRT reports, then such a change could
probably now be implemented in .py code using the patch in bug 5116.

___
Python tracker 

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



[issue5117] os.path.relpath problem with root drive directory on windows

2009-01-30 Thread eliben

New submission from eliben :

This is correct:

relpath(r'd:\abc\jho', r'd:\abc')
=> 'jho'

But this isn't:
relpath(r'd:\jho', r'd:\\')
=> '..\jho'

Neither is this:
relpath(r'd:\jho', r'd:')
=> '..\..\..\jho'

--
components: Library (Lib)
messages: 80860
nosy: eliben
severity: normal
status: open
title: os.path.relpath problem with root drive directory on windows
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