[pypy-commit] pypy py3k: Kill slots nb_oct and nb_hex

rlamy pypy.commits at gmail.com
Wed Oct 5 12:13:43 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r87599:53e405a290a2
Date: 2016-10-05 17:12 +0100
http://bitbucket.org/pypy/pypy/changeset/53e405a290a2/

Log:	Kill slots nb_oct and nb_hex

diff --git a/pypy/module/cpyext/include/object.h b/pypy/module/cpyext/include/object.h
--- a/pypy/module/cpyext/include/object.h
+++ b/pypy/module/cpyext/include/object.h
@@ -222,8 +222,6 @@
 	unaryfunc nb_int;
 	unaryfunc nb_long;
 	unaryfunc nb_float;
-	unaryfunc nb_oct;
-	unaryfunc nb_hex;
 	/* Added in release 2.0 */
 	binaryfunc nb_inplace_add;
 	binaryfunc nb_inplace_subtract;
diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py
--- a/pypy/module/cpyext/slotdefs.py
+++ b/pypy/module/cpyext/slotdefs.py
@@ -422,8 +422,6 @@
                           ('tp_as_number.c_nb_absolute', '__abs__'),
                           ('tp_as_number.c_nb_invert', '__invert__'),
                           ('tp_as_number.c_nb_index', '__index__'),
-                          ('tp_as_number.c_nb_hex', '__hex__'),
-                          ('tp_as_number.c_nb_oct', '__oct__'),
                           ('tp_str', '__str__'),
                           ('tp_repr', '__repr__'),
                           ('tp_iter', '__iter__'),
diff --git a/pypy/module/cpyext/test/test_longobject.py b/pypy/module/cpyext/test/test_longobject.py
--- a/pypy/module/cpyext/test/test_longobject.py
+++ b/pypy/module/cpyext/test/test_longobject.py
@@ -314,29 +314,6 @@
                     ret = PyLong_FromLong(-1);
                 Py_DECREF(obj);
                 return ret;
-             """),
-            ("has_hex", "METH_NOARGS",
-             """
-                PyObject *ret, *obj = PyLong_FromLong(42);
-                if (obj->ob_type->tp_as_number->nb_hex)
-                    ret = obj->ob_type->tp_as_number->nb_hex(obj);
-                else
-                    ret = PyLong_FromLong(-1);
-                Py_DECREF(obj);
-                return ret;
-             """),
-            ("has_oct", "METH_NOARGS",
-             """
-                PyObject *ret, *obj = PyLong_FromLong(42);
-                if (obj->ob_type->tp_as_number->nb_oct)
-                    ret = obj->ob_type->tp_as_number->nb_oct(obj);
-                else
-                    ret = PyLong_FromLong(-1);
-                Py_DECREF(obj);
-                return ret;
-             """)])
+             """),])
         assert module.has_sub() == 0
         assert module.has_pow() == 0
-        assert module.has_hex() == '0x2aL'
-        assert module.has_oct() == '052L'
-
diff --git a/pypy/module/cpyext/typeobjectdefs.py b/pypy/module/cpyext/typeobjectdefs.py
--- a/pypy/module/cpyext/typeobjectdefs.py
+++ b/pypy/module/cpyext/typeobjectdefs.py
@@ -87,8 +87,6 @@
     ("nb_int", unaryfunc),
     ("nb_long", unaryfunc),
     ("nb_float", unaryfunc),
-    ("nb_oct", unaryfunc),
-    ("nb_hex", unaryfunc),
     ("nb_inplace_add", binaryfunc),
     ("nb_inplace_subtract", binaryfunc),
     ("nb_inplace_multiply", binaryfunc),
@@ -188,7 +186,7 @@
     ("tp_clear", inquiry),        #U
 
     # Assigned meaning in release 2.1
-    # rich comparisons 
+    # rich comparisons
     ("tp_richcompare", richcmpfunc), #N
 
     # weak reference enabler


More information about the pypy-commit mailing list