Calling sc.scan_instances.import_scan with str('filename') returns an empty string.
It appears that if the argument fileobj is a plain str instead of _io.TextIOWrapper than the string is simply added as the file content.
I expected something like TypeError(f'{fileobj} is not of type <expected type>')
As defined in the Python Glossary file objects expose "a file-oriented API (with methods such as read() or write())" like the handle returned from calling open(). Since str does not implement read() or write() I argue that this function should raise TypeError.
Description
Calling
sc.scan_instances.import_scan
withstr('filename')
returns an empty string. It appears that if the argumentfileobj
is a plainstr
instead of_io.TextIOWrapper
than the string is simply added as the file content.Reproduction
Expected Behavior
I expected something like
TypeError(f'{fileobj} is not of type <expected type>')
As defined in the Python Glossary file objects expose "a file-oriented API (with methods such as
read()
orwrite()
)" like the handle returned from callingopen()
. Sincestr
does not implementread()
orwrite()
I argue that this function shouldraise TypeError
.Sysinfo