Repository navigation
fix(http-client-python): preserve bytes type for raw bytes encoding - #12328
Closed
Hardik K (hardikkaurani) wants to merge 3 commits into
Closed
Hardik K (hardikkaurani) wants to merge 3 commits into
Hardik K (hardikkaurani) wants to merge 3 commits into
Conversation
Hardik K (hardikkaurani)
requested review from
Chenxi Jiang (ChenxiJiang333),
catalinaperalta,
iscai-msft,
Kashif Khan (kashifkhan),
Libba Lawrence (l0lawrence),
Laurent Mazuel (lmazuel),
Mark Cowlishaw (markcowl),
Yuchao Yan (msyyc),
Chenjie Shi (tadelesh),
Timothee Guerin (timotheeguerin) and
Jeff Fisher (xirzec)
as code owners
October 21, 2026 10:17
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Author
|
Hi Yuchao Yan (@msyyc) Timothee Guerin (@timotheeguerin) Vincent Biret (@baywet), I've opened this PR to resolve issue #12325. Summary
Whenever you have a moment, please take a look. Thank you! |
Member
|
Hardik K (@hardikkaurani) please do not mention me on this repository, I don't have review permissions and it's disruptive. |
Author
|
Sorry, Vincent Biret (@baywet) I apologize for mentioning you on the |
Member
|
Hardik K (@hardikkaurani) there is already a pr out to address this, thank you for the contribution. Closing this as a duplicate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12325
Description
TCGC supplies wireType for encoded bytes. In @typespec/http-client-python, supportedPythonEncodings previously only listed �ase64 and �ase64url for �ytes. Consequently, when raw bytes were annotated with Encode (@encode)("bytes") and TCGC supplied a string wireType, the Python emitter fell back to treating it as an unsupported custom encoding, replacing the client-facing type with string.
This regression caused binary streams (such as XML byte streams) to change from Iterator[bytes] to str, triggering lossy XML scalar deserialization instead of binary streaming.
This PR adds �ytes to supportedPythonEncodings for the �ytes kind, ensuring that raw bytes encoding preserves the �ytes type, maintains binary streaming responses, and prevents fallback to string.
Validation