[pypy-commit] pypy default: behave more like the cpython macros - do no type checking (should move to pure c)
mattip
pypy.commits at gmail.com
Sat Jan 14 13:53:30 EST 2017
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r89567:597653e02827
Date: 2017-01-12 19:02 +0200
http://bitbucket.org/pypy/pypy/changeset/597653e02827/
Log: behave more like the cpython macros - do no type checking (should
move to pure c)
diff --git a/pypy/module/cpyext/listobject.py b/pypy/module/cpyext/listobject.py
--- a/pypy/module/cpyext/listobject.py
+++ b/pypy/module/cpyext/listobject.py
@@ -90,11 +90,10 @@
return 0
@cpython_api([rffi.VOIDP], Py_ssize_t, error=CANNOT_FAIL)
-def PyList_GET_SIZE(space, w_list):
+def PyList_GET_SIZE(space, w_obj):
"""Macro form of PyList_Size() without error checking.
"""
- assert isinstance(w_list, W_ListObject)
- return w_list.length()
+ return space.len_w(w_obj)
@cpython_api([PyObject], Py_ssize_t, error=-1)
diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py
--- a/pypy/module/cpyext/unicodeobject.py
+++ b/pypy/module/cpyext/unicodeobject.py
@@ -205,9 +205,8 @@
@cpython_api([rffi.VOIDP], Py_ssize_t, error=CANNOT_FAIL)
def PyUnicode_GET_SIZE(space, w_obj):
- """Return the size of the object. o has to be a PyUnicodeObject (not
+ """Return the size of the object. obj is a PyUnicodeObject (not
checked)."""
- assert isinstance(w_obj, unicodeobject.W_UnicodeObject)
return space.len_w(w_obj)
@cpython_api([rffi.VOIDP], rffi.CWCHARP, error=CANNOT_FAIL)
More information about the pypy-commit
mailing list