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

2020-06-21 Thread Antony Lee
Change by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2020-06-20 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- versions: +Python 3.10 -Python 3.9 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2020-05-21 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +19563 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20288 ___ Python tracker ___

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

2020-02-28 Thread Barney Gale
Barney Gale added the comment: Attempted fix shown here: https://github.com/barneygale/cpython/commit/784630ef6ad05031abdefa523e61e0629b15e201 Note that I've already removed context manager support (and hence `_closed`) in this branch. -- nosy: +barneygale

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

2020-02-28 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: > 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

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

2020-02-28 Thread Antony Lee
Antony Lee 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

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

2020-02-28 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: There is the _closed attribute thought that is mutated by some methods. -- nosy: +remi.lapeyre ___ Python tracker ___

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

2020-02-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: Possibly this could be done just by adding @lru_cache to the __new__() method. -- nosy: +rhettinger ___ Python tracker ___

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

2020-02-28 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +brett.cannon, pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list

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

2020-02-28 Thread Antony Lee
New submission from Antony Lee : Many functions which take a path-like object typically also accept strings (sorry, no hard numbers here). This means that if the function plans to call Path methods on the object, it needs to first call Path() on the arguments to convert them, well, to