
On 2/21/2022 11:11 AM, Petr Viktorin wrote:
On 19. 02. 22 8:46, Eric Snow wrote:
As part of this proposal, we must make sure that users can clearly understand on which parts of the refcount behavior they can rely and which are considered implementation details. Specifically, they should use the existing public refcount-related API and the only refcount value with any meaning is 0. All other values are considered "not 0".
Should we care about hacks/optimizations that rely on having the only reference (or all references), e.g. mutating a tuple if it has refcount 1? Immortal objects shouldn't break them (the special case simply won't apply), but this wording would make them illegal. AFAIK CPython uses this internally, but I don't know how prevalent/useful it is in third-party code.
We could say that the only refcounts with any meaning are 0, 1, and > 1. -- Terry Jan Reedy