INNER CODE UNIT · Python
__exit__
briscverse/ryp · ryp.py:692
def __exit__(self: _RMemory, *_) -> None:
self.rlib.Rf_unprotect(self.count)
def _bytestring_to_character_vector(bytestring: bytes, rmemory: _RMemory) -> \
_cffi_backend._CDataBase:
"""
Convert a Python bytestring into a length-1 R character vector.
Args:
bytestring: a Python bytestring (bytes)
rmemory: an instance of the _RMemory class
Returns:
A length-1 R character vector (STRSXP).
"""
STRSXP = rmemory.protect(_rlib.Rf_allocVector(_rlib.STRSXP, 1))
_rlib.SET_STRING_ELT(STRSXP, 0, _rlib.Rf_mkCharLenCE(