[egenix-users] segfault in method .pydate() of DateTime
M.-A. Lemburg
mal at egenix.com
Fri Jan 27 13:13:00 CET 2012
M.-A. Lemburg wrote:
> Szoska, Daniel wrote:
>> Hello,
>>
>> Python dies with a segmentation fault, can someone reproduce this:
>>
>>>>> import mx.DateTime
>>>>> mx.DateTime.Date(2012, 1, 1).pydate()
>> segmentation fault
>>
>> This happens with .pydatetime() and .pytime() too.
>>
>> I tried it with Python 2.7.2, egenix-mx-base 3.2.2 under Linux, Max OS 10.7
>> and Windows XP.
>
> Thank you for reporting this.
>
> We have done some preliminary tests and it appears to be caused
> by the fact that mxDateTime uses a lazy import of the datetime
> module to implement interfacing with Python's datetime module
> types.
>
> The problem doesn't show up in the tests because the datetime
> module's C API is already initialized by the time the .pydate()
> (et al.) tests are run.
>
> We will issue a new patch level release to address the problem.
>
> Until then, please use the following trick to force initialization
> of the datetime C API in mxDateTime:
>
> # Trick to force initialization of the datetime C API in mxDateTime:
> import mx.DateTime
> import datetime
> mx.DateTime.today() == datetime.date.today()
>
> Background: The comparison causes a forced initialization.
Here's a patch which fixes the problem.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Jan 27 2012)
>>> 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 our new mxODBC.Connect Python Database Interface 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
http://www.egenix.com/company/contact/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: changeset_25267.diff
Type: text/x-patch
Size: 4997 bytes
Desc: not available
Url : /mailman-archives/egenix-users/attachments/20120127/0f28a8e1/changeset_25267.bin
More information about the egenix-users
mailing list