473,546 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent: Embedding Python problems - advice sought

Hi,
I am embedding Python into a multi-threaded C++ application running on
Solaris and need urgent clarification on the embedding architecture and
its correct usage (as I am experience weird behaviors).
Can anyone clarify:
- if Python correctly supports multiple sub-interpreters
(Py_NewInterpre ter) ?
- if Python correctly supports multiple thread states per
sub-interpreter (PyThreadState_ New) ?
and the "real" question:
- what is the rationale for choosing one of:
[a] one sub-interpreter with many thread states
[b] many sub-interpreters with one thread state each
[c] many sub-interpreters with many threas states each
Thanks for helping
Alan

Aug 17 '05 #1
4 1670
Does anyone have advice on other groups, sites etc that has knowledge
of this subject ?

Thanks

Aug 17 '05 #2
ad*******@eirco m.net writes:
Hi,
I am embedding Python into a multi-threaded C++ application running on
Solaris and need urgent clarification on the embedding architecture and
its correct usage (as I am experience weird behaviors).
What version of Python are you using?
Can anyone clarify:
- if Python correctly supports multiple sub-interpreters
(Py_NewInterpre ter) ?
It's supposed to but it's not often used or tested and can get a bit
flaky.
- if Python correctly supports multiple thread states per
sub-interpreter (PyThreadState_ New) ?
There are bugs in 2.3.5 and 2.4.1 in this area (they are fixed in CVS
-- I hope -- and will be in 2.4.2).
and the "real" question:
- what is the rationale for choosing one of:
[a] one sub-interpreter with many thread states
This is the best tested and understood (it's what the core Python
interpreter does, after all).
[b] many sub-interpreters with one thread state each
[c] many sub-interpreters with many threas states each


These are probably somewhat broken in recent Python's, I'm afraid.
Can you try CVS?

Cheers,
mwh

--
ARTHUR: Yes. It was on display in the bottom of a locked filing
cabinet stuck in a disused lavatory with a sign on the door
saying "Beware of the Leopard".
-- The Hitch-Hikers Guide to the Galaxy, Episode 1
Aug 17 '05 #3
ad*******@eirco m.net writes:
Does anyone have advice on other groups, sites etc that has knowledge
of this subject ?


I've just replied to your original post, having not seen it the first
time around.

Cheers,
mwh

--
<Nafai> w00t w00t w00t w00t!
<Nafai> I don't understand all of the code, but it works!
<Nafai> I guess I should check it in.
-- from Twisted.Quotes
Aug 17 '05 #4
Thanks Michael.

I will look into the areas you have suggested...

Alan

Aug 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2854
by: Roose | last post by:
With some googling I have found these resources: http://docs.python.org/ext/win-dlls.html http://www.python.org/doc/faq/windows.html I have a large Win32/MFC/C/C++ application that has an embedded scripting language (a very limited one). I would like to rip it out and replace it with Python. I am thinking that this would be relatively...
0
1110
by: adsheehan | last post by:
Hi, I am embedding Python into a multi-threaded application running on Solaris. Python will enable end users to customize and re-program many aspects of the application. I expect that the C++ application will be natively multi-threaded and will embed multiple Python sub-interpreters. Called Python scripts may in turn call back into the...
0
1318
by: adsheehan | last post by:
Hi, I am embedding Python into a multi-threaded C++ application runnig on Solaris and need urgent clarification on the embedding architecture and its correct usage (as I am experience weird behaviors). Can anyone clarify: - if Python correctly supports multiple sub-interpreters (Py_NewInterpreter) ?
0
1415
by: adsheehan | last post by:
Hi, I am embedding Python into a multi-threaded C++ application runnig on Solaris and need urgent clarification on the embedding architecture and its correct usage (as I am experience weird behaviors). Can anyone clarify:
0
1103
by: Kenneth McDonald | last post by:
We're looking at embedding Python into our product to provide users with the ability to write scripts for the programming. My knowledge of Python is excellent, I'm familiar with the concepts of converting back and forth between C and Python datatypes, but my knowledge of compiling and linking is almost nonexistent. So if I could get advice on...
3
2914
by: John Pye | last post by:
Hi all I have been working on some new code that embeds python in an C application. The embedding is working fine under Linux but crashing under Windows (XP) when I reach the following step. PyRun_AnyFile(f,name); If there's some python exception being thrown by the PyRun_AnyFile call, how can I retrieve it from C?
9
1405
by: Duncan Smith | last post by:
Hello, I find myself in the, for me, unusual (and at the moment unique) position of having to write a web application. I have quite a lot of existing Python code that will form part of the business logic. This relies on 3rd party libraries (such as numpy) which would make porting to e.g. IronPython difficult (I would imagine). I was...
0
1214
by: Severian | last post by:
I am working on embedding Python 2.5 in my C++ application, and I have a few questions: 1) My application is multi-threaded; what problems should I be aware of if I create a separate interpreter in each working thread? The documentation is a bit vague (or perhaps I haven't found the right place). Calls into my application are already...
0
7504
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.