Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.3k
gh-80620: Support negative values infromtimestamp
on Windows using 0 +timedelta
#134461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
6704876
a3e5749
7453c3c
15c5520
329db66
34c999f
0dd521f
44bcfd9
e675d63
02082f7
cb2f911
057dd79
5d9db9d
77a8b11
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -3267,17 +3267,17 @@ date_fromtimestamp(PyObject *cls, PyObject *obj) | ||
tm.tm_mon + 1, | ||
tm.tm_mday, | ||
cls); | ||
jhohm marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
if (date == NULL) { | ||
return NULL; | ||
} | ||
PyObject *result = NULL; | ||
PyObject *delta = new_delta(0, (int)t, 0, normalize); | ||
jhohm marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
if (delta == NULL) { | ||
Py_XDECREF(date); | ||
return NULL; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. You can move negate and result definitions here. There is no need to initialize result to NULL. | ||
result = add_date_timedelta(PyDate_CAST(date), PyDelta_CAST(delta), negate); | ||
Py_XDECREF(delta); | ||
Py_XDECREF(date); | ||
jhohm marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
return result; | ||
} | ||
@@ -5567,17 +5567,17 @@ datetime_from_timestamp(PyObject *cls, TM_FUNC f, PyObject *timestamp, | ||
if (timet < 0) { | ||
int normalize = 1, factor = 1; | ||
PyObject *dt = datetime_from_timet_and_us(cls, f, 0, 0, tzinfo); | ||
if (dt == NULL) { | ||
return NULL; | ||
} | ||
PyObject *result = NULL; | ||
PyObject *delta = new_delta(0, (int)timet, us, normalize); | ||
jhohm marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
if (delta == NULL) { | ||
Py_XDECREF(dt); | ||
return NULL; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. You can move result definition here. There is no need to initialize it to NULL. | ||
result = add_datetime_timedelta(PyDateTime_CAST(dt), PyDelta_CAST(delta), factor); | ||
Py_XDECREF(delta); | ||
Py_XDECREF(dt); | ||
return result; | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.