>From skimming some of cpython's "marshal" code [1] my best guess is that
first difference is between it thinking the `_m` string might have
another reference to it (and thus adding 0x80, or FLAG_REF to it) or
not.  This seems driven by whether or not python's object for the string
has other references (it calls Py_REFCNT(v) to decide, see line 302).

I assume the difference is whether or not python has bothered to collect
some other reference to the string or not.  Type "Z" is an interned
string type, TYPE_SHORT_ASCII_INTERNED, which therefore makes sense that
it might be shared with who knows what else.  I'm assuming this stops
reproducing when you change it to a unique name since no one else will
share the reference and you'll just deterministically get no FLAG_REF.

Just my best guesses.

Keith

[1] https://github.com/python/cpython/blob/main/Python/marshal.c

Reply via email to