[Python-checkins] python/dist/src/Modules datetimemodule.c,1.41,1.42
Neal Norwitz
neal@metaslash.com
Thu, 23 Jan 2003 11:56:40 -0500
> + delta = off - dst;
> + mm += delta;
> + if ((mm < 0 || mm >= 60) &&
> + normalize_datetime(&y, &m, &d, &hh, &mm, &ss, &us) < 0)
> + goto Fail;
Shouldn't this be return NULL? result doesn't seem to be set yet.
> + result = new_datetime(y, m, d, hh, mm, ss, us, dt->tzinfo);
> + if (result == NULL)
> + return result;
> +
> + dst = call_dst(dt->tzinfo, result, &none);
> + if (dst == -1 && PyErr_Occurred())
> + goto Fail;
> + if (none)
> + goto Inconsistent;
> + if (dst == 0)
> + return result;
> +
> + mm += dst;
> + if ((mm < 0 || mm >= 60) &&
> + normalize_datetime(&y, &m, &d, &hh, &mm, &ss, &us) < 0)
> + goto Fail;
> + Py_DECREF(result);
> + result = new_datetime(y, m, d, hh, mm, ss, us, dt->tzinfo);
> + return result;
> +
> + Inconsistent:
> + PyErr_SetString(PyExc_ValueError, "fromutc: tz.dst() gave"
> + "inconsistent results; cannot convert");
> +
> + /* fall thru to failure */
> + Fail:
> + Py_DECREF(result);
> + return NULL;
> + }