[reportlab-users] Chasing pyHnj error
Robin Becker
robin at reportlab.com
Sun Nov 25 05:15:24 EST 2007
Dinu Gherman wrote:
> Robin Becker:
>
>> for what it's worth I get this behaviour in win32
>>
>> c:\usr\home\robin>python -c "import pyHnj; pyHnj.Hyphen()"
>> Traceback (most recent call last):
>> File "<string>", line 1, in <module>
>> SystemError: error return without exception set
>>
>> so it's probably an error that is in the code now. It's probably an
>> allocation routine error; python became much stricter recently about
>> which allocation/free routines are used. We haven't been using pyHnj
>> at all, but it used to work so I suspect it's the environment that
>> changed. I'll take a look in the morning.
>
> These are two different errors we talk about. The SystemError you
> get on win32 and I get on a PowerBook is perhaps not the best name
> for an exception to raise (maybe IOError would be better). But what
> I get on a MacBook Pro is a Deallocation error (not a Python excep-
> tion) when terminating the script or calling
> pyHnj.Hyphen("hyphen.mashed").hyphenate() multiple times... It's the
> latter one that confuses me, because I'm getting it only on a (Intel)
> Mac Book Pro, but not on a (PowerPC) PowerBook.
>
> I would like to know if anybody else with an Intel Mac can reproduce
> this?
>
>........
The error when a bad file name is passed in (or the default fails) is
caused by failing to set an error message in the Hyphen function. The
error return also fails to remove the allocated memory.
I changed the code at line 222 so it looks like
if((self->hdict = hnj_hyphen_load(filename)) == NULL){
PyErr_Format(PyExc_IOError,"Failed to load hyphenization information
from \"%s\"", filename);
Py_DECREF(self);
return NULL;
}
that should clean up the allocation automatically. I have checked in
that version. See if it works.
--
Robin Becker
More information about the reportlab-users
mailing list