[ wxwindows-Bugs-888674 ] wx.Font + pickle = Bad Things(tm)

0 views
Skip to first unread message

SourceForge.net

unread,
Feb 1, 2004, 2:15:24 PM2/1/04
to nor...@sourceforge.net
Bugs item #888674, was opened at 2004-02-01 11:15
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=888674&group_id=9863

Category: wxPython specific
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Alex Stewart (foogod)
Assigned to: Robin Dunn (robind)
Summary: wx.Font + pickle = Bad Things(tm)

Initial Comment:
It appears that some of the classes in wxPython are not
pickle-safe, in rather spectacular ways.

I noticed that, for example, if you pickle a wx.Font
object, it stores the raw pointer string in the pickle
output. Moreover if this object is unpickled, the read
value is apparently not checked in any way whatsoever,
and you end up with a wx.Font object pointing to some
random point in memory instead of an actual underlying
(C++) wxFont instance.

So, in short, wx.Font + pickle + unpickle later =
segmentation fault. This seems bad to me.

I haven't actually checked, but I suspect this sort of
behavior may be true of many other wxPython objects as
well. Ideally, it'd be great if basic data-storage
types like wx.Font could save their state (via
GetFontInfoDesc, for example) to the pickle output and
reconstruct an equivalent object upon unpickling, but
at the very least I think objects which can't be safely
pickled (or more importantly, unpickled) should raise a
PicklingError instead of crashing Python.


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=888674&group_id=9863

Reply all
Reply to author
Forward
0 new messages