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>
Mon, 25 Nov 2019 17:43:08 +0000 (17:43 +0000)
commit8aafc119905401cd820194d547018043510b1f88
tree9416ab27f5c22f460bae48614d1a034acadd7aad
parentf5e4ddca5f96c25ab981fdce20178473cbcf621d
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