top | item 37059131

(no title)

rep_movsd | 2 years ago

Why is that array not const in the Cpython code?

discuss

order

ynik|2 years ago

Because every Python object also contains a reference count (which needs to be modified whenever the object is passed around), a `const PyObject*` is effectively useless.

colejohnson66|2 years ago

But we’re talking about an integer cache. It’s full of singletons; Why do they need to have reference counts?

aflag|2 years ago

That wouldn't make a difference in this case, would it? I suppose it would mean that the code would be UB, but in practice it'd just work the same.