field.c, mp.c: Implement the `nb_index' conversion.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 18 Nov 2019 14:52:54 +0000 (14:52 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 11 Apr 2020 11:44:21 +0000 (12:44 +0100)
commita90a9c0e9ffe3a1cc1e4fd82d9551903e706e953
tree624c13e530821edf43d300b0fa066257ca6b9edb
parente147daf097cd963c3d24fa4afeb74551653c96b2
field.c, mp.c: Implement the `nb_index' conversion.

This is Yet Another Integer Conversion added in 2.5, for the purpose of
/implicit/ conversions (since strings and other strange things will
convert explicitly to integers).

It's significant because the `bin' builtin (conversion to base-2 string,
added in 2.6) works by applying the `index' conversion rather than
having a special-purpose method like `hex' and `oct'.  (Indeed, Python 3
abolishes these methods, and `hex' and `oct' convert via `index' too.)

So add conversions somewhat judiciously.
field.c
mp.c
t/t-mp.py