New submission from Daniel Moisset <dmois...@machinalis.com>:

In compile.c, some strings are created to be used as name of anonymous code 
objects: "<module>", "<lambda>", "<genexpr>", "<listcomp>", "<setcomp>" and 
"<dictcomp>".

Only the first two of those are interned (created with 
PyUnicode_InternFromString ), the rest are created with "PyUnicode_FromString". 
Even if they use a static variable to avoid creating multiple instances, not 
interning results in multiple copies when code objects are marshaled into pyc 
files and reloaded (one copy per module).

Always using PyUnicode_InternFromString should be more consistent, and slightly 
more efficient

----------
components: Interpreter Core
messages: 315232
nosy: Daniel Moisset
priority: normal
severity: normal
status: open
title: tags for anonymous code objects should be interned

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33270>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to