This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients gregory.p.smith, serhiy.storchaka
Date 2021-05-01.23:57:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619913447.36.0.640815291034.issue44003@roundup.psfhosted.org>
In-reply-to
Content
the pure python functools.lru_cache doesn't get this right either.  here's a desirable testcase for this bug:

```
    def test_lru_defaults_bug44003(self):
        @self.module.lru_cache(maxsize=None)
        def func(arg='ARG', *, kw='KW'):
            return arg, kw

        self.assertEqual(func.__wrapped__.__defaults__, ('ARG',))
        self.assertEqual(func.__wrapped__.__kwdefaults__, {'kw': 'KW'})
        self.assertEqual(func.__defaults__, ('ARG',))
        self.assertEqual(func.__kwdefaults__, {'kw': 'KW'})
```

results in

```
ERROR: test_lru_defaults_bug44003 (test.test_functools.TestLRUC)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/greg/oss/python/gpshead/Lib/test/test_functools.py", line 1738, in test_lru_defaults_bug44003
    self.assertEqual(func.__defaults__, ('ARG',))
AttributeError: 'functools._lru_cache_wrapper' object has no attribute '__defaults__'

======================================================================
FAIL: test_lru_defaults_bug44003 (test.test_functools.TestLRUPy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/greg/oss/python/gpshead/Lib/test/test_functools.py", line 1738, in test_lru_defaults_bug44003
    self.assertEqual(func.__defaults__, ('ARG',))
AssertionError: None != ('ARG',)
```
History
Date User Action Args
2021-05-01 23:57:27gregory.p.smithsetrecipients: + gregory.p.smith, serhiy.storchaka
2021-05-01 23:57:27gregory.p.smithsetmessageid: <1619913447.36.0.640815291034.issue44003@roundup.psfhosted.org>
2021-05-01 23:57:27gregory.p.smithlinkissue44003 messages
2021-05-01 23:57:27gregory.p.smithcreate