MCPcopy Index your code
hub / github.com/RustPython/RustPython / new_bytes

Method new_bytes

crates/vm/src/vm/context.rs:554–560  ·  view source on GitHub ↗
(&self, data: Vec<u8>)

Source from the content-addressed store, hash-verified

552
553 #[inline]
554 pub fn new_bytes(&self, data: Vec<u8>) -> PyRef<PyBytes> {
555 if data.is_empty() {
556 self.empty_bytes.clone()
557 } else {
558 PyBytes::from(data).into_ref(self)
559 }
560 }
561
562 #[inline]
563 pub fn new_bytearray(&self, data: Vec<u8>) -> PyRef<PyByteArray> {

Callers 15

js_to_pyFunction · 0.45
tcgetattrFunction · 0.45
_msg_callbackFunction · 0.45
get_channel_bindingMethod · 0.45
readMethod · 0.45
idMethod · 0.45
enum_certificatesFunction · 0.45
getsockoptMethod · 0.45
get_addr_tupleFunction · 0.45
fcntlFunction · 0.45
ioctlFunction · 0.45
__reduce_ex__Method · 0.45

Calls 3

is_emptyMethod · 0.45
cloneMethod · 0.45
into_refMethod · 0.45

Tested by 1

miri_test_dropFunction · 0.36