News for hackers. Stuff that matters.
Re:In CPython, types implemented in C are part of the type tree by holri on Friday December 25, 2020 @02:28AM (#25534909)
> and a replacing it with a function that returns the same values for the same arguments will be safe

No. That is only safe at compile time but not at runtime. Because the type alone often does not guarantee the meaning and semantics of the values in the specific context and program are the same.

Re:In CPython, types implemented in C are part of the type tree by Asraelite on Friday December 25, 2020 @05:22AM (#25535583)
I'm not sure I get the argument here. So long as the input-output mapping for the function is identical, it cannot change the benavior of the program. This is what I would consider safe.

The semantics of values are irrelevant because the function will behave identically regardless of those semantics.

Re:In CPython, types implemented in C are part of the type tree by holri on Friday December 25, 2020 @05:53AM (#25535698)
This only true if the type describes the whole meaning of the values. If the exit code of a unix program changes from 0 to 1 it still returns an int, but the meaning of that value is completely different one.
Re:In CPython, types implemented in C are part of the type tree by Asraelite on Saturday December 26, 2020 @03:24PM (#25546192)
But the exit code can't change from 0 to 1. For any given input to the Unix program, if the output was 0 with one implementation, then it would always remain 0 with any other _equivalent_ implementation.

This is literally what is meant by "returns the same values for the same arguments". Any function that fits this description, by definition, cannot suffer from the problem you are describing.