Skip to content

Commit 7d42a1d

Browse files
Fix various review comments.
- Missing import in _ffi/__init__.py - Updated docstring of t2b - Reverted change to Random.__del__()
1 parent b364753 commit 7d42a1d

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

wolfcrypt/_ffi/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import _cffi_backend
2+
import _ffi.lib as lib
23

34
ffi: _cffi_backend.FFI
45

wolfcrypt/_ffi/lib.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
from _cffi_backend import FFI
3-
from typing_extensions import TypeAlias
3+
from typing import TypeAlias
44

55
INVALID_DEVID: int
66

wolfcrypt/random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, nonce=b"", device_id=_lib.INVALID_DEVID) -> None:
4747
def __del__(self) -> None:
4848
if self.native_object:
4949
try:
50-
Random._delete(self.native_object)
50+
self._delete(self.native_object)
5151
except AttributeError:
5252
# Can occur during interpreter shutdown
5353
pass

wolfcrypt/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ def t2b(string: bytes | bytearray | memoryview | str) -> bytes:
2929
"""
3030
Converts text to binary.
3131
32-
Passes through bytes, bytearray, and memoryview unchanged.
32+
Passes through bytes unchanged.
33+
Objects of type bytearray or memoryview are converted to bytes.
3334
Encodes str to UTF-8 bytes.
3435
"""
3536
if isinstance(string, (bytes, bytearray, memoryview)):

0 commit comments

Comments
 (0)