[issue1028] Tkinter binding involving Control-spacebar raises unicode error

2008-11-21 Thread Hirokazu Yamamoto

Hirokazu Yamamoto [EMAIL PROTECTED] added the comment:

I suceeded to reproduce this issue with coLinux + UltraVNC on Win2000.

Yes, py3k claimed utf-8 error, so I tried trunk. Here is result.

*** event.keycode:  8
*** event.state:  0
*** event.char:  ''

*** event.keycode:  16
*** event.state:  4
*** event.char:  '\xc0\x80'

This '\xc0\x80' seems to be used in tcl as null byte '\0'. You can see
this magic value in tcl source and google.

I think we should convert this to '\x00' at python side. (shouldn't
treat this as utf-16)

I can see py3k + adhok.patch can output this result.

*** event.keycode:  8
*** event.state:  0
*** event.char:  ''

*** event.keycode:  16
*** event.state:  4
*** event.char:  '\x00'

Probably Tcl_GetUnicode does this conversion inside. (I'm not sure,
because I didn't look into source code so deeply) And I'm not sure why
this error doesn't happen with tk8.5.

Added file: http://bugs.python.org/file12089/adhok.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1028
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1028] Tkinter binding involving Control-spacebar raises unicode error

2008-11-21 Thread Hirokazu Yamamoto

Hirokazu Yamamoto [EMAIL PROTECTED] added the comment:

I did little modification to tkintertest.py. Please use this line.

my_print(*** event.char: , repr(event.char))

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1028
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4367] segmentation fault in ast_for_atom

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Yes, it's better to simply call str() on the exception. I was confused
by the fact that UnicodeError is a simple exception, with a single
message, unlike UnicodeDecodeError which has more attributes.

About the patch:
- The test does not work if test_ucn.py is run before: the unicodedata
module is imported only once on the first \N{} decoding. You could try
to run the test in a subprocess.

- In ast.c, errstr should be DECREF'd.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4367
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4373] Reference leaks in Python 3.0rc3

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

I have studied this some time ago. The xx module comes each time from a
different file (in a directory created with tempfile.mkdtemp).

Every instance of the module creates a new entry in the static
extensions dictionary in Python/import.c. This entry at least contains
a copy of the module dictionary, which explains the number of leaked
references.

I do not see any way to clear this dictionary. The proposed patch is
probably the best thing to do.

--
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4373
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4087] Document the effects of NotImplemented on == and !=

2008-11-21 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

Looks good.  Thanks, Raymond.

Minor typos:  numberic - numeric
the expression ``x in y`` equivalent to - 
the expression ``x in y`` is equivalent to

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4087
___
___
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

2008-11-21 Thread Erick Tryzelaar

New submission from Erick Tryzelaar [EMAIL PROTECTED]:

I'm running into a similar problem as Jean-Paul in:

http://bugs.python.org/issue4223

But the patch in it doesn't work for me. My issue is also with files 
compiled already with python3.0, but then being accessed from a 
different location using PYTHONPATH. Here's a full example of the 
problem:

mkdir dir1
mkdir dir1/foo
mkdir dir2
echo 'def f(): pass'   dir1/foo/__init__.py
cd dir1
python3.0 -c import foo
cd ../dir2
python3.0 -c import inspect, sys; sys.path.append('../dir1'); import 
foo; print(inspect.getsource(foo.f))

Which errors out with:

Traceback (most recent call last):
  File string, line 1, in module
  File 
/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/inspect.py, line 691, in getsource
lines, lnum = getsourcelines(object)
  File 
/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/inspect.py, line 680, in getsourcelines
lines, lnum = findsource(object)
  File 
/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3
.0/inspect.py, line 528, in findsource
raise IOError('could not get source code')
IOError: could not get source code


If I instrument inspect, it looks like what's happening is that 
linecache is being passed f.__code__.co_filename. However with the 
sys.path manipulation, that filename is baked into the .pyc file as 
foo/__init__.py. This confuses linecache which can't find the file. 
Here's one suggestion of a fix.

--- /tmp/inspect.py 2008-11-21 01:34:56.0 -0800
+++ /opt/local/lib/python3.0/inspect.py 2008-11-21 01:35:28.0 -
0800
@@ -518,6 +518,7 @@
 is raised if the source code cannot be retrieved.
 file = getsourcefile(object) or getfile(object)
 module = getmodule(object, file)
+file = getsourcefile(module) or getfile(file)
 if module:
 lines = linecache.getlines(file, module.__dict__)
 else:

It looks like in most situations the module has an accurate __file__ 
that's updated from PYTHONPATH. I'm not sure if this works in every 
situation, but this, along with the other patch, work together to get 
the source printing working.

--
components: Library (Lib)
messages: 76170
nosy: erickt
severity: normal
status: open
title: inspect.getsource doesn't work with PYTHONPATH and source compiled from 
a different dir
type: behavior
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4375
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4373] Reference leaks in Python 3.0rc3

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

The refleak in test_pickle comes from unpickler_read(). The attached
patch corrects it.

Added file: http://bugs.python.org/file12090/pickle-leak2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4373
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4376] Nested ctypes 'BigEndianStructure' fails

2008-11-21 Thread Aaron Brady

New submission from Aaron Brady [EMAIL PROTECTED]:

Nested 'BigEndianStructure' fails in 2.5 and 2.6.:

TypeError: This type does not support other endian

Example and traceback in attached file.

--
assignee: theller
components: ctypes
files: ng36.py
messages: 76171
nosy: castironpi, theller
severity: normal
status: open
title: Nested ctypes 'BigEndianStructure' fails
type: compile error
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file12091/ng36.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4376
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1028] Tkinter binding involving Control-spacebar raises unicode error

2008-11-21 Thread Guilherme Polo

Guilherme Polo [EMAIL PROTECTED] added the comment:

You are missing the point on using Tcl_CreateObjCommand, I didn't mean
to just go and and do s/Tcl_CreateCommand/Tcl_CreateObjCommand/ because
if you are going to convert everything to unicode then there is no point
in using Tcl_CreateObjCommand.
Also, Tcl_ObjCmdProc should use Tcl_Obj *CONST objv[] instead of Tcl_Obj
*const objv[] because Tcl may define CONST as nothing, and it uses CONST
when defining Tcl_ObjCmdProc.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1028
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4336] Fix performance issues in xmlrpclib

2008-11-21 Thread Kristján Valur Jónsson

Kristján Valur Jónsson [EMAIL PROTECTED] added the comment:

Just a thought here:
Maybe it would be better just to change socket._fileobject to always 
use a minimum of 8k readbuffer for readline() just as read() already 
does.  The read() documentation states that recv(1) is very 
inefficient, and so it is.
The intent, when calling makefile(bufsize=0) is probably to make sure 
that buffering for write() is disabled.
Any thoughts?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4336
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4373] Reference leaks in Python 3.0rc3

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

The problem is that on Windows (and cygwin) you cannot unlink a .pyd
that is currently loaded in memory.

I tried to use ctypes and call FreeLibrary. Now the .pyd can be removed,
but the interpreter crashes when it comes to free the module on shutdown.
I'm afraid that until python has a real support for dlclose() on dynamic
loaded module, the best is to skip this test during the refleak hunt.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4373
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4373] Reference leaks in Python 3.0rc3

2008-11-21 Thread Christian Heimes

Christian Heimes [EMAIL PROTECTED] added the comment:

Good analysis Amaury! The new patch for build ext uses a single temp dir.

--
nosy: +loewis
Added file: http://bugs.python.org/file12092/issue4373_build_ext2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4373
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1597850] Cross compiling patches for MINGW

2008-11-21 Thread Stephan Raue

Stephan Raue [EMAIL PROTECTED] added the comment:

when i crosscompile Python 2.6 with Patch cross-2.6-0.7.diff which is 
based on cross-2.5.1.patch  i become follow error: 

ld -s -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-
prototypes -I. -IInclude -I./Include build/temp.linux-i686-
2.5/home/stephan/OpenELEC/build.i386.uClibc/Python-
2.6/Modules/_multiprocessing/multiprocessing.o build/temp.linux-i686-
2.5/home/stephan/OpenELEC/build.i386.uClibc/Python-
2.6/Modules/_multiprocessing/socket_connection.o build/temp.linux-i686-
2.5/home/stephan/OpenELEC/build.i386.uClibc/Python-
2.6/Modules/_multiprocessing/semaphore.o -L/usr/lib -lpython2.5 -o 
build/lib.linux-i686-2.5/_multiprocessing.so
ld: unrecognized option '-DNDEBUG'
ld: use the --help option for usage information
creating build/temp.linux-i686-2.5/libffi
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... 
/home/stephan/OpenELEC/build.i386.uClibc/toolchain/bin/i686-geexbox-
linux-uclibc-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C 
compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
Failed to configure _ctypes module

what can i do libffi compiles with --host and --build

when i compile libffi standalone and run configure with --with-system-
ffi the error is the same.

--
nosy: +sraue
versions: +Python 2.6 -Python 2.5
Added file: http://bugs.python.org/file12093/cross-2.6-0.7.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1597850
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1028] Tkinter binding involving Control-spacebar raises unicode error

2008-11-21 Thread Hirokazu Yamamoto

Changes by Hirokazu Yamamoto [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file12089/adhok.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1028
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1028] Tkinter binding involving Control-spacebar raises unicode error

2008-11-21 Thread Guilherme Polo

Guilherme Polo [EMAIL PROTECTED] added the comment:

I'm sorry if it sounded like I were bashing you, I was just pointing out
my view of the patch -- you didn't need to remove it. The patch I
submitted here can also be improved (although it works), but I'm
leaving it as a possible idea for someone else that might look into
this, since I can't invest much time into this right now.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1028
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1028] Tkinter binding involving Control-spacebar raises unicode error

2008-11-21 Thread Hirokazu Yamamoto

Hirokazu Yamamoto [EMAIL PROTECTED] added the comment:

You are missing the point on using Tcl_CreateObjCommand, I didn't mean
to just go and and do s/Tcl_CreateCommand/Tcl_CreateObjCommand/ because
if you are going to convert everything to unicode then there is no
point in using Tcl_CreateObjCommand.

I'm not tcl/tk expert, so probably missng many things. :-(
Can you explain how to solve this issue by moving to Tcl_CreateObjCommand?

Also, Tcl_ObjCmdProc should use Tcl_Obj *CONST objv[] instead of
Tcl_Obj *const objv[] because Tcl may define CONST as nothing, and it
uses CONST when defining Tcl_ObjCmdProc.

I created adhok.patch just for explanation. This is not solution. I used
Tcl_CreateObjCommand + Tcl_GetUnicode to demonstrate Tcl converts
'\xc0\x80' to null byte. (adhok.patch contained Japanese characters, so
I'll repost that as just_for_explanation.patch)

Added file: http://bugs.python.org/file12094/just_for_explanation.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1028
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1028] Tkinter binding involving Control-spacebar raises unicode error

2008-11-21 Thread Guilherme Polo

Guilherme Polo [EMAIL PROTECTED] added the comment:

 Hirokazu Yamamoto added the comment:

You are missing the point on using Tcl_CreateObjCommand, I didn't mean
to just go and and do s/Tcl_CreateCommand/Tcl_CreateObjCommand/ because
if you are going to convert everything to unicode then there is no
point in using Tcl_CreateObjCommand.

 I'm not tcl/tk expert, so probably missng many things. :-(
 Can you explain how to solve this issue by moving to Tcl_CreateObjCommand?


By moving to Tcl_CreateObjCommand we would start using the FromObj
function present in _tkinter.c that is responsible for converting tcl
objects to python objects. Then what remains to be verified is how
compatible this would be with current tkinter code, and checking how
correct FromObj is nowadays.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1028
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4372] __cmp__ removal not in What's New

2008-11-21 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Duplicate issue: see #4372. Anyway, an you write a patch?

--
nosy: +haypo
resolution:  - duplicate
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4372] __cmp__ removal not in What's New

2008-11-21 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4358] Segfault in stringobject.c

2008-11-21 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

 The application is a web service with postgresql backend, so it
 heavily uses pyexpat and pygresql in a threaded environment.

pyexpat or pygresql is maybe not thread safe. To catch such error, you 
have to use Valgrind. And to use Valgrind, you have to recompile 
Python with the define Py_USING_MEMORY_DEBUGGER: read 
Misc/valgrind.supp (comments at the top). Then, 
use valgrind --suppressions=Misc/valgrind.supp your program 
arguments You might also try 
helgrind: valgrind --tool=helgrind --suppressions=Misc/valgrind.supp 
your program arguments

Note: remember me to translate this article to english!
http://www.haypocalc.com/blog/index.php/2008/08/22/160-deboguer-programme-python-avec-gdb

--
nosy: +haypo

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4358
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3741] DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an exception

2008-11-21 Thread Barry A. Warsaw

Changes by Barry A. Warsaw [EMAIL PROTECTED]:


___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3741
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Barry A. Warsaw

Changes by Barry A. Warsaw [EMAIL PROTECTED]:


--
priority: deferred blocker - release blocker

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4373] Reference leaks in Python 3.0rc3

2008-11-21 Thread Barry A. Warsaw

Changes by Barry A. Warsaw [EMAIL PROTECTED]:


--
priority: deferred blocker - release blocker

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4373
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2306] Update What's new in 3.0

2008-11-21 Thread Barry A. Warsaw

Changes by Barry A. Warsaw [EMAIL PROTECTED]:


--
priority: deferred blocker - release blocker

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2306
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4303] [2.5 regression] ctypes fails to build on arm-linux-gnu

2008-11-21 Thread Barry A. Warsaw

Barry A. Warsaw [EMAIL PROTECTED] added the comment:

Deferring until 3.0 final is out.

--
nosy: +barry
priority: release blocker - deferred blocker

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4303
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2306] Update What's new in 3.0

2008-11-21 Thread Skip Montanaro

Changes by Skip Montanaro [EMAIL PROTECTED]:


--
nosy: +skip.montanaro

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2306
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Skip Montanaro

Skip Montanaro [EMAIL PROTECTED] added the comment:

damn... my cc to [EMAIL PROTECTED] didn't work.  Here's the recap
(message to python-checkins):

me ... I thought Guido was of the opinion that the 3.0 version 
should
me be able to read dumb dbms written by earlier Python versions

And write them.  From msg72963:

(1) Be able to read databases written by Python 2.x.

(1a) Write databases readable by Python 2.x.

Ah, but wait a minute.  I see your comment in msg76080:

If you look at the 2.7 code all it requires of keys and values in
__setitem__ is that they are strings; there is nothing about Latin-1 
in
terms of specific encoding (must be a 3.0 addition to make the
str/unicode transition the easiest).

The acid test.  I executed the attached mydb2write.py using Python 2.5 
then
executed the attached mydb3read.py using Python 3.0.  The output:

% python2.5 mydb2write.py 
1 abc
2 [4, {4.2998: 12}]
3 __main__.C instance at 0x34bb70
% python3.0 mydb3read.py
1 b'abc'
2 [4, {4.2998: 12}]
Traceback (most recent call last):
  File mydb3read.py, line 13, in module
print(3, pickle.loads(db['3']))
  File /Users/skip/local/lib/python3.0/pickle.py, line 1329, in 
loads
return Unpickler(file, encoding=encoding, errors=errors).load()
_pickle.UnpicklingError: bad pickle data

so if the ability to read Python 2.x dumbdbm files is still a 
requirement I
think there's a little more work to do.

--
nosy: +skip.montanaro
Added file: http://bugs.python.org/file12095/mydb2write.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Skip Montanaro

Changes by Skip Montanaro [EMAIL PROTECTED]:


Added file: http://bugs.python.org/file12096/mydb3read.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Re: r67310 - in python/branches/py3k: Lib/dbm/dumb.py Lib/test/test_dbm_dumb.py Misc/NEWS

2008-11-21 Thread Guido van Rossum

Guido van Rossum [EMAIL PROTECTED] added the comment:

I think the ability to read old files is essential. The ability to
write them is a mer nice-to-have.

On Fri, Nov 21, 2008 at 7:36 AM,  [EMAIL PROTECTED] wrote:

me ... I thought Guido was of the opinion that the 3.0 version should
me be able to read dumb dbms written by earlier Python versions

 And write them.  From msg72963:

(1) Be able to read databases written by Python 2.x.

(1a) Write databases readable by Python 2.x.

 Ah, but wait a minute.  I see your comment in msg76080:

If you look at the 2.7 code all it requires of keys and values in
__setitem__ is that they are strings; there is nothing about Latin-1 in
terms of specific encoding (must be a 3.0 addition to make the
str/unicode transition the easiest).

 The acid test.  I executed the attached mydb2write.py using Python 2.5 then
 executed the attached mydb3read.py using Python 3.0.  The output:

% python2.5 mydb2write.py
1 abc
2 [4, {4.2998: 12}]
3 __main__.C instance at 0x34bb70
% python3.0 mydb3read.py
1 b'abc'
2 [4, {4.2998: 12}]
Traceback (most recent call last):
  File mydb3read.py, line 13, in module
print(3, pickle.loads(db['3']))
  File /Users/skip/local/lib/python3.0/pickle.py, line 1329, in loads
return Unpickler(file, encoding=encoding, errors=errors).load()
_pickle.UnpicklingError: bad pickle data

 so if the ability to read Python 2.x dumbdbm files is still a requirement I
 think there's a little more work to do.

 cc'ing [EMAIL PROTECTED] to preserve the scripts with the ticket.

 Skip


 ___
 Python-3000-checkins mailing list
 [EMAIL PROTECTED]
 http://mail.python.org/mailman/listinfo/python-3000-checkins



--
title: Byte/string inconsistencies between different dbm modules - Re: r67310 
- in python/branches/py3k: Lib/dbm/dumb.py Lib/test/test_dbm_dumb.py Misc/NEWS

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Re: r67310 - in python/branches/py3k: Lib/dbm/dumb.py Lib/test/test_dbm_dumb.py Misc/NEWS

2008-11-21 Thread Guido van Rossum

Guido van Rossum [EMAIL PROTECTED] added the comment:

Reading old dumbdbm files is essential. Writing them is not.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4378] howto doc update

2008-11-21 Thread David W. Lambert

New submission from David W. Lambert [EMAIL PROTECTED]:

http://docs.python.org/dev/3.0/howto/functional.html

Gone:

  itertools.ifilter
  itertools.imap
  itertools.izip

changed:

  itertools.ifilterfalse   --   itertools.filterfalse

strange?

  functools.reduce is described, but not with functools.

The section requests comments be mailed directly to author.  Done.

--
assignee: georg.brandl
components: Documentation
messages: 76190
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: howto doc update
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4378
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3926] Idle doesn't obey the new improved warnings arguements

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

This is already corrected by r66922 (issue3391), but the patches are
different and there are some things I don't like in the present
implementation:

- in idle_showwarning, the file argument is ignored and always
replaced by warning_stream.
- warnings.formatwarning is passed a file argument: this could fail,
but works only because the function is monkey-patched. But file is not
even used there!

The attached patch seems better, but does not apply cleanly any more.

--
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3926
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1711800] SequenceMatcher bug with insert/delete block after replace

2008-11-21 Thread Andrew Inglis

Andrew Inglis [EMAIL PROTECTED] added the comment:

Are there any updates for this issue? I am having the same problem, or,
lack of feature, with SequenceMatcher. Gabriel, Differ doesn't seem to
have the functionality, or an easy way to patch it to get the
functionality, that Christian is talking about. Christian, what are
these Any diffing program[s] that you speak of that give the same
output of SequenceMatcher with this issue fixed? Any solutions you found
for python?

Thanks!

--
nosy: +tfaing
type:  - feature request
versions: +Python 2.5.3 -Python 2.6

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1711800
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4379] Py_SAFE_DOWNCAST in FILE_TIME_to_time_t_nsec failing

2008-11-21 Thread Kevin Watters

New submission from Kevin Watters [EMAIL PROTECTED]:

After releasing a Py_DEBUG build to some users who were experiencing 
problems, I noticed a pattern in some of the crash reports I got back:

msvcr90d!_wassert+0xb64
python25_d!FILE_TIME_to_time_t_nsec+0xac
python25_d!attribute_data_to_stat+0x67
python25_d!win32_wstat+0x6f
python25_d!posix_do_stat+0x51
python25_d!posix_stat+0x24
python25_d!PyCFunction_Call+0x65
python25_d!call_function+0x34f
python25_d!PyEval_EvalFrameEx+0x4741

The only way I can see _wassert being hit in FILE_TIME_to_time_t_nsec is 
in the Py_SAFE_DOWNCAST used to downcast an __int64 to int. 
Py_SAFE_DOWNCAST checks that there is equality between the casted and 
non-casted values with Py_DEBUG enabled--maybe in this function we 
should remove Py_SAFE_DOWNCAST?

I can't find a way to see the actual value for in before the assert is 
hit--I'm unfamiliar with picking through minidumps with WinDbg, which 
for some reason will show me the stack for these dumps when Visual 
Studio won't. But if I need to investigate more about them I can.

--
components: None
messages: 76193
nosy: kevinwatters
severity: normal
status: open
title: Py_SAFE_DOWNCAST in FILE_TIME_to_time_t_nsec failing
type: behavior
versions: Python 2.5.3

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4379
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4368] A bug in ncurses.h still exists in FreeBSD 4.9 - 4.11

2008-11-21 Thread Akira Kitada

Akira Kitada [EMAIL PROTECTED] added the comment:

Yes, that change was not merged into 2.5 branch.
I Hope it's not yet been too late for 2.5.3.

I confirmed this fixes the problem on FreeBSD 4.11.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4368
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

So the use of pickle is not fair as that doesn't round-trip if you
simply write out a file because py3k pickle doesn't like classic classes
and the new-style classes want copy_reg which is not in existence in
py3k since it was renamed. See pickle2write.py and pickle3read.py (which
are version-agnostic; just following Skip's naming) for the pickle failing.

Now if you skip that one use-case in the example of pickling a
user-defined class then everything works out. I have attached a
hacked-up version of Skip's scripts that take Unicode strings, encode
them in Latin-1 and UTF-8, and then decode them on the other side in
Py3K, all without issue.

In other words I think my solution works and pickle is the trouble-maker
in all of this.

--
stage: commit review - needs patch
Added file: http://bugs.python.org/file12097/pickle2write.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Brett Cannon

Changes by Brett Cannon [EMAIL PROTECTED]:


Added file: http://bugs.python.org/file12099/mydb2write.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Brett Cannon

Changes by Brett Cannon [EMAIL PROTECTED]:


Added file: http://bugs.python.org/file12100/mydb3read.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Brett Cannon

Changes by Brett Cannon [EMAIL PROTECTED]:


--
resolution: accepted - 

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Skip Montanaro

Skip Montanaro [EMAIL PROTECTED] added the comment:

Brett In other words I think my solution works and pickle is the
Brett trouble-maker in all of this.

I can buy that.  Should pickle map copy_reg to copyreg?  Is that the
only incompatibility?

Actually, it seems this ticket should be closed and another opened about
this pickle issue.

Skip

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

On Fri, Nov 21, 2008 at 10:32, Skip Montanaro [EMAIL PROTECTED] wrote:

 Skip Montanaro [EMAIL PROTECTED] added the comment:

 Brett In other words I think my solution works and pickle is the
Brett trouble-maker in all of this.

 I can buy that.  Should pickle map copy_reg to copyreg?  Is that the
 only incompatibility?

 Actually, it seems this ticket should be closed and another opened about
 this pickle issue.


Well, I still need a code review for my latest patch that changes the
docs, cleans up gdbm and ndbm exception messages, catches a place
where I didn't decode before write-out, and adds an 'encoding'
argument to all open() calls.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Skip Montanaro

Skip Montanaro [EMAIL PROTECTED] added the comment:

One doc nit: There is still reference to ``gdbm`` and Dbm (or dbm) objects
when they should probably use ``dbm.gnu`` and ``dbm.ndbm``, respectively.

I'm confused by the encoding=Latin-1 args to _io.open for dbm.dumb.  I
thought the default enoding was going to be utf-8, and I see no way to
influence that.  Is that just to make sure all code points can be written
without error?

Skip

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


--
nosy:  -haypo

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3799] Byte/string inconsistencies between different dbm modules

2008-11-21 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

On Fri, Nov 21, 2008 at 11:01, Skip Montanaro [EMAIL PROTECTED] wrote:

 Skip Montanaro [EMAIL PROTECTED] added the comment:

 One doc nit: There is still reference to ``gdbm`` and Dbm (or dbm) objects
 when they should probably use ``dbm.gnu`` and ``dbm.ndbm``, respectively.


OK, I will fix that and upload a new patch at some point.

 I'm confused by the encoding=Latin-1 args to _io.open for dbm.dumb.  I
 thought the default enoding was going to be utf-8, and I see no way to
 influence that.  Is that just to make sure all code points can be written
 without error?


It's so that when writing out there won't be any errors. Since the
repr of strings are used instead of bytes the stuff passed in and
written to disk must be represented in an encoding that will never
complain about what bytes it gets. Latin-1 does this while UTF-8. And
since everything is being written and read in Latin-1 I figured I
might as well be thorough and specify the encoding.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4380] Deepcopy of functools.partial gives wierd exception

2008-11-21 Thread Kevin Fitch

New submission from Kevin Fitch [EMAIL PROTECTED]:

from functools import partial
from copy import deepcopy

p = partial(Hello world.replace, world)
p(mom)
p2 = deepcopy(p)


The output I get is:
Hello mom

Followed by:
type 'exceptions.TypeError' Traceback (most recent call last)

/home/kfitch/ipython console in module()

/usr/lib/python2.5/copy.py in deepcopy(x, memo, _nil)
187 raise Error(
188 un(deep)copyable object of type
%s % cls)
-- 189 y = _reconstruct(x, rv, 1, memo)
190
191 memo[d] = y

/usr/lib/python2.5/copy.py in _reconstruct(x, info, deep, memo)
320 if deep:
321 args = deepcopy(args, memo)
-- 322 y = callable(*args)
323 memo[id(x)] = y
324 if listiter is not None:

/usr/lib/python2.5/copy_reg.py in __newobj__(cls, *args)
 90
 91 def __newobj__(cls, *args):
--- 92 return cls.__new__(cls, *args)
 93
 94 def _slotnames(cls):

type 'exceptions.TypeError': type 'partial' takes at least one argument



I am not entirely convinced that doing a deepcopy on a partial makes
sense, but I would expect one of:
1) An explicit exception saying it isn't allowed
2) Returning the original partial object
3) An actual copy (should the arguments its storing get deepcopied?)

P.S. This is with 2.5.2 under Linux (Ubuntu 8.04)

--
messages: 76200
nosy: kfitch
severity: normal
status: open
title: Deepcopy of functools.partial gives wierd exception
type: behavior
versions: Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4380
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4379] Py_SAFE_DOWNCAST in FILE_TIME_to_time_t_nsec failing

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

You almost gave the answer in your question - the FILE_TIME is about to be 
converted to a time_t greater than 2**31.

in posixmodule.c::FILE_TIME_to_time_t_nsec(), a comment says:
/* XXX Win32 supports time stamps past 2038; we currently don't */
just before the assert()...

And indeed to reproduce the same crash it is enough to call os.stat() on a 
file with a creation date in 2050 for example.

--
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4379
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4381] Cannot declare multiple classes via exec when inside a function.

2008-11-21 Thread Kevin Fitch

New submission from Kevin Fitch [EMAIL PROTECTED]:

codeText = 
class foo(object): pass
class bar(object):
  baz = foo()


def doExec(text):
  exec text

### This works:
# Although if I do this before the doExec below, then the
# doExec doesn't fail.
# exec codeText

### But this does not:
doExec(codeText)


The output I get is:
---
type 'exceptions.NameError' Traceback (most recent call last)

/home/kfitch/ipython console in module()

/home/kfitch/ipython console in doExec(text)

/home/kfitch/string in module()

/home/kfitch/string in bar()

type 'exceptions.NameError': name 'foo' is not defined



I don't fully understand why the version in the function doesn't work,
but I suspect it is a bug related to scoping, since foo is really
doExec.foo (I think).

This is with python 2.5.2 under Linux (Ubuntu 8.04)

--
messages: 76202
nosy: kfitch
severity: normal
status: open
title: Cannot declare multiple classes via exec when inside a function.
versions: Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4381
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4356] Add key argument to bisect module functions

2008-11-21 Thread Miki Tebeka

Miki Tebeka [EMAIL PROTECTED] added the comment:

I agree you can get around this with defining __cmp__, however same goes
to sort and it was added anyway.

My take on it is that sometimes I need to find something in a big list
of objects, and I don't like to do DSU and not add __cmp__ to the
objects (since some of the lists might be sorted by different attributes
- say one list for time and one line for price).

I'd prefer if we do implement key and add a warning in the docs it
might slow you down. Which what will happen in the case of __cmp__ anyway.

I don't see why the key function should be called all the time on
inserted item, it's very easy to cache this value

def bisect(a, x, lo=0, hi=None, key=lambda x: x):
assert low = 0, low must be non-negative
hi = hi or len(a)

x_key = key(x) 
while lo  hi:
mid = (lo+hi)//2
if x_key  key(a[mid]): hi = mid
else: lo = mid+1
return lo

(I'd also wish for identity built in, however this is another subject :)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4356
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4379] Py_SAFE_DOWNCAST in FILE_TIME_to_time_t_nsec failing

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

The attached patch corrects the problem: since VS2008 time_t is a 64bit 
integer; now os.stat() can return times after 2038 on Windows.

This prevents the crash, but the functionality is far from complete: 
os.utime() at least should accept 64bit times.

--
keywords: +patch
Added file: http://bugs.python.org/file12101/time_t_64.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4379
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4381] Cannot declare multiple classes via exec when inside a function.

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

I agree that it is confusing; in short: a bare exec() does not play well with 
closures;  
This is a consequence of the python execution model, and is unlikely to change.

Here, the class 'foo' is stored in the function's local variables.
But the execution of the body of the 'bar' class searches names in its local 
scope (the 
class body) and the global scope (the module level), and misses the function's 
locals...

I strongly suggest to avoid pure exec() statements; always specify a global 
and/or a 
local dictionary.

In your case, the following works:

def doExec(text):
  d = {}  # or:   d = dict(globals())
  exec text in d
  print d.keys()

--
nosy: +amaury.forgeotdarc
resolution:  - wont fix
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4381
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4367] segmentation fault in ast_for_atom

2008-11-21 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

This new patch address review issues.

Added file: http://bugs.python.org/file12102/use_PyObject_Str_and_test3.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4367
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4363] Make uuid module functions usable without ctypes

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Fixed in r63718 (trunk) and r63719 (2.6)
Thanks for the report!

--
nosy: +amaury.forgeotdarc
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4363
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4382] test_dbm_dumb fails due to character encoding issue on Mac OS X

2008-11-21 Thread Martina Oefelein

New submission from Martina Oefelein [EMAIL PROTECTED]:

test_dbm_dumb fails due to what appears to be a character encoding issue 
on Mac OS X:

Majestix:Python-3.0rc3 martina$ 
DYLD_FRAMEWORK_PATH=/Users/martina/Downloads/Python-3.0rc3: ./python.exe 
-E -bb ./Lib/test/regrtest.py -l test_dbm_dumbtest_dbm_dumb
Exception UnicodeEncodeError: UnicodeEncodeError('charmap', 'ü', 
(3072, 1)\n, 2, 3, 'character maps to undefined') in bound method 
_Database.close of dbm.dumb._Database object at 0x6a2510 ignored
Exception UnicodeEncodeError: UnicodeEncodeError('charmap', 'ü', 
(3072, 1)\n, 2, 3, 'character maps to undefined') in bound method 
_Database.close of dbm.dumb._Database object at 0x6a2510 ignored
Exception UnicodeEncodeError: UnicodeEncodeError('charmap', 'ü', 
(3072, 1)\n, 2, 3, 'character maps to undefined') in bound method 
_Database.close of dbm.dumb._Database object at 0x6a2510 ignored
Exception UnicodeEncodeError: UnicodeEncodeError('charmap', 'ü', 
(3072, 1)\n, 2, 3, 'character maps to undefined') in bound method 
_Database.close of dbm.dumb._Database object at 0x6a2510 ignored
Exception UnicodeEncodeError: UnicodeEncodeError('charmap', 'ü', 
(3072, 1)\n, 2, 3, 'character maps to undefined') in bound method 
_Database.close of dbm.dumb._Database object at 0x6a2550 ignored
Exception UnicodeEncodeError: UnicodeEncodeError('charmap', 'ü', 
(3072, 1)\n, 2, 3, 'character maps to undefined') in bound method 
_Database.close of dbm.dumb._Database object at 0x6a2550 ignored
test test_dbm_dumb failed -- errors occurred; run in verbose mode for 
details
1 test failed:
test_dbm_dumb

--
components: Library (Lib), Macintosh, Tests
messages: 76208
nosy: oefe
severity: normal
status: open
title: test_dbm_dumb fails due to character encoding issue on Mac OS X
type: behavior
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4382
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4382] test_dbm_dumb fails due to character encoding issue on Mac OS X

2008-11-21 Thread Martina Oefelein

Martina Oefelein [EMAIL PROTECTED] added the comment:

Example of verbose output (other testcases are similar):

==
ERROR: test_dumbdbm_creation (test.test_dbm_dumb.DumbDBMTestCase)
--
Traceback (most recent call last):
  File /Users/martina/Downloads/Python-
3.0rc3/Lib/test/test_dbm_dumb.py, line 41, in test_dumbdbm_creation
f.close()
  File /Users/martina/Downloads/Python-3.0rc3/Lib/dbm/dumb.py, line 
228, in close
self._commit()
  File /Users/martina/Downloads/Python-3.0rc3/Lib/dbm/dumb.py, line 
116, in _commit
f.write(%r, %r\n % (key.decode('Latin-1'), pos_and_siz_pair))
  File ./Lib/io.py, line 1491, in write
b = encoder.encode(s)
  File ./Lib/encodings/mac_roman.py, line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xbc' in 
position 2: character maps to undefined

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4382
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4382] test_dbm_dumb fails due to character encoding issue on Mac OS X

2008-11-21 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
nosy: +brett.cannon

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4382
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4367] segmentation fault in ast_for_atom

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Everything looks good.

(20 lines of a complex test for two simple lines of code that nobody 
will ever run... unit tests is a religion)

--
keywords:  -needs review
resolution:  - accepted

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4367
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4367] segmentation fault in ast_for_atom

2008-11-21 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

On Fri, Nov 21, 2008 at 4:21 PM, Amaury Forgeot d'Arc
[EMAIL PROTECTED] wrote:

 Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

 Everything looks good.

Thanks for the review. Fixed in r67320.


 (20 lines of a complex test for two simple lines of code that nobody
 will ever run... unit tests is a religion)

One can't say we didn't try. :)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4367
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4367] segmentation fault in ast_for_atom

2008-11-21 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
resolution: accepted - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4367
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4382] test_dbm_dumb fails due to character encoding issue on Mac OS X

2008-11-21 Thread Martina Oefelein

Martina Oefelein [EMAIL PROTECTED] added the comment:

The Mac Roman encoding comes into play, because _commit opens _dirfile 
without explicitly specifying an encoding. io.open then gets the 
encoding via locale.getpreferredencoding, which returns mac-roman:

Majestix:Python-3.0rc3 martina$ 
DYLD_FRAMEWORK_PATH=/Users/martina/Downloads/Python-3.0rc3: ./python.exe 
-c import locale;print(locale.getpreferredencoding())
mac-roman

Two issues:
- since dumb.py handles encoding explicitly, shouldn't it specify the 
encoding for _dirfile as well? (or use a binary file; but this could 
cause new line-ending troubles...)
- is mac-roman really the appropriate choice for 
locale.getpreferredencoding? This is on Mac OS X 10.5, not Mac OS 9... 
The preferred encoding for Mac OS X should be utf-8, not some legacy 
encoding...

Seems to be related to r67310, which was intended to fix issue #3799
http://svn.python.org/view/python/branches/py3k/Lib/dbm/dumb.py?
rev=67310r1=63662r2=67310

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4382
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4383] UnboundLocalError when IDLE cannot connect to its subprocess

2008-11-21 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc [EMAIL PROTECTED]:

When IDLE cannot connect to its subprocess, it tries to display the 
socket.error. But since python 3.0 the exception variable is cleared 
after the except: block and unavailable for the displaying code.

Exception in thread SockThread:
Traceback (most recent call last):
  File c:\dev\python\py3k\lib\threading.py, line 507, in 
_bootstrap_inner
self.run()
  File c:\dev\python\py3k\lib\threading.py, line 462, in run
self._target(*self._args, **self._kwargs)
  File c:\dev\python\py3k\lib\idlelib\run.py, line 125, in 
manage_socket
show_socket_error(err, address)
UnboundLocalError: local variable 'err' referenced before assignment

Patch is attached.

--
components: IDLE
files: idle_socketerror.patch
keywords: needs review, patch
messages: 76213
nosy: amaury.forgeotdarc
priority: release blocker
severity: normal
status: open
title: UnboundLocalError when IDLE cannot connect to its subprocess
versions: Python 3.0
Added file: http://bugs.python.org/file12103/idle_socketerror.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4383
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4382] test_dbm_dumb fails due to character encoding issue on Mac OS X

2008-11-21 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

Issue 3799 already has a patch that specifies the encoding upon opening
the file so this should be fixed by final. Can you test the patch
(specify_open_encoding.diff) and let me know if that solves your
problem, Martina?

--
dependencies: +Byte/string inconsistencies between different dbm modules

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4382
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4323] Wrong encoding in files saved from IDLE (3.0rc2 on Windows)

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

The patch is good and does simplify things: the py3k conversion to 
unicode may have some advantages sometimes!

I suggest to also remove the remaining two occurrences of 
frameEncoding in configDialog.py. This will suppress the extra space 
between the last two blocks of the dialog.

--
keywords:  -needs review
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4323
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4383] UnboundLocalError when IDLE cannot connect to its subprocess

2008-11-21 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Looks good.

--
nosy: +benjamin.peterson

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4383
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4328] à in ufoo raises a misleading error

2008-11-21 Thread Terry J. Reedy

Terry J. Reedy [EMAIL PROTECTED] added the comment:

| but then it works with:
|  b'f' in 'foo'
| True

Not True in 3.0rc3.  Same message as you quoted:
 'in string' requires string as left operand, not bytes

bytes + string fails too

--
nosy: +tjreedy

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4328
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4329] base64 does not properly handle unicode strings

2008-11-21 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

It's not a bug. base64 is a codec to encode *bytes* and characters. 
You have to encode your unicode string to bytes using a charset
 Example (utf-8):
 from base64 import b64encode, b64decode
 b64encode(u'a\xe9'.encode(utf-8))
'YcOp'
 unicode(b64decode('YcOp'), utf-8)
u'a\xe9'

--
nosy: +haypo
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4329
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4383] UnboundLocalError when IDLE cannot connect to its subprocess

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Thanks for the fast review, fixed in r67323

--
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4383
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4380] Deepcopy of functools.partial gives wierd exception

2008-11-21 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
priority:  - normal

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4380
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4374] Pickle tests fail w/o _pickle extension

2008-11-21 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
assignee:  - alexandre.vassalotti
nosy: +alexandre.vassalotti

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4374
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4374] Pickle tests fail w/o _pickle extension

2008-11-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

The test could be skipped for the pure-python version of pickle: after 
all, it just tests that the interpreter does not segfault...
A simpler change is to change the expected exception into Exception.

--
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4374
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4384] Add a warnings.showwarning replacement for logging

2008-11-21 Thread Brett Cannon

New submission from Brett Cannon [EMAIL PROTECTED]:

It would be nice if the logging package provided a replacement for
warnings.showwarning() so that all warning redirect to the logging package.

--
components: Library (Lib)
keywords: easy
messages: 76221
nosy: brett.cannon
priority: normal
severity: normal
stage: needs patch
status: open
title: Add a warnings.showwarning replacement for logging
type: feature request

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4384
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4371] coerce gone---but not from docs

2008-11-21 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Thanks for the suggestions. Done in r67324 and r67311.

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

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4371
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4384] Add a warnings.showwarning replacement for logging

2008-11-21 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
assignee:  - vsajip
nosy: +vsajip

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4384
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4329] base64 does not properly handle unicode strings

2008-11-21 Thread Terry J. Reedy

Terry J. Reedy [EMAIL PROTECTED] added the comment:

This module provides data encoding and decoding as specified in RFC
3548. This standard defines the Base16, Base32, and Base64 algorithms
for encoding and decoding arbitrary binary strings into text strings
that can be safely sent by email, used as parts of URLs, or included as
part of an HTTP POST request. 

In other words, arbitrary 8-bit byte strings = 'safe' byte strings
You have to encode unicode to bytes first, as you did.  Str works
because you only have ascii chars and str uses the ascii encoder by
default.  The bytes() constructor has no default and 'ascii' must be
supplied

The error message is correct even if backwards. Unicode.translate
requires a unicode mapping, whereas b64decode supplies a bytes mapping
because it requires bytes.

3.0 added an earlier type check, so the same code gives
TypeError: expected bytes, not str

I believe there was an explicit decision to leave low-level wire-
protocol byte functions as bytes/bytearray only.

The 3.0 manual needs updating in this respect, but I will start another
issue for that.

--
nosy: +tjreedy

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4329
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4329] base64 does not properly handle unicode strings

2008-11-21 Thread Terry J. Reedy

Changes by Terry J. Reedy [EMAIL PROTECTED]:


--
resolution: fixed - invalid

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4329
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4385] Py_Object_HEAD_INIT in Py3k

2008-11-21 Thread Nick Coghlan

New submission from Nick Coghlan [EMAIL PROTECTED]:

The memory layout of PyType object's changes in Py3k from the
*compiler's* point of view. This means PyObject_HEAD_INIT can no longer
be used to initialise PyVarObject type definitions.

However, the documentation doesn't point this out (or document
PyVarObject_HEAD_INIT at all), and the compiler warnings currently
generated are not clear. Suggestion is to remove PyObject_HEAD_INIT from
Py3k entirely so this becomes a compile error instead of a warning, and
then better document the situation so extension authors know how to
correctly initialise the affected C structs.

See mailing list thread at:
http://mail.python.org/pipermail/python-3000/2008-November/015241.html

--
components: Interpreter Core
messages: 76224
nosy: ncoghlan
priority: release blocker
severity: normal
stage: needs patch
status: open
title: Py_Object_HEAD_INIT in Py3k
type: behavior
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4385
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4386] A binary file should show b in its mode

2008-11-21 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc [EMAIL PROTECTED]:

The changes following r67300 introduced the .mode and .name attributes on all 
the file-like objects returned by the open() function.

This also changed the mode returned by a file opened in binary mode: it was 
rb, now it is r. The fact that the mode does not round-trip (i.e: open(f, 
mode).mode != mode) was considered not important.

But now it is difficult to see if some opened file was opened in text or binary 
mode; in test_gzip.py, a test had to be changed, and now it does not test 
anything at all: the intent of the test is just to verify that a zip file is 
always opened in binary mode.

Benjamin suggested to change the mode returned by FileIO objects, so that they 
always contain a 'b'. They also accept an extra 'b' on creation: it is just 
ignored.

Now, for a file opened in text mode:
 f = open('filename')
 assert f.mode== 'r'
 assert f.buffer.mode == 'rb'
 assert f.buffer.raw.mode == 'rb'

The mode attribute is now always consistent with the one passed to the open() 
function. This also avoid gratuitous breakage with python2.x.

Patch attached. All tests pass.

--
assignee: benjamin.peterson
files: fileio_mode.patch
keywords: needs review, patch
messages: 76225
nosy: amaury.forgeotdarc, benjamin.peterson
priority: release blocker
severity: normal
stage: patch review
status: open
title: A binary file should show b in its mode
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file12104/fileio_mode.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4386
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4387] binascii b2a functions accept strings (unicode) as data

2008-11-21 Thread Terry J. Reedy

New submission from Terry J. Reedy [EMAIL PROTECTED]:

Binascii b2a_xxx functions accept 'binary data' and return ascii-encoded
bytes.  The corresponding a2b_xxx functions turn the ascii-encoded bytes
back to 'binary data' (bytes).  If the binary data is bytes, these
should be inverses of each other.

Somewhat surprisingly to me (because the corresponding base64 module
functions raise TypeError: expected bytes, not str) 3.0 strings
(unicode) are accepted as 'binary data', though they will not 'round-trip'.

Ascii chars almost do
 a=''
 c=b.b2a_base64(a)
 c
b'YWFhYQ==\n'
 d=b.a2b_base64(c)
 d
b''

But general unicode chars generate nonsense.
 a='\u1000'
 c=b.b2a_base64(a)
 c
b'4YCA\n'
 d=b.a2b_base64(c)
 d
b'\xe1\x80\x80'

I also tried b2a_uu.

Is this a bug?

--
components: Extension Modules
messages: 76226
nosy: tjreedy
severity: normal
status: open
title: binascii b2a functions accept strings (unicode) as data
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4387
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4386] A binary file should show b in its mode

2008-11-21 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Amaury, thanks for getting the tests to pass. Applied in r67325.

--
resolution:  - accepted
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4386
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4374] Pickle tests fail w/o _pickle extension

2008-11-21 Thread Alexandre Vassalotti

Alexandre Vassalotti [EMAIL PROTECTED] added the comment:

I think the best way to fix this is to add sanity checks similar to the
ones in _pickle. The checks are obviously useless in pickle.py, but I
think it is simpler than to try to skip tests, and it gives a nicer
error message to people who forget to call __init__ when subclassing.

--
keywords: +patch
Added file: http://bugs.python.org/file12105/fix_issue4374.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4374
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4337] Iteration over a map object with list()

2008-11-21 Thread Terry J. Reedy

Terry J. Reedy [EMAIL PROTECTED] added the comment:

Dict views and range objects are *iterables* because they are based on
reusable information.  Map, filter, and similar objects are *iterators*
because they are based on iterables that could be once-through
iterators. The built-in function entries carefully specific which is which.

--
nosy: +tjreedy

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4337
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4356] Add key argument to bisect module functions

2008-11-21 Thread Terry J. Reedy

Terry J. Reedy [EMAIL PROTECTED] added the comment:

Just a reminder that __cmp__ is gone in 3.0.
I presume bisect, like sort, only requires __lt__ and perhaps __eq__,
though I can find no doc of either.

--
nosy: +tjreedy

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4356
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4361] Docstring for Lib/string.py is outdated

2008-11-21 Thread Terry J. Reedy

Terry J. Reedy [EMAIL PROTECTED] added the comment:

In rc3 also: The problem is partial update:

DESCRIPTION
Public module variables:

whitespace -- a string containing all characters considered whitespace
lowercase -- a string containing all characters considered lowercase
letters
uppercase -- a string containing all characters considered uppercase
letters
letters -- a string containing all characters considered letters
...
DATA
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

The latter is indeed correct:
 dir(string)
[..., 'ascii_letters', 'ascii_lowercase', 'ascii_uppercase', ...]

--
nosy: +tjreedy

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4361
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com