python-stackless

Is it possible to programmatically construct a Python stack frame and start execution at an arbitrary point in the code?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 06:20:47
问题 Is it possible to programmatically construct a stack (one or more stack frames) in CPython and start execution at an arbitrary code point? Imagine the following scenario: You have a workflow engine where workflows can be scripted in Python with some constructs (e.g. branching, waiting/joining) that are calls to the workflow engine. A blocking call, such as a wait or join sets up a listener condition in an event-dispatching engine with a persistent backing store of some sort. You have a

Eventlet or gevent or Stackless + Twisted, Pylons, Django and SQL Alchemy

≯℡__Kan透↙ 提交于 2019-11-29 19:20:21
We're using Twisted extensively for apps requiring a great deal of asynchronous io. There are some cases where stuff is cpu bound instead and for that we spawn a pool of processes to do the work and have a system for managing these across multiple servers as well - all done in Twisted. Works great. The problem is that it's hard to bring new team members up to speed. Writing asynchronous code in Twisted requires a near vertical learning curve. It's as if humans just don't think that way naturally. We're considering a mixed approach perhaps. Maybe keep the xmlrpc server part and process

Why does the Python/C API crash on PyRun_SimpleFile?

落花浮王杯 提交于 2019-11-29 01:36:38
I've been experimenting with embedding different scripting languages in a C++ application, currently I'm trying Stackless Python 3.1. I've tried several tutorials and examples, what few I can find, to try and run a simple script from an application. Py_Initialize(); FILE* PythonScriptFile = fopen("Python Scripts/Test.py", "r"); if(PythonScriptFile) { PyRun_SimpleFile(PythonScriptFile, "Python Scripts/Test.py"); fclose(PythonScriptFile); } Py_Finalize(); For some odd reason, running this piece of code results in an access violation at: PyRun_SimpleFile(PythonScriptFile, "Python Scripts/Test.py"

Is it possible to programmatically construct a Python stack frame and start execution at an arbitrary point in the code?

允我心安 提交于 2019-11-28 17:04:34
Is it possible to programmatically construct a stack (one or more stack frames) in CPython and start execution at an arbitrary code point? Imagine the following scenario: You have a workflow engine where workflows can be scripted in Python with some constructs (e.g. branching, waiting/joining) that are calls to the workflow engine. A blocking call, such as a wait or join sets up a listener condition in an event-dispatching engine with a persistent backing store of some sort. You have a workflow script, which calls the Wait condition in the engine, waiting for some condition that will be

Multiprocessing or Multithreading?

蓝咒 提交于 2019-11-28 15:55:13
I'm making a program for running simulations in Python, with a wxPython interface. In the program, you can create a simulation, and the program renders (=calculates) it for you. Rendering can be very time-consuming sometimes. When the user starts a simulation, and defines an initial state, I want the program to render the simulation continuously in the background, while the user may be doing different things in the program. Sort of like a YouTube-style bar that fills up: You can play the simulation only up to the point that was rendered. Should I use multiple processes or multiple threads or

Why does the Python/C API crash on PyRun_SimpleFile?

五迷三道 提交于 2019-11-27 16:08:05
问题 I've been experimenting with embedding different scripting languages in a C++ application, currently I'm trying Stackless Python 3.1. I've tried several tutorials and examples, what few I can find, to try and run a simple script from an application. Py_Initialize(); FILE* PythonScriptFile = fopen("Python Scripts/Test.py", "r"); if(PythonScriptFile) { PyRun_SimpleFile(PythonScriptFile, "Python Scripts/Test.py"); fclose(PythonScriptFile); } Py_Finalize(); For some odd reason, running this piece

Python on an Real-Time Operation System (RTOS)

心不动则不痛 提交于 2019-11-27 13:13:10
问题 I am planning to implement a small-scale data acquisition system on an RTOS platform. (Either on a QNX or an RT-Linux system.) As far as I know, these jobs are performed using C / C++ to get the most out of the system. However I am curious to know and want to learn some experienced people's opinions before I blindly jump into the coding action whether it would be feasible and wiser to write everything in Python (from low-level instrument interfacing through a shiny graphical user interface).

Why can't generators be pickled?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 11:34:14
Python's pickle (I'm talking standard Python 2.5/2.6/2.7 here) cannot pickle locks, file objects etc. It also cannot pickle generators and lambda expressions (or any other anonymous code), because the pickle really only stores name references. In case of locks and OS-dependent features, the reason why you cannot pickle them is obvious and makes sense. But why can't you pickle generators? Note : just for clarity -- I'm interested in the fundamental reason (or assumptions and choices that went into that design decision) why , not in "because it gives you a Pickle error". I realize the question's

Python Global Interpreter Lock (GIL) workaround on multi-core systems using taskset on Linux?

喜你入骨 提交于 2019-11-27 11:23:16
So I just finished watching this talk on the Python Global Interpreter Lock (GIL) http://blip.tv/file/2232410 . The gist of it is that the GIL is a pretty good design for single core systems (Python essentially leaves the thread handling/scheduling up to the operating system). But that this can seriously backfire on multi-core systems and you end up with IO intensive threads being heavily blocked by CPU intensive threads, the expense of context switching, the ctrl-C problem[*] and so on. So since the GIL limits us to basically executing a Python program on one CPU my thought is why not accept

Multiprocessing or Multithreading?

点点圈 提交于 2019-11-27 09:26:09
问题 I'm making a program for running simulations in Python, with a wxPython interface. In the program, you can create a simulation, and the program renders (=calculates) it for you. Rendering can be very time-consuming sometimes. When the user starts a simulation, and defines an initial state, I want the program to render the simulation continuously in the background, while the user may be doing different things in the program. Sort of like a YouTube-style bar that fills up: You can play the