Hello,
Defining a user type which implements number protocol should be treated as a 
number (long) in PyArg_ParseTuple using "l" format.
In getargs.c:
        case 'l': {/* long int */
                long *p = va_arg(*p_va, long *);
                long ival;
                if (float_argument_error(arg))
                        return converterr("integer<l>", arg, msgbuf, bufsize);
                ival = PyLong_AsLong(arg);

                if (ival == -1 && PyErr_Occurred())
                        return converterr("integer<l>", arg, msgbuf, bufsize);
                else
                        *p = ival;
                break;
        }
ival should not be resolved through PyLong_AsLong, but through 
functionality/interface like PyNumber_Long, thus allowing more diversity in 
accessing the PyArg_Parse interfaces.

Petre

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to