Python AudioDataStream.read_data should not modify immutable bytes object #2337
Labels
enhancement
New feature or request
text-to-speech
Text-to-Speech
update needed
For items that are in progress but have not been updated
Hello
This sample can lead to subtle bugs:
cognitive-services-speech-sdk/samples/python/console/speech_synthesis_sample.py
Line 386 in 1b2d61b
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-objectsBecause 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.
The text was updated successfully, but these errors were encountered: