Open bskinn opened 5 years ago
@jayvdb I figure part of the challenge here is dealing with the encoding... is part of it also having to change the type of the output between str
and bytes
depending on the type of the content passed to init_text
?
I.e., StdioManager.stdout
should be made to be of the same type (& encoding, if relevant) as init_text
?
It isnt hard to change the code. Writing the tests is however quite a bit of work.
The main problem was that the attr checks on init_text
would need to be weakened to allow bytes or str, and I have been looking to avoid that, because I find that any time bytes or str are allowed, people make mistakes and they end up reporting weird errors stemming from the mistake.
https://github.com/bskinn/stdio-mgr/pull/64 should get us on the path to using different classes for bytes
(e.g. class names can include Raw
or Bytes
for those versions), or adding class methods, to handle different types with proper type checking.
jayvdb:
Certain use-cases will benefit from
stdio_mgr
taking eitherstr
orbytes
in theinit_text
argument.