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>
Mon, 25 Nov 2019 17:43:08 +0000 (17:43 +0000)
commit19425639b5e7ffaeba6400cc0c76185f8aea0b26
tree4fccdcae07881de96198a0b36de3998ae6ef5a15
parentd8b378471c7e11b71d5accb62cee6474a33025aa
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/pyke.h