Implement os.PathLike for NamedTemporaryFile

I think there may be a miscommunication here. NamedTemporaryFile gives you a file-like object. os.PathLike is an interface for names of files (well, paths to them). When you create a NamedTemporaryFile, you don’t specify a name; Python figures out a suitable name (that won’t conflict with existing files or folders). And you get back the actual file handle, which you can use to .read or .write or whatever else; it doesn’t make sense for that to be os.PathLike - you’ve already done the file opening.

If you mean that the .name of the created file should implement the protocol, it does - it’s a string. If you mean that it should specifically be a pathlib.Path instance, that could break other things that don’t know about os.PathLike.

If you mean that e.g. the dir parameter for NamedTemporaryFile should accept anything that’s os.PathLike - doesn’t it already? I haven’t checked…

If you mean something else, you’re going to have to explain it more clearly. Show an example of code you think you should be able to write, explain what happens currently when you try it, explain what you think should happen instead, and justify it.