Closed tcriess closed 9 years ago
LGTM modulo the minor comments above.
thanks!
Ok, I've changed the docstring and the length type to uint64 + check the given length argument vs. the bytearray length (panic if it is out of range).
you should keep length
as an int. that's what Go
uses to index slices.
Ah, ok. length is back to int (+ check if >= 0)
thanks.
With the existing functions I could not find a way to handle python bytearrays that contain zeros - PyByteArray_AsString always cuts the string off at the first zero byte (I guess C.GoString is responsible). Hence I've added the two functions to create []bytes from bytearrays. I'm not sure if that creates a memory leak though.