Author: Amaury Forgeot d'Arc <[email protected]>
Branch:
Changeset: r52657:fae75d81bc4f
Date: 2012-02-19 21:13 +0100
http://bitbucket.org/pypy/pypy/changeset/fae75d81bc4f/
Log: Add a stub implementation for Py_AddPendingCall. It always returns
an error for now...
diff --git a/pypy/module/cpyext/stubs.py b/pypy/module/cpyext/stubs.py
--- a/pypy/module/cpyext/stubs.py
+++ b/pypy/module/cpyext/stubs.py
@@ -1293,28 +1293,6 @@
that haven't been explicitly destroyed at that point."""
raise NotImplementedError
-@cpython_api([rffi.VOIDP], lltype.Void)
-def Py_AddPendingCall(space, func):
- """Post a notification to the Python main thread. If successful, func will
- be called with the argument arg at the earliest convenience. func will be
- called having the global interpreter lock held and can thus use the full
- Python API and can take any action such as setting object attributes to
- signal IO completion. It must return 0 on success, or -1 signalling an
- exception. The notification function won't be interrupted to perform
another
- asynchronous notification recursively, but it can still be interrupted to
- switch threads if the global interpreter lock is released, for example, if
it
- calls back into Python code.
-
- This function returns 0 on success in which case the notification has been
- scheduled. Otherwise, for example if the notification buffer is full, it
- returns -1 without setting any exception.
-
- This function can be called on any thread, be it a Python thread or some
- other system thread. If it is a Python thread, it doesn't matter if it
holds
- the global interpreter lock or not.
- """
- raise NotImplementedError
-
@cpython_api([Py_tracefunc, PyObject], lltype.Void)
def PyEval_SetProfile(space, func, obj):
"""Set the profiler function to func. The obj parameter is passed to the
diff --git a/pypy/module/cpyext/stubsactive.py
b/pypy/module/cpyext/stubsactive.py
--- a/pypy/module/cpyext/stubsactive.py
+++ b/pypy/module/cpyext/stubsactive.py
@@ -38,3 +38,27 @@
def Py_MakePendingCalls(space):
return 0
+pending_call = lltype.Ptr(lltype.FuncType([rffi.VOIDP], rffi.INT_real))
+@cpython_api([pending_call, rffi.VOIDP], rffi.INT_real, error=-1)
+def Py_AddPendingCall(space, func, arg):
+ """Post a notification to the Python main thread. If successful,
+ func will be called with the argument arg at the earliest
+ convenience. func will be called having the global interpreter
+ lock held and can thus use the full Python API and can take any
+ action such as setting object attributes to signal IO completion.
+ It must return 0 on success, or -1 signalling an exception. The
+ notification function won't be interrupted to perform another
+ asynchronous notification recursively, but it can still be
+ interrupted to switch threads if the global interpreter lock is
+ released, for example, if it calls back into Python code.
+
+ This function returns 0 on success in which case the notification
+ has been scheduled. Otherwise, for example if the notification
+ buffer is full, it returns -1 without setting any exception.
+
+ This function can be called on any thread, be it a Python thread
+ or some other system thread. If it is a Python thread, it doesn't
+ matter if it holds the global interpreter lock or not.
+ """
+ return -1
+
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit