Author: mattip <[email protected]>
Branch: disable_pythonapi
Changeset: r72121:8830f5d80d16
Date: 2014-06-21 21:09 +0300
http://bitbucket.org/pypy/pypy/changeset/8830f5d80d16/
Log: document failed functionality of pythonapi
diff --git a/pypy/doc/ctypes-implementation.rst
b/pypy/doc/ctypes-implementation.rst
--- a/pypy/doc/ctypes-implementation.rst
+++ b/pypy/doc/ctypes-implementation.rst
@@ -72,13 +72,17 @@
Here is a list of the limitations and missing features of the
current implementation:
-* ``ctypes.pythonapi`` lets you access the CPython C API emulation layer
- of PyPy, at your own risks and without doing anything sensible about
- the GIL. Since PyPy 2.3, these functions are also named with an extra
- "Py", for example ``PyPyInt_FromLong()``. Basically, don't use this,
- but it might more or less work in simple cases if you do. (Obviously,
- assuming the PyObject pointers you get have any particular fields in
- any particular order is just going to crash.)
+* ``ctypes.pythonapi`` (Windows only) lets you access the CPython C API
+ emulation layer. It does not work on PyPy at the moment, we are missing a
+ ``getfunc`` method for CDLL. Work was begun
+ to refactor the rpython implementation of _rawffi (in
+ pypy/modules/_rawffi/alt) but that project has stalled.
+
+ Note that even if it worked, our implementation would not do anything
+ sensible about the GIL and the functions will be named with an extra
+ "Py", for example ``PyPyInt_FromLong()``. Basically, don't use this.
+ Assuming the PyObject pointers you get have any particular fields in
+ any particular order is just going to crash.
* We copy Python strings instead of having pointers to raw buffers
diff --git a/pypy/module/cpyext/test/test_cpyext.py
b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -206,9 +206,9 @@
if sys.platform != "win32" or sys.version_info < (2, 6):
skip("Windows Python >= 2.6 only")
assert sys.dllhandle
- assert sys.dllhandle.getaddressindll('PyPyErr_NewException')
- import ctypes # slow
- PyUnicode_GetDefaultEncoding =
ctypes.pythonapi.PyPyUnicode_GetDefaultEncoding
+ assert sys.dllhandle.getaddressindll('cpyexttestErr_NewException')
+ import ctypes
+ PyUnicode_GetDefaultEncoding =
ctypes.pythonapi.cpyexttestUnicode_GetDefaultEncoding
PyUnicode_GetDefaultEncoding.restype = ctypes.c_char_p
assert PyUnicode_GetDefaultEncoding() == 'ascii'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit