The ability to construct a Game object from a PathLike object was broken when event driven parsing was introduced.
The new parsing logic checks if the input is a str in the parse() function, and if so treats it as a path and opens it. Otherwise, the input is treated as a stream. This breaks the ability to support any representation of a path other than a str. This is a problem because paths are frequently manipulated using the built-in PathLib library.
A simple solution would be to add a check for isinstance(input, os.PathLike) in addition to str in the parse() function. A more sophisticated solution might try to check the attributes of input to determine if it is path-like or stream-like.
The ability to construct a Game object from a PathLike object was broken when event driven parsing was introduced.
The new parsing logic checks if the input is a
str
in theparse()
function, and if so treats it as a path and opens it. Otherwise, the input is treated as a stream. This breaks the ability to support any representation of a path other than astr
. This is a problem because paths are frequently manipulated using the built-in PathLib library.A simple solution would be to add a check for
isinstance(input, os.PathLike)
in addition tostr
in theparse()
function. A more sophisticated solution might try to check the attributes ofinput
to determine if it is path-like or stream-like.