pyke/pyke.c: Check conversions hidden inside `KWLIST' and `KWMETH'.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 20 Oct 2019 18:24:37 +0000 (19:24 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 11 Apr 2020 11:44:14 +0000 (12:44 +0100)
commitdce47d5020064fb1fc0c58db165d72c7ffd10835
treec8197476a1f3cf200525eb36a22027a260943603
parentfcfa1c8692de00ec31dfedf5614428df571b7441
pyke/pyke.c: Check conversions hidden inside `KWLIST' and `KWMETH'.

Introduce a new macro `CONVERT_CAREFULLY' which checks (via a rather
sleazy hack) that its operand is of the expected type before converting
it to some other type.  This is protected by an `#ifdef' guard because
I'm thinking about adding it to a version of mLib, but I want to keep
the Pyke core independent of mLib.

Use this new macro to build better versions of `KWLIST' and `KWMETH',
which have casts hidden inside them, so that we can now be certain that
the method table entries match up with the functions.  (Spoiler: they
didn't, quite, and commit 19bff42f99d41cd9b8953ff61edfe35380b54d88,
backported onto the 1.1.x branch, fixes the bug that was found by this
change.)
pyke.h