Open msehnout opened 5 months ago
Thanks for this issue. I agree with you that we should not modify this immutable object. We will discuss internally to update this as we don't want to introducing breaking changes at this time
And this is the right place to report this issue, this is the official Speech SDK repo
This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.
Hello
This sample can lead to subtle bugs: https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/1b2d61bf540622eea1e194b8af7f38fc914bb931/samples/python/console/speech_synthesis_sample.py#L386
The problem is that
bytes
type is immutable in Python, but Speech SDK uses native C library and it modifies the immutable type: https://docs.python.org/3/library/stdtypes.html#bytes-objectsI stumbled upon the bug when I tried to accumulate the buffer in a separate function like this:
where the iterator was implemented like this:
And the result was corrupted.
The SDK should probably take
bytearray
instead: https://docs.python.org/3/library/stdtypes.html#bytearray-objects Because it is a mutable counterpart to bytes objects.I could not find a better place to report this issue. Please let me know if I can submit it somewhere else.