Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Problem with uuid package when embedding a python interpreter
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jérôme Fuselier  
View profile  
 More options Jun 30, 12:05 pm
Newsgroups: comp.lang.python
From: Jérôme Fuselier <jerome.fusel...@gmail.com>
Date: Tue, 30 Jun 2009 09:05:42 -0700 (PDT)
Local: Tues, Jun 30 2009 12:05 pm
Subject: Problem with uuid package when embedding a python interpreter
Hello,
  I've tried to import a script in an embedded python intrepreter but
this script fails when it imports the uuid module. I have a
segmentation fault in Py_Finalize().

Here is a simple program which imitate my problem.

main.c :

#include "Python.h"

void test() {
    Py_Initialize();
    PyImport_Import(PyString_FromString("uuid"));
    Py_Finalize();

}

main(int argc, char **argv)
{
    for (i=0 ; i < 10; i++)
        test();

}

For my application, I have to call Py_initialize and Py_Finalize
several times so factorizing them in the main function is not an easy
solution for me.

The core which is produced gives me this error :
Program terminated with signal 11, Segmentation fault.
#0  0x00190ef6 in type_dealloc (type=0x291320) at Objects/typeobject.c:
2609
2609            _PyObject_GC_UNTRACK(type);

Thanks for your help
Jerome


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gabriel Genellina  
View profile  
 More options Jun 30, 2:02 pm
Newsgroups: comp.lang.python
From: "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
Date: Tue, 30 Jun 2009 15:02:13 -0300
Local: Tues, Jun 30 2009 2:02 pm
Subject: Re: Problem with uuid package when embedding a python interpreter
En Tue, 30 Jun 2009 13:05:42 -0300, Jérôme Fuselier
<jerome.fusel...@gmail.com> escribió:

Are you sure you can't do that? Not even using Py_IsInitialized? Try to
avoid repeatedly calling Py_Initialize - won't work.

Python 2.x does not have a way to "un-initialize" an extension module
(that's a big flaw in Python design). Modules that contain global state
are likely to crash the interpreter when used by the second time. (Python
3 attempts to fix that)

--
Gabriel Genellina


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jérôme Fuselier  
View profile  
 More options Jul 1, 6:14 am
Newsgroups: comp.lang.python
From: Jérôme Fuselier <jerome.fusel...@gmail.com>
Date: Wed, 1 Jul 2009 03:14:20 -0700 (PDT)
Local: Wed, Jul 1 2009 6:14 am
Subject: Re: Problem with uuid package when embedding a python interpreter
On Jun 30, 7:02 pm, "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
wrote:

Hi Gabriel,
  Thanks for your response. I can modify my code to call
Py_IsInitialized which I didn't know before and this works well. The
problem is that I did not own the process which calls Py_Initialize
and Py_Finalize. I'm able to call Py_Initialize correctly but I can't
call Py_Finalize so this is not perfect.

At least I have a temporary solution which is not too bad.
Thanks,
Jerome


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aahz  
View profile  
 More options Jul 1, 6:39 pm
Newsgroups: comp.lang.python
From: a...@pythoncraft.com (Aahz)
Date: 1 Jul 2009 15:39:55 -0700
Local: Wed, Jul 1 2009 6:39 pm
Subject: Re: Problem with uuid package when embedding a python interpreter
In article <7d5cfbf0-38d5-4505-a93a-f321d0da7...@c36g2000yqn.googlegroups.com>,

=?ISO-8859-1?Q?J=E9r=F4me_Fuselier?=  <jerome.fusel...@gmail.com> wrote:

>I've tried to import a script in an embedded python intrepreter but
>this script fails when it imports the uuid module. I have a
>segmentation fault in Py_Finalize().

You may want to also ask on the capi-sig mailing list.
--
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"as long as we like the same operating system, things are cool." --piranha


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google