[Python-Dev] Removing tp_compare? (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Sun Feb 1 19:03:58 CET 2009


Mark Dickinson wrote:

On Sat, Jan 31, 2009 at 9:28 PM, "Martin v. Löwis" <martin at v.loewis.de> wrote:

tpreserved sounds fine. In 3.0.1, filling it with a function pointer should give no error, since that would be a binary-incompatible change. I'm not sure I understand you here. Are you saying that in your opinion it is safe to change the type of tpreserved from (cmpfunc *) to some other (dummy) function pointer?

No. I thought someone (you?) proposed that it should cause a runtime error if a type definitions fills the tp_compare slot. I say that 3.0.1 must not produce such an error.

I now realize (thanks to your message) that changing the type to (void ) isn't entirely safe, since sizeof(void) may be different from sizeof(cmpfunc*) on some platforms.

Do you know of a platform where this is actually the case? I wouldn't mind making that an #error (i.e. having it fail at compile time already).

Regards, Martin



More information about the Python-Dev mailing list