[Python-bugs-list] [ python-Bugs-508700 ] import of C-extension causes crash
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 29 Jan 2002 15:44:46 -0800
Bugs item #508700, was opened at 2002-01-25 14:11
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=508700&group_id=5470
Category: Threads
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Keith Farmer (deoradh)
Assigned to: Nobody/Anonymous (nobody)
Summary: import of C-extension causes crash
Initial Comment:
PythonWin 2.1 (#15, Apr 16 2001, 18:25:49)
Running on Win2k SP2 (both Pro and Server)
Source code for the extension is at
http://www.thuban.org/projects (see
AstroMath). (Zip file uploaded)
As suggested, I set up a couple threading/non-
threading tests outside of
Zope. Here are the results, and the sourcecode for
the scripts. My
guess now is that it's a Python error, or something
that I don't know
about how C-extensions behave under Python threads.
AstroMathTest.py -- threaded, import outside of the
thread run() method
AstroMathTest-2.py -- threaded, import inside the
thread run() method
AstroMathTest-3.py -- unthreaded, import outside of
the class
AstroMathTest.py triggers an abnormal termination
(when running under
Zope, this crashes the server). The others execute
normally.
----------
Keith J. Farmer
kfarmer@thuban.org
http://www.thuban.org
D:\Users\kfarmer\Desktop>AstroMathTest.py
abnormal program termination
D:\Users\kfarmer\Desktop>AstroMathTest-2.py
Period: 2448976 - 2448982
Body: 2
N: 1000
Results: [correct results -- KF]
Period: 2448976 - 2449067
Body: 9
N: 1000
Results: [correct results -- KF]
Period: 2448976 - 2449010
Body: 2
N: 1000
Results: [correct results -- KF]All threads completed
D:\Users\kfarmer\Desktop>AstroMathTest-3.py
Period: 2448976 - 2449003
Body: 2
N: 1000
Results: [correct results -- KF]Period: 2448976 -
2448982
Body: 6
N: 1000
Results: [correct results -- KF]Period: 2448976 -
2449075
Body: 2
N: 1000
Results: [correct results -- KF]All threads completed
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2002-01-29 15:44
Message:
Logged In: YES
user_id=31435
I'm glad you're unstuck! Let me suggest another problem:
instances of
return AstroMathError;
are going to burn you sooner or later, because that's a
Python object and you're not incrementing its refcount
before the return.
It's unclear whether you want that to be a "special value"
return, or to raise an exception. If you just want to
return it as a special value, Py_INCREF it before the
return. If you want it to raise an exception, pass it to
PyErr_SetObject() first and then return NULL.
----------------------------------------------------------------------
Comment By: Keith Farmer (deoradh)
Date: 2002-01-29 14:45
Message:
Logged In: YES
user_id=410277
CoInitialize/CoUnintialize needed to be included in the ADO
calls.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=508700&group_id=5470