[pypy-commit] pypy cpyext-fast-typecheck: (anto, matti): fix the tests broken by the previous commit: we are no longer

antocuni pypy.commits at gmail.com
Tue Mar 20 10:38:59 EDT 2018


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: cpyext-fast-typecheck
Changeset: r94033:403e8744b785
Date: 2018-03-20 15:37 +0100
http://bitbucket.org/pypy/pypy/changeset/403e8744b785/

Log:	(anto, matti): fix the tests broken by the previous commit: we are
	no longer able to call PySlice_Check directly, but the isinstance
	check should be enough

diff --git a/pypy/module/cpyext/sliceobject.py b/pypy/module/cpyext/sliceobject.py
--- a/pypy/module/cpyext/sliceobject.py
+++ b/pypy/module/cpyext/sliceobject.py
@@ -74,9 +74,8 @@
     normal slices.
 
     Returns 0 on success and -1 on error with exception set."""
-    if not PySlice_Check(space, w_slice):
+    if not isinstance(w_slice, W_SliceObject):
         PyErr_BadInternalCall(space)
-    assert isinstance(w_slice, W_SliceObject)
     start_p[0], stop_p[0], step_p[0], slicelength_p[0] = \
             w_slice.indices4(space, length)
     return 0
@@ -96,9 +95,8 @@
     objects in versions of Python prior to 2.3, you would probably do well to
     incorporate the source of PySlice_GetIndicesEx(), suitably renamed,
     in the source of your extension."""
-    if not PySlice_Check(space, w_slice):
+    if not isinstance(w_slice, W_SliceObject):
         PyErr_BadInternalCall(space)
-    assert isinstance(w_slice, W_SliceObject)
     start_p[0], stop_p[0], step_p[0] = \
             w_slice.indices3(space, length)
     return 0


More information about the pypy-commit mailing list