[issue13842] Cannot pickle Ellipsis or NotImplemented

2012-01-23 Thread James Sanders

New submission from James Sanders :

At present, the built-in constants Ellipsis (...) and NotImplemented cannot be 
pickled.  Perhaps there is a good reason for this, but the only discussion I 
can find is at msg<108957>, where it is stated that these values (along with 
their types, and type(None)) cannot be pickled.

I ran across this in a class that keeps track of numpy-style slicing 
operations, and so sometimes stores references to Ellipsis.  While this is easy 
to work around, it does seem a little surprising that ... cannot be pickled, 
when slice objects can be.  I don't know if there is a likely use for pickling 
NotImplemented.

If this is not changed, perhaps it could be explicitly stated in the 
documentation that these objects cannot be pickled?

--
messages: 151838
nosy: James.Sanders, alexandre.vassalotti, pitrou
priority: normal
severity: normal
status: open
title: Cannot pickle Ellipsis or NotImplemented
type: enhancement
versions: Python 3.3

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



[issue13842] Cannot pickle Ellipsis or NotImplemented

2012-01-24 Thread James Sanders

James Sanders  added the comment:

I've submitted a patch that just uses save_global to pickle Ellipsis and 
NotImplemented, so the resulting pickle should be unpicklable anywhere.  I'm 
completely new to the C API so not sure if the way I am building python strings 
(to pass to save_global) is correct, but it seems to work.

--
keywords: +patch
Added file: 
http://bugs.python.org/file24315/pickling_ellipsis_notimplemented.patch

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



[issue5527] multiprocessing won't work with Tkinter (under Linux)

2013-08-10 Thread James Sanders

James Sanders added the comment:

I recently got hit by this bug on 64-bit ubuntu 13.04, with python 3.3.1 and 
tcl/tk 8.5.13 installed from the Ubuntu repositories.  However, I tried 
building the same versions of tcl, tk, and python locally, and couldn't 
reproduce the bug.  I also built python 3.3.2 with several releases of tcl/tk.  
With 8.5.8 and earlier, I get a buffer overflow.  With 8.5.9-14 and recent 
trunk versions of tk and tcl, everything works.  With 8.6.0, I get the hang.

In the tcl/tk versions where the script works correctly, if I also have some 
tkinter code (such as instantiating a Tk and a Button) in the main process 
before the fork, then I sometimes get a crash with one of several different 
weird error messages from X, but this is very inconsistent.

The direct cause of the bug seems to be the call to Tcl_FindExecutable in 
_tkinter's initialization code, which tells tcl the path of the python 
executable, but as a side effect triggers tcl into running some initialization 
routines earlier than it would do otherwise.  Removing this call (which doesn't 
seem to have any adverse effects on my system) appears to "fix" the bug, but if 
anything else triggers tcl's initialization code before the fork (such as 
instantiating a tkinter.Tk object), the hang returns.

I'm not really sure where else to go with this.  I've attached a simplified 
python-3-compatible script displaying the problem in case someone else wants to 
have a look.

--
nosy: +James.Sanders
versions: +Python 2.7, Python 3.3, Python 3.4 -Python 2.6
Added file: http://bugs.python.org/file31222/hanger.py

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



[issue5527] multiprocessing won't work with Tkinter (under Linux)

2013-08-17 Thread James Sanders

James Sanders added the comment:

I did a bit more digging and I think I've worked out what is going on.  The 
particular bit of tcl initialization code that triggers the problem if it is 
run before the fork is Tcl_InitNotifier in tclUnixNotify.c.  It turns out there 
is a known problem with this bit of tcl not being process-safe if tcl was built 
with threading support (this is discussed at 
https://bugs.archlinux.org/task/16401, for example).

The bug doesn't show up in my 8.5 builds as threading support is off by 
default, though the debian/ubuntu packages apparently have it switched on.  
Threading was turned on by default in 8.6, but a recent change to 
tclUnixNotify.c (discussed at 
https://issues.apache.org/bugzilla/show_bug.cgi?id=55153#c13 - it should be 
included in 8.6.1 and 8.5.15) appears to have fixed the whole problem anyway.

So hopefully the bug should disappear entirely in future releases of tcl, but 
for now you can work around it by building tcl without threads, calling exec in 
between the fork and any use of tkinter in the child process, or not importing 
tkinter until after the fork.  I don't know if there should be a note about 
this somewhere in the tkinter docs?

--

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