Repository navigation
Fix Python raw XML byte-stream regression for legacy bytes encoding - #12326
Conversation
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The narrow compatibility fix preserves custom-encoding fallback and includes targeted regression coverage, with no blocking issues identified.
No open issues 🎉
What changed in this PR
Restores Python’s legacy raw-byte XML response contract, addressing the compatibility regression described in #12325.
Changes:
- Recognizes
"bytes"encoding while preserving fallback for unsupported encodings. - Adds emitter and Python regression coverage for sync/async streaming and complete XML preservation.
- Documents the fix in a changelog entry.
| File | Description |
|---|---|
| packages/http-client-python/tests/unit/test_raw_bytes_xml.py | Tests signatures, default streaming, and XML preservation. |
| packages/http-client-python/emitter/test/types.test.ts | Covers legacy bytes encoding and custom-encoding fallback. |
| packages/http-client-python/emitter/test/test-host.ts | Registers the HTTP library for tests. |
| packages/http-client-python/emitter/test/emitter.test.ts | Tests emission from a legacy XML response specification. |
| packages/http-client-python/emitter/src/types.ts | Adds "bytes" to supported bytes encodings. |
| .chronus/changes/copilot-fix-python-emitter-xml-bug-2026-9-21-8-26-3.md | Records the compatibility fix. |
Review effort: Balanced
commit: |
|
All changed packages have been documented.
Show changes
|
Python emitter diffBaseline No changes to generated output. Rendered diff: inline on the run summary, or the emitter-diff-html artifact. Informational check (eng/emitter-diff); does not block the PR. |
|
You can try these changes here |

New TCGC
wireTypemetadata caused legacy@encode("bytes")XML responses to becomestrinstead of byte iterators. XML scalar deserialization then discarded child elements and attributes."bytes"as a supported bytes encoding, preserving syncIterator[bytes], asyncAsyncIterator[bytes], and default streaming. Genuinely unsupported/custom encodings retain the wire-type fallback.