[Python-Dev] Can I make marshal.dumps() slower but stabler?
On Fri, Jul 13, 2018 at 11:46 PM Ivan Pozdeev via Python-Dev
<python-dev at python.org> wrote:
> If the use case for stability is only .pyc compilation, I doubt it's even relevant 'cuz .pyc's are supposed to be compiled in isolation from other current objects (otherwise, they wouldn't be reusable or would be invalidated when dependent modules change, neither of which is the case), so relevant reference counts should always be the same.
> I may be mistaking though.
Good point! You're right.
Currently, there is one unstable pyc issue (except frozenset order which can be
fixed by PYTHONHASHSEED).
This is caused by interned string.
Because of interning, reference count can be unstable.
Like that, long objects, tuples and some others are cached and reused
But they has refcnt>1 always: reference from object and cache.
So we can use FLAG_REF always for interned string, even if refcnt==1.
Let's try it and wait another issue are found.
INADA Naoki <songofacandy at gmail.com>