This function calls Py_DECREF on flex_dtype, and replaces it with a new dtype that has been adapted based on the values in data_dtype and data_obj. If the flex_dtype is not flexible, it leaves it as is.
The current flexible dtypes include NPY_STRING, NPY_UNICODE, NPY_VOID, and NPY_DATETIME with generic units.
This function calls Py_DECREF on flex_dtype, and replaces it with a new dtype that has been adapted based on the values in data_dtype and data_obj. If the flex_dtype is not flexible, it leaves it as is.
Usually, if data_obj is not an array, dtype should be the result given by the PyArray_GetArrayParamsFromObject function.
The data_obj may be NULL if just a dtype is is known for the source.
If
*flex_dtype is NULL, returns immediately, without setting an exception. This basically assumes an error was already set previously.
System Message: WARNING/2 (
<string>
, line 10);
backlink Inline emphasis start-string without end-string.
The current flexible dtypes include NPY_STRING, NPY_UNICODE, NPY_VOID, and NPY_DATETIME with generic units.
Flexible types with expandable size
First replace the flex dtype
Get a string-size estimate of the input. These are generallly the size needed, rounded up to a multiple of eight.
5 chars needed for cast to 'True' or 'False'
Element size should never be greater than 8 or less than 0 for integer type, but just in case...
Add character for sign symbol
Convert data array to list of objects since GetArrayParamsFromObject won't iterate over array.
We should never get here, but just in case someone adds a new flex dtype...
Flexible type with generic time unit that adapts
Detect the unit from the input's data
Referenced by get_nbo_datetime_to_string_transfer_function().