[pypy-commit] pypy disable_pythonapi: Small fixes
arigo
noreply at buildbot.pypy.org
Mon Jun 30 09:10:16 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: disable_pythonapi
Changeset: r72278:da5ba751361e
Date: 2014-06-30 09:09 +0200
http://bitbucket.org/pypy/pypy/changeset/da5ba751361e/
Log: Small fixes
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,14 +72,11 @@
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. It does not work on PyPy.
-
- 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.
+* ``ctypes.pythonapi`` is missing. In previous versions, it was present
+ and redirected to the `cpyext` C API emulation layer, but our
+ implementation did not do anything sensible about the GIL and the
+ functions were named with an extra "Py", for example
+ ``PyPyInt_FromLong()``. It was removed for being unhelpful.
* We copy Python strings instead of having pointers to raw buffers
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -46,4 +46,4 @@
.. branch: disable_pythonapi
Remove non-functioning ctypes.pyhonapi and ctypes.PyDLL, document this
-incompatability with cpython. Recast sys.dllhandle to an int.
+incompatibility with cpython. Recast sys.dllhandle to an int.
diff --git a/pypy/module/sys/test/test_sysmodule.py b/pypy/module/sys/test/test_sysmodule.py
--- a/pypy/module/sys/test/test_sysmodule.py
+++ b/pypy/module/sys/test/test_sysmodule.py
@@ -420,13 +420,9 @@
if hasattr(sys, "winver"):
assert sys.winver == sys.version[:3]
- def test_no_dllhandle(self):
+ def test_dllhandle(self):
import sys
- if '__pypy__' in sys.builtin_module_names:
- assert not hasattr(sys, 'dllhandle')
- elif sys.platform == 'win32':
- # only on cpython win32
- assert hasattr(sys, 'dllhandle')
+ assert hasattr(sys, 'dllhandle') == (sys.platform == 'win32')
def test_dlopenflags(self):
import sys
diff --git a/pypy/module/sys/vm.py b/pypy/module/sys/vm.py
--- a/pypy/module/sys/vm.py
+++ b/pypy/module/sys/vm.py
@@ -233,8 +233,6 @@
def get_dllhandle(space):
if not space.config.objspace.usemodules.cpyext:
return space.wrap(0)
- if not space.config.objspace.usemodules._rawffi:
- return space.wrap(0)
return _get_dllhandle(space)
@@ -249,8 +247,8 @@
# cdll = RawCDLL(handle)
# return space.wrap(W_CDLL(space, "python api", cdll))
# Provide a cpython-compatible int
- from rpython.rtyper.lltypesystem import rffi
- return space.wrap(rffi.cast(rffi.INT, handle))
+ from rpython.rtyper.lltypesystem import lltype
+ return space.wrap(rffi.cast(lltype.Signed, handle))
def getsizeof(space, w_object, w_default=None):
"""Not implemented on PyPy."""
More information about the pypy-commit
mailing list