You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[PyYAML] Dump and serialize stubs accept binary streams without an encoding #16837
With the current PyYAML stubs, mypy reports no error. With PyYAML 6.0.3, this raises TypeError: a bytes-like object is required, not 'str'. Supplying encoding='utf-8' makes the call work. The same mismatch affects dump, dump_all, safe_dump_all, serialize, and serialize_all.
Text streams need separate handling: StringIO accepts an explicit encoding, while a custom text writer without an encoding attribute receives bytes and fails. I checked these combinations with both SafeDumper and CSafeDumper.
Activity