Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-1635741: Enhance _datetime error handling #23139

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
pr comments
  • Loading branch information
koubaa committed Nov 20, 2020
commit 0daff778717a47ad257708e9788994e1a8bda9cc
13 changes: 3 additions & 10 deletions 13 Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6522,10 +6522,10 @@ _datetime_exec(PyObject *module)
if (PyType_Ready(&PyDateTime_IsoCalendarDateType) < 0) {
return -1;
}
Py_INCREF(&PyDateTime_IsoCalendarDateType);

#define DATETIME_ADD_MACRO(dict, c, value) \
#define DATETIME_ADD_MACRO(dict, c, value_expr) \
do { \
koubaa marked this conversation as resolved.
Show resolved Hide resolved
PyObject *value = (value_expr); \
if (value == NULL) { \
return -1; \
} \
Expand Down Expand Up @@ -6593,9 +6593,6 @@ _datetime_exec(PyObject *module)

x = create_timezone(delta, NULL);
Py_DECREF(delta);
if (x == NULL) {
return -1;
}
DATETIME_ADD_MACRO(d, "min", x);

delta = new_delta(0, (23 * 60 + 59) * 60, 0, 0); /* +23:59 */
Expand All @@ -6605,17 +6602,13 @@ _datetime_exec(PyObject *module)

x = create_timezone(delta, NULL);
Py_DECREF(delta);
if (x == NULL) {
return -1;
}

DATETIME_ADD_MACRO(d, "max", x);

/* Epoch */
PyDateTime_Epoch = new_datetime(1970, 1, 1, 0, 0, 0, 0,
PyDateTime_TimeZone_UTC, 0);
if (PyDateTime_Epoch == NULL) {
return -1;
return -1;
}

/* module initialization */
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.