summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-06-24 22:46:07 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-06-24 22:46:07 (GMT)
commit9c437af4ebd832d913b85bfb2e666d55565c3665 (patch)
tree993ca8e99a212478a985cdeec1f92892016ce2da /Python
parent4ac817213bdc9fabd6522754ef6088bac02e74ce (diff)
downloadcpython-9c437af4ebd832d913b85bfb2e666d55565c3665.zip
cpython-9c437af4ebd832d913b85bfb2e666d55565c3665.tar.gz
cpython-9c437af4ebd832d913b85bfb2e666d55565c3665.tar.bz2
Revert 64424, 64438, and 64439.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 7647523..e18eb2a 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -211,24 +211,7 @@ Deprecated since release 2.3. Instead, use the extended call syntax:\n\
static PyObject *
builtin_bin(PyObject *self, PyObject *v)
{
- PyNumberMethods *nb;
- PyObject *res;
-
- if ((nb = v->ob_type->tp_as_number) == NULL ||
- nb->nb_hex == NULL) {
- PyErr_SetString(PyExc_TypeError,
- "bin() argument can't be converted to hex");
- return NULL;
- }
- res = (*nb->nb_bin)(v);
- if (res && !PyString_Check(res)) {
- PyErr_Format(PyExc_TypeError,
- "__bin__ returned non-string (type %.200s)",
- res->ob_type->tp_name);
- Py_DECREF(res);
- return NULL;
- }
- return res;
+ return PyNumber_ToBase(v, 2);
}
PyDoc_STRVAR(bin_doc,