Lines Matching defs:bytes

0 /* bytes object implementation */
21 class bytes "PyBytesObject *" "&PyBytes_Type"
27 /* PyBytesObject_SIZE gives the basic size of a bytes object; any memory allocation
28 for a bytes object of length n should request PyBytesObject_SIZE + n bytes.
31 3 or 7 bytes per bytes object allocation on a typical system.
46 // Return a borrowed reference to the empty bytes string singleton.
53 // Return a strong reference to the empty bytes string singleton.
63 string containing exactly `size' bytes.
66 either NULL or else points to a string containing at least `size' bytes.
71 bytes (setting the last byte to the null terminating character) and you can
77 items" in a variable-size object, will contain the number of bytes
193 - "18446744073709551615\0" (21 bytes)
194 - "-9223372036854775808\0" (21 bytes)
198 "0xffffffffffffffff\0" (19 bytes). */
255 /* subtract bytes preallocated for the format string
529 /* is it a bytes object? */
551 "__bytes__ returned non-bytes (type %.200s)",
571 "%%b requires a bytes-like object, "
1011 /* Copy bytes */
1023 "not all arguments converted during bytes formatting");
1042 "not all arguments converted during bytes formatting");
1217 "expected bytes, %.200s found", Py_TYPE(op)->tp_name);
1228 "expected bytes, %.200s found", Py_TYPE(op)->tp_name);
1246 "expected bytes, %.200s found", Py_TYPE(obj)->tp_name);
1370 "bytes object is too large to make repr");
1385 "str() on a bytes instance", 1)) {
1454 * and the # of bytes needed can overflow size_t
1458 "repeated bytes are too long");
1469 "repeated bytes are too long");
1533 "Comparison between bytes and string", 1))
1538 "Comparison between bytes and int", 1))
1692 bytes.__bytes__
1693 Convert this value to exact type bytes.
1715 bytes.split
1718 The delimiter according which to split the bytes.
1725 Return a list of the sections in the bytes, using sep as the delimiter.
1752 bytes.partition
1757 Partition the bytes into three parts using the given separator.
1759 This will search for the separator sep in the bytes. If the separator is found,
1763 If the separator is not found, returns a 3-tuple containing the original bytes
1764 object and two empty bytes objects.
1779 bytes.rpartition
1784 Partition the bytes into three parts using the given separator.
1786 This will search for the separator sep in the bytes, starting at the end. If
1790 If the separator is not found, returns a 3-tuple containing two empty bytes
1791 objects and the original bytes object.
1806 bytes.rsplit = bytes.split
1808 Return a list of the sections in the bytes, using sep as the delimiter.
1810 Splitting is done starting at the end of the bytes and working to the front.
1838 bytes.join
1843 Concatenate any number of bytes objects.
1845 The bytes whose method is called is inserted in between each pair.
1847 The result is returned as a new bytes object.
1966 do_argstrip(PyBytesObject *self, int striptype, PyObject *bytes)
1968 if (bytes != Py_None) {
1969 return do_xstrip(self, striptype, bytes);
1975 bytes.strip
1977 bytes: object = None
1980 Strip leading and trailing bytes contained in the argument.
1986 bytes_strip_impl(PyBytesObject *self, PyObject *bytes)
1989 return do_argstrip(self, BOTHSTRIP, bytes);
1993 bytes.lstrip
1995 bytes: object = None
1998 Strip leading bytes contained in the argument.
2004 bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes)
2007 return do_argstrip(self, LEFTSTRIP, bytes);
2011 bytes.rstrip
2013 bytes: object = None
2016 Strip trailing bytes contained in the argument.
2022 bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes)
2025 return do_argstrip(self, RIGHTSTRIP, bytes);
2037 bytes.translate
2040 Translation table, which must be a bytes object of length 256.
2170 bytes.maketrans
2176 Return a translation table useable for the bytes or bytearray translate method.
2181 The bytes objects frm and to must be of the same length.
2193 bytes.replace
2221 bytes.removeprefix as bytes_removeprefix
2226 Return a bytes object with the given prefix string removed if present.
2228 If the bytes starts with the prefix string, return bytes[len(prefix):].
2229 Otherwise, return a copy of the original bytes.
2258 bytes.removesuffix as bytes_removesuffix
2263 Return a bytes object with the given suffix string removed if present.
2265 If the bytes ends with the suffix string and that suffix is not empty,
2266 return bytes[:-len(prefix)]. Otherwise, return a copy of the original
2267 bytes.
2310 bytes.decode
2313 The encoding with which to decode the bytes.
2321 Decode the bytes using the codec registered for encoding.
2334 bytes.splitlines
2338 Return a list of the lines in the bytes, breaking at line boundaries.
2356 bytes.fromhex
2361 Create a bytes object from a string of hexadecimal numbers.
2364 Example: bytes.fromhex('B9 01EF') -> b'\\xb9\\x01\\xef'.
2456 bytes.hex
2459 An optional single character or byte to separate hex bytes.
2461 How many bytes between separators. Positive values count from the
2464 Create a string of hexadecimal numbers from a bytes object.
2579 bytes.__new__ as bytes_new
2592 PyObject *bytes;
2604 bytes = PyBytes_FromStringAndSize(NULL, 0);
2613 bytes = PyUnicode_AsEncodedString(x, encoding, errors);
2626 bytes = _PyObject_CallNoArgs(func);
2628 if (bytes == NULL)
2630 if (!PyBytes_Check(bytes)) {
2632 "__bytes__ returned non-bytes (type %.200s)",
2633 Py_TYPE(bytes)->tp_name);
2634 Py_DECREF(bytes);
2652 bytes = PyBytes_FromObject(x);
2659 bytes = _PyBytes_FromSize(size, 1);
2663 bytes = PyBytes_FromObject(x);
2666 if (bytes != NULL && type != &PyBytes_Type) {
2667 Py_SETREF(bytes, bytes_subtype_new(type, bytes));
2670 return bytes;
2723 "bytes must be in range(0, 256)");
2745 PyObject *bytes;
2751 bytes = PyBytes_FromStringAndSize(NULL, size);
2752 if (bytes == NULL)
2754 str = ((PyBytesObject *)bytes)->ob_sval;
2764 "bytes must be in range(0, 256)");
2769 return bytes;
2772 Py_DECREF(bytes);
2783 /* For iterator version, create a bytes object and resize as needed */
2817 "bytes must be in range(0, 256)");
2876 "cannot convert '%.200s' object to bytes",
2923 "bytes(iterable_of_ints) -> bytes\n\
2924 bytes(string, encoding[, errors]) -> bytes\n\
2925 bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\n\
2926 bytes(int) -> bytes object of size given by the parameter initialized with null bytes\n\
2927 bytes() -> empty bytes object\n\
2929 Construct an immutable array of bytes from:\n\
2939 "bytes",
3038 /* The following function breaks the notion that bytes are immutable:
3039 it changes the size of a bytes object. We get away with this only if there
3041 as creating a new bytes object and destroying the old one, only
3042 more efficiently. In any case, don't use this if the bytes object may
3044 Note that if there's not enough memory to resize the bytes object, the
3045 original bytes object at *pv is deallocated, *pv is set to NULL, an "out of
3120 return _PyStatus_ERR("Can't initialize bytes type");
3124 return _PyStatus_ERR("Can't initialize bytes iterator type");
3398 but we cannot use ob_alloc because bytes may need to be moved
3400 to avoid moving or copying bytes when bytes are removed at the
3409 /* convert from stack buffer to bytes object buffer */
3474 /* Allocate the buffer to write size bytes.
3488 efficient than bytes and bytearray objects to detect buffer underflow
3489 and buffer overflow. Use 10 bytes of the small buffer to test also
3494 tests in debug mode. The _PyBytesWriter is large (more than 512 bytes),
3553 const void *bytes, Py_ssize_t size)
3561 memcpy(str, bytes, size);