[issue45192] The tempfile._infer_return_type function cannot infer the type of os.PathLike objects.

2021-09-13 Thread Kyungmin Lee
Change by Kyungmin Lee : -- keywords: +patch pull_requests: +26732 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28323 ___ Python tracker <https://bugs.python.org/issu

[issue45192] The tempfile._infer_return_type function cannot infer the type of os.PathLike objects.

2021-09-13 Thread Kyungmin Lee
Kyungmin Lee added the comment: for example: ``` from typing import Union class FakePath: def __init__(self, path): self.path = path def __fspath__(self) -> Union[str, bytes]: return self.path if __name__ == "__main__": from tempfile import Tempo

[issue45192] The tempfile._infer_return_type function cannot infer the type of os.PathLike objects.

2021-09-13 Thread Kyungmin Lee
New submission from Kyungmin Lee : The tempfile module has been updated to accept an object implementing os.PathLike protocol for path-related parameters as of Python 3.6 (e.g. dir parameter). An os.PathLike object represents a filesystem path as a str or bytes object (i.e. def __fspath__