[egenix-users] mx.TextTools - pickling bug with UnicodeTagTable?

Frank McIngvale fmcingvale at gmail.com
Thu Aug 2 12:20:51 CEST 2007


On 8/2/07, M.-A. Lemburg <mal at egenix.com> wrote:
>
> On 2007-08-02 17:52, Frank McIngvale wrote:
> > On 8/2/07, M.-A. Lemburg <mal at egenix.com> wrote:
> >> On 2007-08-02 17:08, Frank McIngvale wrote:
> >>> Hi, there seems to be a bug in pickling tag tables:
> >>>
> >>> This works fine:
> >>>
> >>> tags = (
> >>>     (None, Is, 'a'),
> >>>     )
> >>>
> >>> t = TagTable(tags)
> >>> print type(t)
> >>> s = pickle.dumps(t)
> >>> print pickle.loads(s)
> >>>
> >>> But this crashes ...
> >>>
> >>> tags = (
> >>>     (None, Is, u'\u03a3'),
> >>>     )
> >>>
> >>> t = UnicodeTagTable(tags)
> >>> print type(t)
> >>> s = pickle.dumps(t)
> >>> print pickle.loads(s)
> >> On which platform do you get this ?
> >
> >
> > WinXP with:
> > "Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
> > (Intel)] on win32"
> >
> > mx.__version__ = '3.0'
> >
> > Unfortunately there is no message from Python, just a popup box that
> says
> > the program crashed.
>
> Thanks. I can replicate the problem on Linux x64 as well. The fix is
> easy:
>
>
Which then lets the error message get through:
>
> Traceback (most recent call last):
>   File "testPickleSegFault.py", line 24, in ?
>     print pickle.loads(s)
>   File "/usr/local/python-2.4-ucs2/lib/python2.4/pickle.py", line 1394,
> in loads
>     return Unpickler(file).load()
>   File "/usr/local/python-2.4-ucs2/lib/python2.4/pickle.py", line 872,
> in load
>     dispatch[key](self)
>   File "/usr/local/python-2.4-ucs2/lib/python2.4/pickle.py", line 1153,
> in load_reduce
>     value = func(*args)
>   File "/home/lemburg/projects/mx/TextTools/__init__.py", line 17, in _TT
>     return TagTable(definition)
> TypeError: tag table entry 0: conversion from Unicode to string failed
>
> I've never tried to pickle tag tables before :-) What's the use
> case for this ?


I'm adding/updating the support for mx.* types in xml.pickle (Gnosis_Utils)
getting ready for a new release, and am including all types that have a
copy_reg() in mx.*. But I suppose if no one has hit this before then I don't
need to worry about it :-)

thanks,
frank

--
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source  (#1, Aug 02 2007)
> >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
> >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
>
> :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
>
>
>    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>            Registered at Amtsgericht Duesseldorf: HRB 46611
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman-archives/egenix-users/attachments/20070802/a5fdb0f6/attachment.htm


More information about the egenix-users mailing list