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 methane
Recipients methane
Date 2020-10-31.07:50:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1604130602.05.0.173247705477.issue42217@roundup.psfhosted.org>
In-reply-to
Content
co_consts are merged already, but I forget about code attributes other than co_consts.
Duplication ratio is vary by code style, but in case of logging, we can reduce 25% of them.

```
>>> data = open('Lib/logging/__pycache__/__init__.python-310.pyc', 'rb').read()
>>> import marshal
>>> x = []
>>> def walk(c):
...     x.append(c.co_code)
...     x.append(c.co_lnotab)
...     for cc in c.co_consts:
...         if hasattr(cc, 'co_code'):
...             walk(cc)
...
>>> code = marshal.loads(data[16:])
>>> walk(code)
>>> len(x)
336
>>> len(set(x))
249
>>> 249/336
0.7410714285714286
```
History
Date User Action Args
2020-10-31 07:50:02methanesetrecipients: + methane
2020-10-31 07:50:02methanesetmessageid: <1604130602.05.0.173247705477.issue42217@roundup.psfhosted.org>
2020-10-31 07:50:01methanelinkissue42217 messages
2020-10-31 07:50:01methanecreate