This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Thanh Ly
Recipients Thanh Ly, mark.dickinson, terry.reedy
Date 2011-06-04.21:06:07
SpamBayes Score 2.584044e-13
Marked as misclassified No
Message-id <E71161A5FB1C46F9905DCDD4C0FF4392@ThanhPC>
In-reply-to <1307142862.43.0.545784350681.issue12232@psf.upfronthosting.co.za>
Content
Hi Terry, I do need to do a lot more investigating into the issue.

I'm using borland builder 6 on a win XP PC to create a interface DLL in 
C/C++ for a GUI to call into a large number of pre-written Python test 
scripts.

I'm using Python26.dll (I will try using the lib file) to create my embedded 
Python environment and redirecting stdin, stdout and stderr bo to the GUI.

The strange issue is when calling the script containing 'import cmath' from 
Python console, it works  fine. However when calling a script containing 
'import cmath' my embedded method (GUI), the application hangs. all other 
'import's work fine from my embedded environment.

I've attached a copy of my project with 'my_py.cpp' including the following 
snippets:

PyRun_SimpleString( //"import cmath\n"    // TRIED HERE!!! 'import cmath'
                                "import log\n"
                                "import sys\n"
                                "class StdoutCatcher:\n"
                                "\tdef write(self, str):\n"
                                "\t\tlog.CaptureStdout(str)\n"
                                "class StderrCatcher:\n"
                                "\tdef write(self, str):\n"
                                "\t\tlog.CaptureStderr(str)\n"
                                "sys.stdout = StdoutCatcher()\n"
                                "sys.stderr = StderrCatcher()\n");

and I tried within a script using:

pValue = DLL_PyObject_CallObject(pFunc, pArgs);    // CALLED HERE!!! python 
scripted containing 'import cmath'

Thanks,
Thanh Ly.

-----Original Message----- 
From: Terry J. Reedy
Sent: Saturday, June 04, 2011 12:14 AM
To: thanh.l@ntlworld.com
Subject: [issue12232] embedded python import cmath

Terry J. Reedy <tjreedy@udel.edu> added the comment:

Hanging is different from crashing.
2.6 and 3.1 (soon) are only open for security issues.
Perhaps your system is missing something needed for the import.

If you want this to stay open, retest with 2.7 or 3.2 and give much more 
information: your system/OS, C/C++ compiler, your Python binary (copy the 
startup line in the interactive interpreter), and a minimal code that shows 
the problem.

----------
nosy: +terry.reedy
stage:  -> test needed
type: crash -> behavior
versions:  -Python 2.6

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue12232>
_______________________________________
Files
File name Uploaded
MDW 48 Ch Deck Card-import_cmath_issue.zip Thanh Ly, 2011-06-04.21:06:07
my_py.cpp Thanh Ly, 2011-06-04.21:06:05
History
Date User Action Args
2011-06-04 21:06:09Thanh Lysetrecipients: + Thanh Ly, terry.reedy, mark.dickinson
2011-06-04 21:06:07Thanh Lylinkissue12232 messages
2011-06-04 21:06:07Thanh Lycreate