Bytes_Format: use a couple of macros instead of functions

The type was already checked upstream in the func body.
This commit is contained in:
Daniele Varrazzo 2018-12-28 03:01:58 +01:00
parent 15cba69a20
commit fe915ac461

View File

@ -123,7 +123,7 @@ Bytes_Format(PyObject *format, PyObject *args)
result = Bytes_FromStringAndSize((char *)NULL, reslen); result = Bytes_FromStringAndSize((char *)NULL, reslen);
if (result == NULL) if (result == NULL)
return NULL; return NULL;
res = Bytes_AsString(result); res = Bytes_AS_STRING(result);
if (PyTuple_Check(args)) { if (PyTuple_Check(args)) {
arglen = PyTuple_GET_SIZE(args); arglen = PyTuple_GET_SIZE(args);
argidx = 0; argidx = 0;
@ -238,8 +238,7 @@ Bytes_Format(PyObject *format, PyObject *args)
"unsupported format character '%c' (0x%x) " "unsupported format character '%c' (0x%x) "
"at index " FORMAT_CODE_PY_SSIZE_T, "at index " FORMAT_CODE_PY_SSIZE_T,
c, c, c, c,
(Py_ssize_t)(fmt - 1 - (Py_ssize_t)(fmt - 1 - Bytes_AS_STRING(format)));
Bytes_AsString(format)));
goto error; goto error;
} }
if (width < len) if (width < len)