summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/_datetime.h12
-rw-r--r--numpy/core/src/multiarray/datetime.c66
2 files changed, 1 insertions, 77 deletions
diff --git a/numpy/core/src/multiarray/_datetime.h b/numpy/core/src/multiarray/_datetime.h
index be9bac48c..421b03f93 100644
--- a/numpy/core/src/multiarray/_datetime.h
+++ b/numpy/core/src/multiarray/_datetime.h
@@ -209,18 +209,6 @@ convert_pyobject_to_datetime_metadata(PyObject *obj,
NPY_NO_EXPORT PyObject *
metastr_to_unicode(PyArray_DatetimeMetaData *meta, int skip_brackets);
-/*
- * 'ret' is a PyUString containing the datetime string, and this
- * function appends the metadata string to it.
- *
- * If 'skip_brackets' is true, skips the '[]'.
- *
- * This function steals the reference 'ret'
- */
-NPY_NO_EXPORT PyObject *
-append_metastr_to_string(PyArray_DatetimeMetaData *meta,
- int skip_brackets,
- PyObject *ret);
/*
* Tests for and converts a Python datetime.datetime or datetime.date
diff --git a/numpy/core/src/multiarray/datetime.c b/numpy/core/src/multiarray/datetime.c
index 99b6a24e9..4afc45fb6 100644
--- a/numpy/core/src/multiarray/datetime.c
+++ b/numpy/core/src/multiarray/datetime.c
@@ -1978,7 +1978,7 @@ metastr_to_unicode(PyArray_DatetimeMetaData *meta, int skip_brackets)
if (skip_brackets) {
return PyUnicode_FromString("generic");
}
- /* But with brackets, append nothing */
+ /* But with brackets, return nothing */
else {
return PyUnicode_FromString("");
}
@@ -2014,70 +2014,6 @@ metastr_to_unicode(PyArray_DatetimeMetaData *meta, int skip_brackets)
/*
- * 'ret' is a PyUString containing the datetime string, and this
- * function appends the metadata string to it.
- *
- * If 'skip_brackets' is true, skips the '[]'.
- *
- * This function steals the reference 'ret'
- */
-NPY_NO_EXPORT PyObject *
-append_metastr_to_string(PyArray_DatetimeMetaData *meta,
- int skip_brackets,
- PyObject *ret)
-{
- PyObject *res;
- int num;
- char const *basestr;
-
- if (ret == NULL) {
- return NULL;
- }
-
- if (meta->base == NPY_FR_GENERIC) {
- /* Without brackets, give a string "generic" */
- if (skip_brackets) {
- PyUString_ConcatAndDel(&ret, PyUnicode_FromString("generic"));
- return ret;
- }
- /* But with brackets, append nothing */
- else {
- return ret;
- }
- }
-
- num = meta->num;
- if (meta->base >= 0 && meta->base < NPY_DATETIME_NUMUNITS) {
- basestr = _datetime_strings[meta->base];
- }
- else {
- PyErr_SetString(PyExc_RuntimeError,
- "NumPy datetime metadata is corrupted");
- return NULL;
- }
-
- if (num == 1) {
- if (skip_brackets) {
- res = PyUnicode_FromFormat("%s", basestr);
- }
- else {
- res = PyUnicode_FromFormat("[%s]", basestr);
- }
- }
- else {
- if (skip_brackets) {
- res = PyUnicode_FromFormat("%d%s", num, basestr);
- }
- else {
- res = PyUnicode_FromFormat("[%d%s]", num, basestr);
- }
- }
-
- PyUString_ConcatAndDel(&ret, res);
- return ret;
-}
-
-/*
* Adjusts a datetimestruct based on a seconds offset. Assumes
* the current values are valid.
*/