* Check the descriptor is a legacy "flexible" DType instance, this is * an instance which is (normally) not attached to an array, such as a string * of length 0 or a datetime with no unit. * These should be largely deprecated, and represent only the DType class * for most `dtype` parameters. * * TODO: This function should eventually receive a deprecation warning and * be removed. *
| 1405 | * @return 1 if this is not a concrete dtype instance 0 otherwise |
| 1406 | */ |
| 1407 | static int |
| 1408 | descr_is_legacy_parametric_instance(PyArray_Descr *descr, |
| 1409 | PyArray_DTypeMeta *DType) |
| 1410 | { |
| 1411 | if (!NPY_DT_is_legacy(DType)) { |
| 1412 | return 0; |
| 1413 | } |
| 1414 | |
| 1415 | if (PyDataType_ISUNSIZED(descr)) { |
| 1416 | return 1; |
| 1417 | } |
| 1418 | /* Flexible descr with generic time unit (which can be adapted) */ |
| 1419 | if (PyDataType_ISDATETIME(descr)) { |
| 1420 | PyArray_DatetimeMetaData *meta; |
| 1421 | meta = get_datetime_metadata_from_dtype(descr); |
| 1422 | if (meta->base == NPY_FR_GENERIC) { |
| 1423 | return 1; |
| 1424 | } |
| 1425 | } |
| 1426 | return 0; |
| 1427 | } |
| 1428 | |
| 1429 | |
| 1430 | /** |
no test coverage detected