◐ Shell
clean mode source ↗

Message 362919 - Python tracker

> Decorating __new__ with lru_cache would likely run into memory leakage problems?

I think the LRU cache would be for returning the same instance when called with the same string. I don't think it would be needed to return the same instance when called with a Path instance.

> From a quick look it appears to only be settable by using the path (not the actual file) as a context manager, and only serves to block further filesystem methods, but I'm not even sure why?

This came up in bpo-39682 recently, I'm not sure what this flag is supposed to mean and I could not find it in the documentation.

Since it's uncorrelated to the file object and the physical file, I think it may actually be dangerous to rely on this flag. I don't know why is the purpose of using Path as a context manager.