(original) (raw)

On Tue, Apr 2, 2013 at 1:44 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:
int() and operator.index() are both type coercion calls to produce true Python integers - they will never return a subclass, and this is both deliberate and consistent with all the other builtin types that accept an instance of themselves as input to the constructor.

That's good to hear.
There's code in the slot wrappers so that if you return a non-int object from either \_\_int\_\_ or \_\_index\_\_, then the interpreter will complain about it, and if you return a subclass, it will be stripped back to just the base class.

Can you point me to that code? All I could find was PyLong\_Check calls (I was looking for PyLong\_CheckExact).

Mark