INNER CODE UNIT · Python
protect
briscverse/ryp · ryp.py:686
def protect(self: _RMemory,
robject: _cffi_backend._CDataBase) -> _cffi_backend._CDataBase:
robject = self.rlib.Rf_protect(robject)
self.count += 1
return robject
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