Skip to content
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

bpo-34373: fix test_mktime and test_pthread_getcpuclickid tests on AIX #8726

Merged
merged 7 commits into from
Dec 28, 2018

Conversation

aixtools
Copy link
Contributor

@aixtools aixtools commented Aug 10, 2018

fix test_mktime and test_pthread_getcpuclickid tests
add range checking for _PyTime_localtime (for AIX)

https://bugs.python.org/issue34373

add range checking for _PyTime_localtime (for AIX)
clk = mktime(&buf);
buf.tm_year = year;

if (buf.tm_wday != -1 && days)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use braces here according to PEP 7.

int days = 0;

/* year < 1970 */
if (year < 70) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, put the braces in the same line as the "if" (https://www.python.org/dev/peps/pep-0007/#id5)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I was wondering if this might be useful for other platforms as well (that cannot handle negative times) - so I put it in additional brackets. I'll use your recommendation and make it "AIX only".

Copy link
Member

@pablogsal pablogsal Aug 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aixtools Mi comment only refers to a style issue (the braces should open on the same line and not in a new line:

if (year < 70) do {
...
}

as opposed to

if (year < 70) do 
{
...
}

Modules/timemodule.c Outdated Show resolved Hide resolved
Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly looks good to me, just one question regarding whether or not the ctypes dependency in the test case can be avoided (hence the approving review, rather than an immediate merge).

Lib/test/test_time.py Outdated Show resolved Hide resolved
@ncoghlan ncoghlan merged commit e2926b7 into python:master Dec 28, 2018
@vstinner
Copy link
Member

vstinner commented Apr 8, 2019

tt is now modified before it is checked if it's equal to (time_t)-1. It looks like a regression to me: I wrote PR #12726 to propose a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants