Make test_base64 pass.
Change binascii.Error to derive from ValueError
and raise binascii.Error everywhere where values are bad
(why on earth did the old code use TypeError?!?).
diff --git a/Objects/longobject.c b/Objects/longobject.c
index d325b8e..1f497c4 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -3519,11 +3519,20 @@
 		return PyLong_FromLong(0L);
 	if (base == -909)
 		return PyNumber_Long(x);
-	else if (PyString_Check(x)) {
+	else if (PyString_Check(x) || PyBytes_Check(x)) {
 		/* Since PyLong_FromString doesn't have a length parameter,
 		 * check here for possible NULs in the string. */
-		char *string = PyString_AS_STRING(x);
-		if (strlen(string) != PyString_Size(x)) {
+		char *string;
+		int size;
+		if (PyBytes_Check(x)) {
+			string = PyBytes_AS_STRING(x);
+			size = PyBytes_GET_SIZE(x);
+		}
+		else {
+			string = PyString_AS_STRING(x);
+			size = PyString_GET_SIZE(x);
+		}
+		if (strlen(string) != size) {
 			/* create a repr() of the input string,
 			 * just like PyLong_FromString does. */
 			PyObject *srepr;
@@ -3536,7 +3545,7 @@
 			Py_DECREF(srepr);
 			return NULL;
 		}
-		return PyLong_FromString(PyString_AS_STRING(x), NULL, base);
+		return PyLong_FromString(string, NULL, base);
 	}
 	else if (PyUnicode_Check(x))
 		return PyLong_FromUnicode(PyUnicode_AS_UNICODE(x),