[pypy-commit] pypy py3k: issue1884, 1879: kill the py2 PyString*, PyNumber_Int & PyBoolObject names
pjenvey
noreply at buildbot.pypy.org
Mon Oct 13 23:52:31 CEST 2014
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r73928:5b94a7c05348
Date: 2014-10-13 14:51 -0700
http://bitbucket.org/pypy/pypy/changeset/5b94a7c05348/
Log: issue1884, 1879: kill the py2 PyString*, PyNumber_Int & PyBoolObject
names
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -461,14 +461,13 @@
# Common types with their own struct
for cpyname, pypyexpr in {
"PyType_Type": "space.w_type",
- "PyString_Type": "space.w_str",
+ "PyBytes_Type": "space.w_bytes",
"PyUnicode_Type": "space.w_unicode",
"PyDict_Type": "space.w_dict",
"PyTuple_Type": "space.w_tuple",
"PyList_Type": "space.w_list",
"PySet_Type": "space.w_set",
"PyFrozenSet_Type": "space.w_frozenset",
- "PyInt_Type": "space.w_int",
"PyBool_Type": "space.w_bool",
"PyFloat_Type": "space.w_float",
"PyLong_Type": "space.w_int",
diff --git a/pypy/module/cpyext/include/boolobject.h b/pypy/module/cpyext/include/boolobject.h
--- a/pypy/module/cpyext/include/boolobject.h
+++ b/pypy/module/cpyext/include/boolobject.h
@@ -7,8 +7,6 @@
extern "C" {
#endif
-#define PyBoolObject PyIntObject
-
#define Py_False ((PyObject *) &_Py_ZeroStruct)
#define Py_True ((PyObject *) &_Py_TrueStruct)
diff --git a/pypy/module/cpyext/number.py b/pypy/module/cpyext/number.py
--- a/pypy/module/cpyext/number.py
+++ b/pypy/module/cpyext/number.py
@@ -38,12 +38,6 @@
return space.int_w(w_obj) #XXX: this is wrong on win64
@cpython_api([PyObject], PyObject)
-def PyNumber_Int(space, w_obj):
- """Returns the o converted to an integer object on success, or NULL on failure.
- This is the equivalent of the Python expression int(o)."""
- return space.call_function(space.w_int, w_obj)
-
- at cpython_api([PyObject], PyObject)
def PyNumber_Long(space, w_obj):
"""Returns the o converted to a long integer object on success, or NULL on
failure. This is the equivalent of the Python expression long(o)."""
diff --git a/pypy/module/cpyext/test/test_number.py b/pypy/module/cpyext/test/test_number.py
--- a/pypy/module/cpyext/test/test_number.py
+++ b/pypy/module/cpyext/test/test_number.py
@@ -20,14 +20,14 @@
w_l = api.PyNumber_Long(space.wrap("123"))
assert api.PyLong_CheckExact(w_l)
- def test_number_int(self, space, api):
- w_l = api.PyNumber_Int(space.wraplong(123L))
+ def test_number_long2(self, space, api):
+ w_l = api.PyNumber_Long(space.wraplong(123L))
assert api.PyLong_CheckExact(w_l)
- w_l = api.PyNumber_Int(space.wrap(2 << 65))
+ w_l = api.PyNumber_Long(space.wrap(2 << 65))
assert api.PyLong_CheckExact(w_l)
- w_l = api.PyNumber_Int(space.wrap(42.3))
+ w_l = api.PyNumber_Long(space.wrap(42.3))
assert api.PyLong_CheckExact(w_l)
- w_l = api.PyNumber_Int(space.wrap("42"))
+ w_l = api.PyNumber_Long(space.wrap("42"))
assert api.PyLong_CheckExact(w_l)
def test_number_index(self, space, api):
More information about the pypy-commit
mailing list