[issue3326] py3k shouldn't use -fno-strict-aliasing anymore

2008-07-13 Thread Ismail Donmez

Ismail Donmez <[EMAIL PROTECTED]> added the comment:

I tested with -fstrict-aliasing -O3 and there is no aliasing warning,
this is with

gcc 4.3.1
x86_64 linux

what you see might be a compiler deficiency :-/

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3335] subprocess lib - opening same command fails

2008-07-13 Thread Gregory P. Smith

Gregory P. Smith <[EMAIL PROTECTED]> added the comment:

I am unable to reproduce this (using release24-maint on OS X 10.4).  the
script I used is attached.

Does this script fail for you?  If not, please upload something that fails.

--
nosy: +gregory.p.smith
Added file: http://bugs.python.org/file10894/subprocess-isue3335.py

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3346] test_ossaudiodev fails

2008-07-13 Thread Ismail Donmez

Ismail Donmez <[EMAIL PROTECTED]> added the comment:

Scratch that, it still fails in the second phase of make testall with
the same error.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3346] test_ossaudiodev fails

2008-07-13 Thread Ismail Donmez

Ismail Donmez <[EMAIL PROTECTED]> added the comment:

Works with today's SVN, please close as invalid.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3026] mmap broken with large files on 64bit system

2008-07-13 Thread Martin v. Löwis

Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

So would anybody like to contribute a patch?

--
nosy: +loewis

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3351] Python crashed

2008-07-13 Thread Martin v. Löwis

Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

This is a Linux kernel crash, and has nothing to do with Python. No
matter what errors Python or your script may have - the operating system
kernel should not crash.

Please report this in a Linux forum, or try to upgrade to a newer kernel.

--
nosy: +loewis
resolution:  -> invalid
status: open -> closed
versions: +3rd party -Python 2.5

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3351] Python crashed

2008-07-13 Thread yiyuan

New submission from yiyuan <[EMAIL PROTECTED]>:

Hi,

I'm new here and I'm not sure whether this should be reported here.

OS: CentOS 2.6.9-67.0.15.EL
Memory: 512M
Python Version: 2.5.1

The crash happened after our web program writen with python running for
many days (maybe 20 days).

Here are the logs I found in /var/log/messages

Jul 14 04:30:38  kernel: Unable to handle kernel NULL pointer
dereference at virtual address 0002
Jul 14 04:30:38  kernel:  printing eip:
Jul 14 04:30:38  kernel: 0002
Jul 14 04:30:38  kernel: *pde = 0c223067
Jul 14 04:30:38  kernel: Oops:  [#1]
Jul 14 04:30:38  kernel: Modules linked in: ipt_state ipt_TOS
iptable_mangle ip_conntrack_ftp ip_conntrack_irc ip_conntrack ipt_REJECT
ipt_LOG ipt_limit iptable_filter ipt_multiport ip_tables autofs4 sunrpc
loop dm_mirror dm_mod ohci_hcd ehci_hcd k8_edac edac_mc snd_atiixp
snd_ac97_codec snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd soundcore
snd_page_alloc tg3 floppy ext3 jbd sata_sil libata sd_mod scsi_mod
Jul 14 04:30:38  kernel: CPU:0
Jul 14 04:30:38  kernel: EIP:0060:[<0002>]Not tainted VLI
Jul 14 04:30:38  kernel: EFLAGS: 00010202   (2.6.9-67.0.15.EL) 
Jul 14 04:30:38  kernel: EIP is at 0x2
Jul 14 04:30:38  kernel: eax: c11bf760   ebx: c11bf760   ecx: c11bf760 
 edx: 0002
Jul 14 04:30:38  kernel: esi:    edi: c000   ebp: c5a2e1a8 
 esp: c7198ecc
Jul 14 04:30:38  kernel: ds: 007b   es: 007b   ss: 0068
Jul 14 04:30:38  kernel: Process python (pid: 16598, threadinfo=c7198000
task=c8cccbd0)
Jul 14 04:30:38  kernel: Stack: c01514ee c015ab59 0dfbb067 0008
1ec5e000 c0411074 1ec5e000 1ecde000 
Jul 14 04:30:38  kernel:d3a2e1f0 c0411074 c015ac29 0008
 1ec5e000 d3a2e1f0 1ecde000 
Jul 14 04:30:38  kernel:c0411074 c015ac88 0008 
c7198f7c 1ec5e000 cd708b4c 1edac000 
Jul 14 04:30:38  kernel: Call Trace:
Jul 14 04:30:38  kernel:  [] set_page_dirty+0x2c/0x41
Jul 14 04:30:38  kernel:  [] zap_pte_range+0x191/0x21f
Jul 14 04:30:38  kernel:  [] zap_pmd_range+0x42/0x65
Jul 14 04:30:38  kernel:  [] unmap_page_range+0x3c/0x5f
Jul 14 04:30:38  kernel:  [] unmap_vmas+0xf1/0x1df
Jul 14 04:30:38  kernel:  [] unmap_region+0x61/0xc6
Jul 14 04:30:38  kernel:  [] do_munmap+0x144/0x1b1
Jul 14 04:30:38  kernel:  [] sys_munmap+0x51/0x68
Jul 14 04:30:38  kernel:  [] syscall_call+0x7/0xb
Jul 14 04:30:38  kernel: Code:  Bad EIP value.
Jul 14 04:30:38  kernel:  <0>Fatal exception: panic in 5 seconds
Jul 14 04:30:38  kernel: bad: scheduling while atomic!
Jul 14 04:30:38  kernel:  [] schedule+0x2d/0x606
Jul 14 04:30:38  kernel:  [] schedule_timeout+0x158/0x17c
Jul 14 04:30:38  kernel:  [] process_timeout+0x0/0x13
Jul 14 04:30:38  kernel:  [] printk+0xe/0x11
Jul 14 04:30:38  kernel:  [] die+0x21a/0x22b
Jul 14 04:30:38  kernel:  [] do_page_fault+0x380/0x4dc
Jul 14 04:30:38  kernel:  [] buffered_rmqueue+0x1c4/0x1e7
Jul 14 04:30:38  kernel:  [] __alloc_pages+0xb4/0x2a6
Jul 14 04:30:38  kernel:  [] do_page_fault+0x0/0x4dc
Jul 14 04:30:38  kernel:  [] error_code+0x2f/0x38
Jul 14 04:30:38  kernel:  [] set_page_dirty+0x2c/0x41
Jul 14 04:30:38  kernel:  [] zap_pte_range+0x191/0x21f
Jul 14 04:30:38  kernel:  [] zap_pmd_range+0x42/0x65
Jul 14 04:30:38  kernel:  [] unmap_page_range+0x3c/0x5f
Jul 14 04:30:38  kernel:  [] unmap_vmas+0xf1/0x1df
Jul 14 04:30:38  kernel:  [] unmap_region+0x61/0xc6
Jul 14 04:30:38  kernel:  [] do_munmap+0x144/0x1b1
Jul 14 04:30:38  kernel:  [] sys_munmap+0x51/0x68
Jul 14 04:30:38  kernel:  [] syscall_call+0x7/0xb

What caused this problem? Run out of memory? Please tell me what I can do.

Regards

YiYuan

--
components: Interpreter Core
messages: 69640
nosy: yiyuan
severity: normal
status: open
title: Python crashed
type: crash
versions: Python 2.5

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3299] invalid object destruction in re.finditer()

2008-07-13 Thread STINNER Victor

STINNER Victor <[EMAIL PROTECTED]> added the comment:

About _curses_panel.patch: same as pyobject_del.patch, i didn't tested 
the code, and is looks like PyCursesPanel_Dealloc() expects that the 
object is properly initialized.

It looks like this bug (invalid use of PyObject_Del/PyObject_DEL) is 
not an easy job and may changes many lines of code to fix it. Instead 
of replacing PyObjectDel/PyObjectDEL by Py_DECREF, another solution 
would be to patch PyObjectDel/PyObjectDEL for the case when 
Py_TRACE_REFS is defined (and then call _Py_ForgetReference()).

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3299] invalid object destruction in re.finditer()

2008-07-13 Thread STINNER Victor

STINNER Victor <[EMAIL PROTECTED]> added the comment:

Other examples of invalid use of PyObject_Del().

Don't apply the patch, i didn't check it. Eg. element_dealloc() should 
crash if self->tag is NULL... and at line 331, self->tag is NULL 
whereas I called element_dealloc() using Py_DECREF()!

Added file: http://bugs.python.org/file10893/pyobject_del.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3299] invalid object destruction in re.finditer()

2008-07-13 Thread STINNER Victor

Changes by STINNER Victor <[EMAIL PROTECTED]>:


Added file: http://bugs.python.org/file10892/_curses_panel.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3299] invalid object destruction in re.finditer()

2008-07-13 Thread STINNER Victor

Changes by STINNER Victor <[EMAIL PROTECTED]>:


Removed file: http://bugs.python.org/file10828/re_finditer.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3299] invalid object destruction in re.finditer()

2008-07-13 Thread STINNER Victor

STINNER Victor <[EMAIL PROTECTED]> added the comment:

F*ck, Firefox just crashed! I have to rewrite my long comment...

First, to explain why the problem only occurs in pydebug mode: a 
PyObject has only _ob_next and _ob_prev attributes if Py_TRACE_REFS is 
set (eg. by pydebug). PyObject_NEW() and PyObject_NEW_VAR() call 
PyObject_Init() which register the new object to the object list, 
whereas PyObject_DEL() only free the memory.

PyObject_DEL() doesn't the dealloc() method nor removing the object 
from the object list. So Py_DECREF() should be used instead: it calls 
the dealloc method and remove the object from the object list.

PyObject_DEL() is misused in _sre and in curses modules. See attached 
patches.

Added file: http://bugs.python.org/file10891/_sre-2.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3299] invalid object destruction in re.finditer()

2008-07-13 Thread STINNER Victor

STINNER Victor <[EMAIL PROTECTED]> added the comment:

Valgrind output for Python trunk compiled with pydebug option:
==29848== Invalid read of size 4
==29848==at 0x809AF61: _Py_ForgetReference (object.c:2044)
==29848==by 0x809AFCF: _Py_Dealloc (object.c:2065)
==29848==by 0x80FE635: call_function (ceval.c:3653)
==29848==by 0x80F9C83: PyEval_EvalFrameEx (ceval.c:2350)
==29848==by 0x80FC2D1: PyEval_EvalCodeEx (ceval.c:2914)
==29848==by 0x80FEAFE: fast_function (ceval.c:3747)
==29848==by 0x80FE75F: call_function (ceval.c:3672)
==29848==by 0x80F9C83: PyEval_EvalFrameEx (ceval.c:2350)
==29848==by 0x80FC2D1: PyEval_EvalCodeEx (ceval.c:2914)
==29848==by 0x80F1219: PyEval_EvalCode (ceval.c:495)
==29848==by 0x812838E: run_mod (pythonrun.c:1330)
==29848==by 0x8128324: PyRun_FileExFlags (pythonrun.c:1316)
==29848==  Address 0x4475680 is 8 bytes inside a block of size 896 free'd
==29848==at 0x402237F: free (vg_replace_malloc.c:233)
==29848==by 0x809C51D: PyObject_Free (obmalloc.c:1114)
==29848==by 0x809C86E: _PyObject_DebugFree (obmalloc.c:1361)
==29848==by 0x814ECBD: pattern_scanner (_sre.c:3371)
==29848==by 0x814C245: pattern_finditer (_sre.c:2148)
==29848==by 0x81708D6: PyCFunction_Call (methodobject.c:81)
==29848==by 0x80FE5C9: call_function (ceval.c:3651)
==29848==by 0x80F9C83: PyEval_EvalFrameEx (ceval.c:2350)
==29848==by 0x80FC2D1: PyEval_EvalCodeEx (ceval.c:2914)
==29848==by 0x80FEAFE: fast_function (ceval.c:3747)
==29848==by 0x80FE75F: call_function (ceval.c:3672)
==29848==by 0x80F9C83: PyEval_EvalFrameEx (ceval.c:2350)
Fatal Python error: UNREF invalid object

The error comes from invalid use of PyObject_DEL(): as said by
georg.brandl, "PyObject_NEW adds the
object to the global linked list of all objects, which PyObject_DEL
obviously doesn't undo". An invalid object will stay in the object list
until it is used and then Python crash.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3218] 2to3 Fix_imports optimization

2008-07-13 Thread Collin Winter

Collin Winter <[EMAIL PROTECTED]> added the comment:

fix_imports.diff fails to apply cleanly against HEAD of fix_imports.py.
Also, fix_imports2 now inherits from fix_imports, so it needs to be
fixed as well.


+ yield """power< module_name=%r 
+  trailer<'.' import_as_names< any > > any* >
+   """ % old_module

Why are you using import_as_names here? That's meant to match a series
of "NAME [as NAME]" in import statements, where this part of the pattern
is meant to match usages of "urllib.foo()" in the code.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue2874] Remove use of the stat module in the stdlib

2008-07-13 Thread Brett Cannon

Brett Cannon <[EMAIL PROTECTED]> added the comment:

I just finished taking Georg's idea and fleshing it out. Problem is that
when I went to change the docs for 'stat', I noticed how many other
function in the os module rely on the stat module for its constants.
Should we move the constants over to the os module? Add an os.stats
module? Or only deprecate the functions?

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3182] 2to3 Slight Patch

2008-07-13 Thread Nick Edds

Nick Edds <[EMAIL PROTECTED]> added the comment:

Fair enough. I guess that even though there's a little bit of a
performance improvement from this, it does hurt extensibility, so its
probably not a worthwhile change after all.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3182] 2to3 Slight Patch

2008-07-13 Thread Collin Winter

Collin Winter <[EMAIL PROTECTED]> added the comment:

So, revisiting this...

On the face of it, I'm not convinced that the isinstance(x, Leaf) ->
type(x) is Leaf changes are correct: certain fixers have in the past
utilized their own subclasses of Node, and I can foresee this being done
again in the future. Reverting those changes seems to remove the speedup
you observed.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3218] 2to3 Fix_imports optimization

2008-07-13 Thread Benjamin Peterson

Changes by Benjamin Peterson <[EMAIL PROTECTED]>:


--
priority:  -> high

___
Python tracker <[EMAIL PROTECTED]>

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



[issue2874] Remove use of the stat module in the stdlib

2008-07-13 Thread Brett Cannon

Brett Cannon <[EMAIL PROTECTED]> added the comment:

On Sun, Jul 13, 2008 at 4:04 PM, Brett Cannon <[EMAIL PROTECTED]> wrote:
>
> Brett Cannon <[EMAIL PROTECTED]> added the comment:
>
> Another option is to eliminate the use of PyStructSequence and handle
> the creation of a named tuple and a class with the methods in os.py.
> Then stat() can just return a tuple and the Python code can create the
> instances from that.
>

Although I noticed that what fields are available are affected by
compile-time info, so that might not be the best solution.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue2874] Remove use of the stat module in the stdlib

2008-07-13 Thread Brett Cannon

Brett Cannon <[EMAIL PROTECTED]> added the comment:

Another option is to eliminate the use of PyStructSequence and handle
the creation of a named tuple and a class with the methods in os.py.
Then stat() can just return a tuple and the Python code can create the
instances from that.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue2885] Create the urllib package

2008-07-13 Thread Brett Cannon

Changes by Brett Cannon <[EMAIL PROTECTED]>:


--
dependencies: +Proposal for fix_urllib

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3208] function annotation for builtin and C function

2008-07-13 Thread Alexandre Vassalotti

Alexandre Vassalotti <[EMAIL PROTECTED]> added the comment:

Extension modules can use PyFunction_GetAnnotations() to access and
modify the annotations dictionary. In addition,
PyFunction_SetAnnotations() can be used to add annotations.

I added some documentation for these functions in r64934.

--
nosy: +alexandre.vassalotti
resolution:  -> works for me
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3153] sqlite leaks on error

2008-07-13 Thread Alexandre Vassalotti

Alexandre Vassalotti <[EMAIL PROTECTED]> added the comment:

Fixed in r64930 (trunk) and r64931 (py3k). Thanks.

--
nosy: +alexandre.vassalotti
resolution:  -> fixed
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread Martin v. Löwis

Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

> don't u think that possibly merits its mention in the 2to3 category?

Please trust our judgment on how to use the bug tracker. This isn't a
competition for publicity; it's a tool to help organizing work among
committers and other contributors.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3221] SystemError: Parent module 'foo' not loaded on import statement

2008-07-13 Thread Ralf Schmitt

Ralf Schmitt <[EMAIL PROTECTED]> added the comment:

Thanks Nick for fixing this in a timely manner.
BTW I've seen this when trying to run doctests with py.test.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3326] py3k shouldn't use -fno-strict-aliasing anymore

2008-07-13 Thread Ismail Donmez

Ismail Donmez <[EMAIL PROTECTED]> added the comment:

Wow thats no good, I will test with -fstrict-aliasing to be sure, if there 
are such problems still we should start with fixing those towards 3.1 .

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread kai zhu

kai zhu <[EMAIL PROTECTED]> added the comment:

then the 2 can complement each other well ;) i don't c any competition
between them as they have completely different objectives

2to3 -> convert 2x scripts to 3k
py3to2 <- use the newly created 3k scripts in existing 2x environ

u have to admit migrating to 3k is quite painful & slow
w/ its lack of 2x's vast extension base. given py3to2's potential to
alleviate this problem for migrating developers,
don't u think that possibly merits its mention in the 2to3 category?

btw, py3to2's patches minimally affects 2.x compatibility:
  ceval.c - backports missing 3.0 opcodes (8 in python 2.5.2)
  bltinmodule.c - backports missing 3.0 function __build_class__
  import.c - adds a 5 line hook to function parse_source_module
 allowing automatic checking for and compiling of 3k scripts
 during import/reload

i just ran 'make test' w/ a patched build of python 2.5.2 w/ following
results on redhat, x86_64:
285 tests OK.
37 tests skipped:
test_aepack test_al test_applesingle test_bsddb185 test_bsddb3
test_cd test_cl test_codecmaps_cn test_codecmaps_hk
test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_curses
test_dl test_gdbm test_gl test_imageop test_imgfile
test_linuxaudiodev test_macfs test_macostools test_normalization
test_ossaudiodev test_pep277 test_plistlib test_rgbimg
test_scriptpackages test_socket_ssl test_socketserver
test_startfile test_sunaudiodev test_timeout test_urllib2net
test_urllibnet test_winreg test_winsound test_zipfile64
1 skip unexpected on linux2:
test_gdbm

not bad considering it now supports 11 of the 18 (soon to b 12 & likely
more...) 3000 series pep's ^_^

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3326] py3k shouldn't use -fno-strict-aliasing anymore

2008-07-13 Thread Alexandre Vassalotti

Alexandre Vassalotti <[EMAIL PROTECTED]> added the comment:

With gcc 4.2.3, I see a whole bunch of warnings:

Objects/exceptions.c: In function ‘UnicodeDecodeError_init’:
Objects/exceptions.c:1472: warning: dereferencing type-punned pointer
will break strict-aliasing rules

Objects/frameobject.c: In function ‘frame_setlineno’:
Objects/frameobject.c:151: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicode_DecodeUTF7Stateful’:
Objects/unicodeobject.c:1804: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:1815: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:1827: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicodeUCS2_DecodeUTF8Stateful’:
Objects/unicodeobject.c:2140: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:2147: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicodeUCS2_DecodeUTF32Stateful’:
Objects/unicodeobject.c:2419: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:2419: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:2420: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:2431: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicodeUCS2_DecodeUTF16Stateful’:
Objects/unicodeobject.c:2693: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:2693: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:2694: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:2705: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicodeUCS2_DecodeUnicodeEscape’:
Objects/unicodeobject.c:2911: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:2923: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:2962: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:3004: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:3018: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:3030: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicodeUCS2_DecodeRawUnicodeEscape’:
Objects/unicodeobject.c:3295: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:3327: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘_PyUnicode_DecodeUnicodeInternal’:
Objects/unicodeobject.c:3502: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:3512: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicodeUCS2_DecodeASCII’:
Objects/unicodeobject.c:3875: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:3880: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicodeUCS2_DecodeCharmap’:
Objects/unicodeobject.c:4176: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:4226: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:4249: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:4276: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicodeUCS2_Join’:
Objects/unicodeobject.c:5724: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:5745: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c: In function ‘PyUnicodeUCS2_Format’:
Objects/unicodeobject.c:8841: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:9158: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Objects/unicodeobject.c:9223: warning: dereferencing type-punned pointer
will break strict-aliasing rules
Python/bltinmodule.c: In function ‘source_as_string’:
Python/bltinmodule.c:513: warning

[issue3112] implement PEP 3134 exception reporting

2008-07-13 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Here is a new patch incorporating Amaury's better indentation fix for
tracebacks. It should be ready for consumption (all the tests pass).

And for the code review junkies: http://codereview.appspot.com/2448

Added file: http://bugs.python.org/file10890/exc_reporting2.patch

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3274] Py_CLEAR(tmp) seg faults

2008-07-13 Thread Alexandre Vassalotti

Alexandre Vassalotti <[EMAIL PROTECTED]> added the comment:

Committed the fix r64927. Thanks.

--
nosy: +alexandre.vassalotti
resolution:  -> fixed
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3119] pickle.py is limited by python's call stack

2008-07-13 Thread Alexandre Vassalotti

Alexandre Vassalotti <[EMAIL PROTECTED]> added the comment:

On some benchmark of my own, I get a good 2x slowdown when this patch is
applied. The benchmark consists of loading ~1.4 millions objects (mostly
dict, list, str and int) from a pickle string. It is basically a torture
test for the inner function calls overhead.

Anyway, the slowdown doesn't bother me much. I think a "stackless"
pickle module would be well appreciated by many Python users. 

There is a few things that stops me from applying this patch. First, the
patch will break subclasses of Pickler that relies on the save() method
(Although the method is an implementation detail that shouldn't used).
Therefore, any patches that modifies the API of save() is straight out
for 2.x. And for Python 3.0, your patch should also remove recursion
from the _pickle module (the transparent C accelerator for pickle).

--
nosy: +alexandre.vassalotti

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

On Sun, Jul 13, 2008 at 2:03 PM, kai zhu <[EMAIL PROTECTED]> wrote:
>
> kai zhu <[EMAIL PROTECTED]> added the comment:
>
> why not?  it allows developers to migrate 2.x scripts one-by-one to
> working 3.0 conformant ones while maintaining backwards-compatibility w/
> existing 2.x scripts & extension modules (eg. numpy, PIL, zope, ...)
>
> py3to2 can transparently import & mix & match 2.x & 3.0 scripts (but
> builtins/extensions must b 2.x - hence its a 2to3 migration tool).

Yes, I realize that, but there is another tool called 2to3 that
preforms syntax transformations on 2.x code. That's what the "2to3
conversion" tool component is for.

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread kai zhu

kai zhu <[EMAIL PROTECTED]> added the comment:

why not?  it allows developers to migrate 2.x scripts one-by-one to
working 3.0 conformant ones while maintaining backwards-compatibility w/
existing 2.x scripts & extension modules (eg. numpy, PIL, zope, ...)

py3to2 can transparently import & mix & match 2.x & 3.0 scripts (but
builtins/extensions must b 2.x - hence its a 2to3 migration tool).

@ the moment, every script compilable by py3to2 should b 3.0 language
conformant, or otherwise it would fail the syntax check & byte-compile
stage performed by the python 3.0 slave interpreter (see Mechanism for
details).

--
components: +None
nosy: +benjamin.peterson

___
Python tracker <[EMAIL PROTECTED]>

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



[issue2534] Restore isinstance and issubclass speed in 2.6

2008-07-13 Thread Gregory P. Smith

Gregory P. Smith <[EMAIL PROTECTED]> added the comment:

speedup of this patch confirmed.  Also, it triggers the bugs mentioned
that have their own issues open.  Once #2542 is fixed this should be
looked at again.

Its a big performance regression in 2.6 over 2.5 if we don't get this
in, marking it critical.

--
dependencies: +PyErr_ExceptionMatches must not fail
nosy: +gregory.p.smith
priority:  -> critical
title: Speed up isinstance and issubclass -> Restore isinstance and issubclass 
speed in 2.6

___
Python tracker <[EMAIL PROTECTED]>

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



[issue2303] isinstance is 4x as slow as in 2.5 because the common case raises

2008-07-13 Thread Gregory P. Smith

Gregory P. Smith <[EMAIL PROTECTED]> added the comment:

% ./python.exe -mtimeit 'isinstance(3, int)'
100 loops, best of 3: 0.269 usec per loop
% ../release25-maint/python.exe -mtimeit 'isinstance(3, int)'100
loops, best of 3: 0.335 usec per loop

So I'd say its no longer 4x slower these days.

Looking at the Object/abstract.c it appears the fix to this has already
been checked in.  PyObject_IsInstance already has this in it:

/* Quick test for an exact match */
if (Py_TYPE(inst) == (PyTypeObject *)cls)
return 1;

closing.

--
nosy: +gregory.p.smith
resolution:  -> accepted
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3350] multiprocessing adds built-in types to the global copyreg.dispatch_table

2008-07-13 Thread Benjamin Peterson

Changes by Benjamin Peterson <[EMAIL PROTECTED]>:


--
assignee:  -> jnoller
nosy: +jnoller

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3350] multiprocessing adds built-in types to the global copyreg.dispatch_table

2008-07-13 Thread Alexandre Vassalotti

New submission from Alexandre Vassalotti <[EMAIL PROTECTED]>:

The multiprocessing module modifies the global copyreg.dispatch_table to
extend pickling to several built-in types (mostly callable types). In my
humble opinion, this is unacceptable for a standard library module.

Here is an example of a behaviour change made by multiprocessing:

  >>> import pickle
  >>> pickle.dumps(str.isalpha)
  Traceback (most recent call last):
...
  _pickle.PicklingError: Can't pickle :
attribute lookup builtins.method_descriptor failed
  >>> import multiprocessing.util
  >>> pickle.dumps(str.isalpha)
 
b'\x80\x03cbuiltins\ngetattr\nq\x00cbuiltins\nstr\nq\x01X\x07\x00\x00\x00isalphaq\x02\x86q\x03Rq\x04.'

There was some discussion in issue 558238 about allowing methods to be
pickled. However, no consensus was reached.

In addition, there is a bug in the method pickling support added by
multiprocessing in Python 3.0:

  Python 2.6b1+ (trunk:64899:64900, Jul 13 2008, 13:33:02) 
  [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import multiprocessing.util, pickle
  >>> class A(object):
  ...   def foo(self): pass
  ... 
  >>> pickle.dumps(A().foo, 2)
 
'\x80\x02c__builtin__\ngetattr\nq\x00c__main__\nA\nq\x01)\x81q\x02}q\x03bU\x03fooq\x04\x86q\x05Rq\x06.'
  >>> pickle.dumps(A.foo, 2)
 
'\x80\x02c__builtin__\ngetattr\nq\x00c__main__\nA\nq\x01U\x03fooq\x02\x86q\x03Rq\x04.'
  
  Python 3.0b1+ (py3k:64876M, Jul 11 2008, 12:20:51) 
  [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import multiprocessing.util, pickle
  >>> class A(object):
  ...   def foo(self): pass
  ... 
  >>> pickle.dumps(A().foo, 2)
  Traceback (most recent call last):
...
  pickle.PicklingError: Can't pickle : it's not found as
builtins.method
  >>> pickle.dumps(A.foo, 2)
  Traceback (most recent call last):
...
  pickle.PicklingError: Can't pickle : it's
not found as __main__.foo

A better solution for the interprocess communication needs of
multiprocessing would be to define custom subclass of Pickler with
extended support for built-in types. If needed, I am willing to extend
the _pickle module in Python 3.0 to support modification to its
"dispatch table", like the undocumented dispatch_table attribute in
pickle.Pickler.

--
components: Library (Lib)
messages: 69615
nosy: alexandre.vassalotti
priority: normal
severity: normal
status: open
title: multiprocessing adds built-in types to the global copyreg.dispatch_table
type: behavior
versions: Python 2.6, Python 3.0

___
Python tracker <[EMAIL PROTECTED]>

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



[issue616013] cPickle documentation incomplete

2008-07-13 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

+1 to backporting _pickle as cPickle. Do bring it up on python-dev.

--
nosy: +benjamin.peterson

___
Python tracker <[EMAIL PROTECTED]>

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



[issue616013] cPickle documentation incomplete

2008-07-13 Thread Alexandre Vassalotti

Alexandre Vassalotti <[EMAIL PROTECTED]> added the comment:

Is this still desired? If so, I have fairly long list of differences
that I could document. Or maybe, I could backport the _pickle module to
Python 2.6, which doesn't have as many differences.

--
nosy: +alexandre.vassalotti

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread Benjamin Peterson

Changes by Benjamin Peterson <[EMAIL PROTECTED]>:


--
nosy:  -benjamin.peterson

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

This isn't dealing with the 2to3 conversion tool. Please do not add it.

--
assignee: collinwinter -> 
components:  -2to3 (2.x to 3.0 conversion tool), Tests
nosy: +benjamin.peterson

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread kai zhu

kai zhu <[EMAIL PROTECTED]> added the comment:

import/reload now works.
accomplished by adding 5 lines in parse_source_module (import.c) to 1st
check for the hook __builtins__.parse_source_module_py3k.
the hook will automatically compile in py3k format if it finds the magic
comment: "# import as py3k\n"

* below is a working python 3.0 script integrated w/ numpy.

also added:
  pep3102  Keyword-Only Arguments
  pep3112  Bytes literals in Python 3000

download: http://www-rcf.usc.edu/~kaizhu/work/py3to2/current/

patched files:
  ceval.c (unchanged from last)
  bltinmodule.c (unchanged from last)
  import.c (added 5 continuous lines to parse_source_module)

there r 7 unimplemented pep's remaining: any suggested solutions?
  pep3107  Function Annotations (easy, just haven't gotten around yet)
  pep3109/3110  Exceptions in Python 3000 (hard?)
  pep3120  Using UTF-8 as the default source encoding
  pep3123  Making PyObject_HEAD conform to C (hard/who cares for 2.x?)
  pep3131  Supporting Non-ASCII Identifiers (looks emulable)
  pep3138  String representation in Python 3000

@ any rate, i think its feature complete enough to b useful in certain
areas (for me its scientific computing).


"""
numpy_py3k.py
this is a py3to2 demo showing a python3.0 script being run under python
2.5 &
utilizing numpy, a python2.5 extension module.

add the magic comment '# import as py3k\n' to import / reload a script
in py3k format

interactive usage:
>>> import py3to2
>>> import numpy_py3k
>>> reload(numpy_py3k)

commandline usage: python -c 'import py3to2; import numpy_py3k'
"""

# import as py3k
import numpy

print('pep3102  Keyword-Only Arguments')
# nth order polynomial fit of multiple y data
def polyfits(nth, x, *ys, rcond = None, full = False):
  return [numpy.polyfit(x, y, nth, rcond, full) for y in ys]

fits = polyfits(2, # 2nd order fit
numpy.arange(16), # x data
numpy.random.rand(16), numpy.random.rand(16), # multiple
y data
rcond = numpy.MachAr().eps, # precision
full = False, # return only coeffs
)
print('fits', fits); print('#'*64)

print('pep3112  Bytes literals in Python 3000')
x = bytes( numpy.arange(256, dtype = numpy.int8).tostring() )
print('bytes', x); print('#'*64)

print('pep3114  Renaming iterator.next() to .__next__()')
x = (x for x in numpy.arange(16))
print('x.__next__()', x.__next__(), x.__next__(), x.__next__());
print('#'*64)

print('pep3132  Extended Iterable Unpacking')
a,b,*c = numpy.random.rand(4)
print('a = %s, b = %s, c = %s'%(a,b,c)); print('#'*64)


--
assignee:  -> collinwinter
components: +2to3 (2.x to 3.0 conversion tool), Demos and Tools, Interpreter 
Core, Tests -None

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3221] SystemError: Parent module 'foo' not loaded on import statement

2008-07-13 Thread Nick Coghlan

Nick Coghlan <[EMAIL PROTECTED]> added the comment:

Fixed in r64915.

The end result is that the import system now only emits a RuntimeWarning
instead of raising SystemError if it can't find the parent module when
attempting to perform an absolute import (regardless of whether the
parent module name was derived from __package__ or from __name__).
Explicit relative imports will still fail if __package__ is set
incorrectly and setting __package__ to a non-string value will still
result in a ValueError.

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

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3106] speedup some comparisons

2008-07-13 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Raymond, would you want to take a look?

--
nosy: +rhettinger

___
Python tracker <[EMAIL PROTECTED]>

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



[issue3008] Let bin/oct/hex show floats

2008-07-13 Thread Raymond Hettinger

Raymond Hettinger <[EMAIL PROTECTED]> added the comment:

So far this looks good.  Will complete the review on the next leg of my 
flight (about 12 hrs).

___
Python tracker <[EMAIL PROTECTED]>

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