Marc, I modified ___cleanup as follows:
-------------------------------------------------------
___EXP_FUNC(void,___cleanup) ___PVOID { /* * Only do cleanup once after successful setup. */
if (setup_state != 1) return;
setup_state = 2;
//___cleanup_mem (); //___cleanup_os (); }
-------------------------------------------------------
This seems a bit odd... I do this in ipython:
Process Python finished Python 2.7.1 (r271:86832, Dec 29 2010, 01:38:09) Type "copyright", "credits" or "license" for more information.
IPython 0.10.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more.
In [2]: import gambit
In [3]: gambit.cleanup () Starting cleanup Finished cleanup Gambit-C cleanup complete
In [4]: gambit.setup () Gambit-C setup successful
In [5]: gambit.cleanup () Starting cleanup
Process Python exited abnormally with code 1
On Wed, Jan 12, 2011 at 3:07 PM, David Dreisigmeyer dwdreisigmeyer@gmail.com wrote:
I had already tried commenting out ___cleanup_mem and ___cleanup_os. Only having ___cleanup_mem causes Python to exit also. I was just going to look at this a bit more. I'll try to comment out ___cleanup_mem first and see which of the lines in ___cleanup_os is causing the trouble.
On Wed, Jan 12, 2011 at 2:59 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
On 2011-01-12, at 2:36 PM, David Dreisigmeyer wrote:
Niether of these worked for Python. However, the first one did cause "Cleanup successful\n" to be printed to the screen when calling client in gambit/tests.
Good to know.
For the Python problem could you comment out each line of ___cleanup_os in turn to see which call causes the problem :
void ___cleanup_os ___PVOID { ___cleanup_io_module (); ___cleanup_tty_module (); ___cleanup_dyn_module (); ___cleanup_files_module (); ___cleanup_shell_module (); ___cleanup_time_module (); ___cleanup_base_module (); }
___cleanup_os is at the end of lib/os.c .
Marc
Afficher les réponses par date
Here's an update on what I've tried. If I modify ___cleanup to:
-----------------------------------------------------
___EXP_FUNC(void,___cleanup) ___PVOID { /* * Only do cleanup once after successful setup. */
printf ("setup_state : %i \n" , setup_state); fflush (stdout); sleep(200); setup_state = 1;
if (setup_state != 1) return;
setup_state = 2;
___cleanup_mem (); ___cleanup_os (); }
-----------------------------------------------------
and call Python does not exit. However, the code neither prints nor sleeps (it does print and sleep when I try test8). I can make setup_state = 1; any number I want and call ___cleanup any number of times. After I setup the environment as in client.c (test8), Python crashes after a call to ___cleanup. The same thing happens if I make a standalone program with Cython. I'm going to see if I can get any help from the Cython folks.
-Dave