Lines Matching defs:bytes
231 - bytes of length 1
245 "expect bytes or str of length 1, or int, "
252 PyObject *bytes;
258 bytes = PyUnicode_AsEncodedString(obj, encoding, NULL);
259 if (bytes == NULL)
261 if (PyBytes_GET_SIZE(bytes) == 1)
262 value = (unsigned char)PyBytes_AS_STRING(bytes)[0];
265 Py_DECREF(bytes);
278 "expect bytes or str of length 1, or int, got %s",
296 - bytes of length 1
321 "expect bytes or str of length 1, or int, "
346 "expect bytes or str of length 1, or int, got %s",
364 - 1 if obj is a byte string (written into *bytes)
368 PyObject **bytes, wchar_t **wstr)
381 *bytes = PyUnicode_AsEncodedString(obj, win->encoding, NULL);
382 if (*bytes == NULL)
384 /* check for embedded null bytes */
385 if (PyBytes_AsStringAndSize(*bytes, &str, NULL) < 0) {
386 Py_CLEAR(*bytes);
394 *bytes = obj;
395 /* check for embedded null bytes */
396 if (PyBytes_AsStringAndSize(*bytes, &str, NULL) < 0) {
403 PyErr_Format(PyExc_TypeError, "expect bytes or str, got %s",
3071 "f.read() returned %.100s instead of bytes",