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)
commitd3ce4a1ba039f2ac1241a5e1603b765b092a6f6d
treec8197476a1f3cf200525eb36a22027a260943603
parent7df9323754a2a083f485444b8fe43c096ed86eab
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