Re: [C++-sig] Why can't kill process by Ctrl-c in a boost.python module with an endless loop

2012-12-23 Thread simon zhang
Because string's memory allocated is different in python and c++.General method should not suited. I have reviewed the project.Maybe you're right, it is premature to optimize the program.At least for now, it should not be a problem. The program will have a c + + interface and a python interface, so

Re: [C++-sig] Why can't kill process by Ctrl-c in a boost.python module with an endless loop

2012-12-23 Thread Jaedyn K. Draper
Yeah, I saw your other question about it. There's nothing in boost that I know of to achieve that. The only thing I'd know to suggest is what others have already suggested - encapsulate it in another class and pass that in. But it wouldn't be converted to a python string that way. My question

Re: [C++-sig] Why can't kill process by Ctrl-c in a boost.python module with an endless loop

2012-12-23 Thread simon zhang
Jaedyn. I would like to discuss another issue, what is a good way to avoid deep copy.There may be a few big data.From c++ to python and from python to c++.Similar from c + + return std::string* to python and python pass the std::string* parameter to c + + function.Maybe it should be similar to sma

Re: [C++-sig] Why can't kill process by Ctrl-c in a boost.python module with an endless loop

2012-12-23 Thread Jaedyn K. Draper
I was at least half right, then. Python was eating the signals. :) As an alternative, to prevent yourself from having to do this in every loop in your code, you might try this on the python side: import signal signal.signal(signal.SIGINT, signal.SIG_DFL) That'll stop Python from catching SIGI

Re: [C++-sig] Why can't kill process by Ctrl-c in a boost.python module with an endless loop

2012-12-23 Thread simon zhang
This is the answer from the stackoverflow. while (true) { //endless loop ++it; std::cout<< it < > Oh, my mistake. Not sure then, I've only embedded, never extended. Maybe > someone else can help. :( > > > On 12/23/2012 1:59 AM, simon zhang wrote: > > But I don't call Py_Initial

Re: [C++-sig] How to converter std::string* in boost.python?

2012-12-23 Thread simon zhang
..so,It seems I can only convert std::string and make a deep copy.I can only avoid it as much as possible.Thank you. 2012/12/22 Jim Bosch > On 12/21/2012 03:52 AM, simon zhang wrote: > >> How to converter std::string* in boost.python?I have to handle some data >> of c++ in python.The data may b

Re: [C++-sig] Why can't kill process by Ctrl-c in a boost.python module with an endless loop

2012-12-23 Thread simon zhang
I do embedded and extended.Anyway, thank you for your reply. :) This boost.python document is so complex. :( 2012/12/23 Jaedyn K. Draper > Oh, my mistake. Not sure then, I've only embedded, never extended. Maybe > someone else can help. :( > > > On 12/23/2012 1:59 AM, simon zhang wrote: > > But

Re: [C++-sig] Why can't kill process by Ctrl-c in a boost.python module with an endless loop

2012-12-23 Thread Jaedyn K. Draper
Oh, my mistake. Not sure then, I've only embedded, never extended. Maybe someone else can help. :( On 12/23/2012 1:59 AM, simon zhang wrote: But I don't call Py_Initialize().I call C++ code in Python.Don't embed the Python to C++... 2012/12/23 Jaedyn K. Draper