[New-bugs-announce] [issue8952] Doc/c-api/arg.rst: fix documentation of number formats
report at bugs.python.org
Wed Jun 9 12:34:48 CEST 2010
New submission from STINNER Victor <victor.stinner at haypocalc.com>:
The documentation of PyArg_Parse*() number formats specify that only int / float / complex are accepted, whereas any int / float / complex compatible object is accepted. "compatible" means that it has an __int__() / __float__() / __complex__() method, or nb_int / nb_float of Py_TYPE(obj)->tp_as_number->nb_int is defined (tp_as_number has no nb_complex).
I suppose that the following paragraph is also outdated:
"It is possible to pass "long" integers (integers whose value exceeds the
platform's :const:`LONG_MAX`) however no proper range checking is done --- the
most significant bits are silently truncated when the receiving field is too
small to receive the value (actually, the semantics are inherited from downcasts
in C --- your mileage may vary)."
Moreover, "without overflow checking" should be explained (Mark told me that the number is truncated to a power of 2).
assignee: docs at python
components: Documentation, Interpreter Core
nosy: docs at python, haypo, mark.dickinson
title: Doc/c-api/arg.rst: fix documentation of number formats
versions: Python 3.2
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce