[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-20 Thread Matej Cepl
Change by Matej Cepl : -- nosy: +mcepl ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.or

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-20 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 8b30ee843528d0f0e2bfc3307d86658915579c21 by Raymond Hettinger (Miss Islington (bot)) in branch '3.7': bpo-36650: Fix handling of empty keyword args in C version of lru_cache. (GH-12881) (GH-12888) https://github.com/python/cpython/commit/8b3

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-20 Thread miss-islington
Change by miss-islington : -- pull_requests: +12814 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 14adbd45980f705cb6554ca17b8a66b56e105296 by Raymond Hettinger in branch 'master': bpo-36650: Fix handling of empty keyword args in C version of lru_cache. (GH-12881) https://github.com/python/cpython/commit/14adbd45980f705cb6554ca17b8a66b56e

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-19 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +12806 stage: -> patch review ___ Python tracker ___ ___ Python-bu

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: For the record, here's what is going on. The method_cache() code uses a slightly different invocation for the first call than for subsequent calls. In particular, the wrapper() uses **kwargs with an empty dict whereas the first call didn't use keyword ar

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-19 Thread Jason R. Coombs
Jason R. Coombs added the comment: Nice work. Thanks Raymond. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the reproducer code. I've bisected this back to b2b023c657ba8c3f4a24d0c847d10fe8e2a73d44 which fixes other known bugs in the lru_cache in issue 35780. The problem is due to the lines that use a scalar instead of an args tuple for exact ints a

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-17 Thread Jason R. Coombs
Jason R. Coombs added the comment: Hi Josh. Thanks for the tip on types.MethodType. I've updated the code to use that and the behavior seems to be the same, MethodType does seem a more appropriate way to create a bound method. Regarding the referenced tickets, I suspect they're not pertinent

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Hmm... Although I can't seem to reproduce on 3.7.2 (ob.calls is 1), so assuming it is really happening in 3.7.3, it wouldn't be either of those issues (which were fully in place long before 3.7.2 I believe). -- __

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: It seems highly likely this is related to #26110 which optimizes method calls by avoiding the creation of bound methods in certain circumstances, and/or the follow-up #29263. Side-note: bound_method = functools.partial(method, self) is not how you create r

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-17 Thread Jason R. Coombs
Jason R. Coombs added the comment: I've put together this full reproducer script: ``` import functools def method_cache(method): def wrapper(self, *args, **kwargs): # it's the first call, replace the method with a cached, bound method bound_method = f

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-17 Thread Jason R. Coombs
Change by Jason R. Coombs : -- components: +Library (Lib) type: -> behavior versions: +Python 3.7, Python 3.8, Python 3.9 ___ Python tracker ___ __

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-17 Thread Jason R. Coombs
New submission from Jason R. Coombs : In [this ticket](https://github.com/jaraco/jaraco.functools/issues/12), I learned that [jaraco.functools.method_cache](https://github.com/jaraco/jaraco.functools/blob/6b32ee0dfd3e7c88f99e88cd87c35fa9b76f261f/jaraco/functools.py#L109-L180) no longer works