mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Renamed PyString to PyBytes
This commit is contained in:
parent
c3cb683d63
commit
593daf545b
176 changed files with 2793 additions and 2791 deletions
|
@ -368,7 +368,7 @@ PyInt_FromString(char *s, char **pend, int base)
|
|||
if (*end != '\0') {
|
||||
bad:
|
||||
slen = strlen(s) < 200 ? strlen(s) : 200;
|
||||
sobj = PyString_FromStringAndSize(s, slen);
|
||||
sobj = PyBytes_FromStringAndSize(s, slen);
|
||||
if (sobj == NULL)
|
||||
return NULL;
|
||||
srepr = PyObject_Repr(sobj);
|
||||
|
@ -377,7 +377,7 @@ PyInt_FromString(char *s, char **pend, int base)
|
|||
return NULL;
|
||||
PyErr_Format(PyExc_ValueError,
|
||||
"invalid literal for int() with base %d: %s",
|
||||
base, PyString_AS_STRING(srepr));
|
||||
base, PyBytes_AS_STRING(srepr));
|
||||
Py_DECREF(srepr);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -965,11 +965,11 @@ int_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return PyInt_FromLong(0L);
|
||||
if (base == -909)
|
||||
return PyNumber_Int(x);
|
||||
if (PyString_Check(x)) {
|
||||
if (PyBytes_Check(x)) {
|
||||
/* Since PyInt_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 = PyBytes_AS_STRING(x);
|
||||
if (strlen(string) != PyBytes_Size(x)) {
|
||||
/* create a repr() of the input string,
|
||||
* just like PyInt_FromString does */
|
||||
PyObject *srepr;
|
||||
|
@ -978,7 +978,7 @@ int_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return NULL;
|
||||
PyErr_Format(PyExc_ValueError,
|
||||
"invalid literal for int() with base %d: %s",
|
||||
base, PyString_AS_STRING(srepr));
|
||||
base, PyBytes_AS_STRING(srepr));
|
||||
Py_DECREF(srepr);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ _PyInt_Format(PyIntObject *v, int base, int newstyle)
|
|||
if (negative)
|
||||
*--p = '-';
|
||||
|
||||
return PyString_FromStringAndSize(p, &buf[sizeof(buf)] - p);
|
||||
return PyBytes_FromStringAndSize(p, &buf[sizeof(buf)] - p);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1116,7 +1116,7 @@ int__format__(PyObject *self, PyObject *args)
|
|||
|
||||
if (!PyArg_ParseTuple(args, "O:__format__", &format_spec))
|
||||
return NULL;
|
||||
if (PyString_Check(format_spec))
|
||||
if (PyBytes_Check(format_spec))
|
||||
return string_int__format__(self, args);
|
||||
if (PyUnicode_Check(format_spec)) {
|
||||
/* Convert format_spec to a str */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue