[Python-Dev] Stackless Python - Pros and Cons (original) (raw)
Jeremy Hylton jeremy@beopen.com
Mon, 7 Aug 2000 09:10:14 -0400 (EDT)
- Previous message: [Python-Dev] Stackless Python - Pros and Cons
- Next message: [Python-Dev] Stackless Python - Pros and Cons
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"CT" == Christian Tismer <tismer@appliedbiometrics.com> writes:
If someone is going to write a PEP, I hope they will explain how the implementation deals with the various Python C API calls that can call back into Python.
CT> He will.
Good! You'll write a PEP.
How does this control flow at the C level interact with a Python API call like PySequence_Tuple or PyObject_Compare that can start executing Python code again? Say there is a Python function call which in turn calls PySequence_Tuple, which in turn calls a getitem method on some Python object, which in turn uses a continuation to transfer control. After the continuation is called, the Python function will never return and the PySquence_Tuple call is no longer necessary, but there is still a call to PySequence_Tuple on the C stack. How does stackless deal with the return through this function?
CT> Right. What you see here is the incompleteness of Stackless. In CT> order to get this "right", I would have to change many parts of CT> the implementation, in order to allow for continuations in every CT> (probably even unwanted) place. I could not do this.
CT> Instead, the situation of these still occouring recursions are CT> handled differently. continuationmodule guarantees, that in the CT> context of recursive interpreter calls, the given stack order of CT> execution is obeyed. Violations of this cause simply an CT> exception.
Let me make sure I understand: If I invoke a continuation when there are extra C stack frames between the mainloop invocation that captured the continuation and the call of the continuation, the interpreter raises an exception?
If so, continuations don't sound like they would mix well with C extension modules and callbacks. I guess it also could not be used inside methods that implement operator overloading. Is there a simple set of rules that describe the situtations where they will not work?
Jeremy
- Previous message: [Python-Dev] Stackless Python - Pros and Cons
- Next message: [Python-Dev] Stackless Python - Pros and Cons
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]