From 6a388be60a3320b95fd74a8ab2b00e7dbebfd215 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 24 Mar 2022 02:25:07 -0700 Subject: [PATCH 1/3] Add note concerning overflow in `asarray` --- spec/API_specification/signatures/creation_functions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/API_specification/signatures/creation_functions.py b/spec/API_specification/signatures/creation_functions.py index 39692e471..24f06ee37 100644 --- a/spec/API_specification/signatures/creation_functions.py +++ b/spec/API_specification/signatures/creation_functions.py @@ -62,6 +62,9 @@ def asarray(obj: Union[array, bool, int, float, NestedSequence, SupportsBufferPr If ``dtype`` is not ``None``, then array conversions should obey :ref:`type-promotion` rules. Conversions not specified according to :ref:`type-promotion` rules may or may not be permitted by a conforming array library. To perform an explicit cast, use :func:`signatures.data_type_functions.astype`. + .. note:: + If an input value exceeds the precision of the resolved output array data type, behavior is left unspecified and, thus, implementation-defined. + device: Optional[device] device on which to place the created array. If ``device`` is ``None`` and ``x`` is an array, the output array device must be inferred from ``x``. Default: ``None``. copy: Optional[bool] From 0f02b841a7432e67c0a6d772e893f1626c3eb89f Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 24 Mar 2022 02:30:01 -0700 Subject: [PATCH 2/3] Update notes --- spec/API_specification/signatures/creation_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/signatures/creation_functions.py b/spec/API_specification/signatures/creation_functions.py index 24f06ee37..c941d4ba5 100644 --- a/spec/API_specification/signatures/creation_functions.py +++ b/spec/API_specification/signatures/creation_functions.py @@ -171,7 +171,7 @@ def full(shape: Union[int, Tuple[int, ...]], fill_value: Union[int, float], *, d output array data type. If ``dtype`` is ``None``, the output array data type must be inferred from ``fill_value``. If the fill value is an ``int``, the output array data type must be the default integer data type. If the fill value is a ``float``, the output array data type must be the default floating-point data type. If the fill value is a ``bool``, the output array must have boolean data type. Default: ``None``. .. note:: - If ``dtype`` is ``None`` and the ``fill_value`` exceeds the precision of the resolved default output array data type, behavior is left unspecified and, thus, implementation-defined. + If the ``fill_value`` exceeds the precision of the resolved default output array data type, behavior is left unspecified and, thus, implementation-defined. device: Optional[device] device on which to place the created array. Default: ``None``. @@ -196,7 +196,7 @@ def full_like(x: array, /, fill_value: Union[int, float], *, dtype: Optional[dty output array data type. If ``dtype`` is ``None``, the output array data type must be inferred from ``x``. Default: ``None``. .. note:: - If ``dtype`` is ``None`` and the ``fill_value`` exceeds the precision of the resolved output array data type, behavior is unspecified and, thus, implementation-defined. + If the ``fill_value`` exceeds the precision of the resolved output array data type, behavior is unspecified and, thus, implementation-defined. .. note:: If ``dtype`` is ``None`` and the ``fill_value`` has a data type (``int`` or ``float``) which is not of the same data type kind as the resolved output array data type (see :ref:`type-promotion`), behavior is unspecified and, thus, implementation-defined. From 1d6095a9a60c37f80defe56154db476bb8427e6f Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 24 Mar 2022 02:32:54 -0700 Subject: [PATCH 3/3] Update note --- spec/API_specification/signatures/creation_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/signatures/creation_functions.py b/spec/API_specification/signatures/creation_functions.py index c941d4ba5..7c46aafac 100644 --- a/spec/API_specification/signatures/creation_functions.py +++ b/spec/API_specification/signatures/creation_functions.py @@ -199,7 +199,7 @@ def full_like(x: array, /, fill_value: Union[int, float], *, dtype: Optional[dty If the ``fill_value`` exceeds the precision of the resolved output array data type, behavior is unspecified and, thus, implementation-defined. .. note:: - If ``dtype`` is ``None`` and the ``fill_value`` has a data type (``int`` or ``float``) which is not of the same data type kind as the resolved output array data type (see :ref:`type-promotion`), behavior is unspecified and, thus, implementation-defined. + If the ``fill_value`` has a data type (``int`` or ``float``) which is not of the same data type kind as the resolved output array data type (see :ref:`type-promotion`), behavior is unspecified and, thus, implementation-defined. device: Optional[device] device on which to place the created array. If ``device`` is ``None``, the output array device must be inferred from ``x``. Default: ``None``.