Closed wesQ3 closed 8 years ago
I do not remember if it was a concious decision to still allow this (as opposed to just propagating ctypes.create_string_buffer
's behaviour).
It is more a bug than an undocumented feature, in the sense that it seems unlikely that one really wants to send X null bytes. So I guess raising TypeError would more likely help detecting bugs than get in the way, and would prefer this to a documentation change.
Fixed by #12 merge, thanks for the patch.
While documenting the change, I found a simpler way (marginally faster too) to implement this change. I also realised that proposed patch missed "long" type, which is also fixed by this new way.
Ah, nice catch.
The Pydoc for USBDeviceHandle.interruptWrite (and the other handle write methods) lists the
data
parameter but makes no mention that integers are not allowed (intentionally or not). Each write method callscreate_binary_buffer
with their write data. If an int is passed in,create_binary_buffer
returns an empty buffer of lengthdata
.Is this a bug? Or expected behavior? Either way I find surprising.
I can submit a pull request with doc changes if you like.