[issue39783] Optimize construction of Path from other Paths by just returning the same object?

Antony Lee report at bugs.python.org
Fri Feb 28 12:43:18 EST 2020


Antony Lee <anntzer.lee at gmail.com> added the comment:

Decorating __new__ with lru_cache would likely run into memory leakage problems? (one would need a "weak lru_cache", I guess).

I didn't know about the _closed attribute. 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? (for example, it doesn't block fspath, so it won't prevent operations via os.path functions anyways...)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39783>
_______________________________________


More information about the Python-bugs-list mailing list