Skip to content

MAINT: refactor datetime.c_metadata creation #12437

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 1 commit into from
Nov 25, 2018

Conversation

mattip
Copy link
Member

@mattip mattip commented Nov 22, 2018

Refactor the creation of datetime64.c_metadata. Spun off of PR #12430. Part of making dtype into a PyTypeObject

@mattip mattip force-pushed the refactor-datetime-metadata branch from bc0ca1b to 0aec1d1 Compare November 22, 2018 14:22
@eric-wieser
Copy link
Member

Would be good to finish this up - just needs a decision about the static vs NPY_NO_EXPORT, and the comment being made consistent with the choice. I don't really care which you pick.

}

/*
* Initializes the c_metadata field
Copy link
Member

Choose a reason for hiding this comment

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

This comment is no longer accurate, since it does not initialize any static objects, nor does it touch the c_metadata field.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

* Initializes the c_metadata field
*/
static NpyAuxData*
_get_builtin_datetime_metadata(void)
Copy link
Member

Choose a reason for hiding this comment

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

Optional: could change the signature to _create_datetime_metadata(base, num), and move the actual defaults to the call site

Copy link
Member Author

Choose a reason for hiding this comment

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

adopted

@mattip mattip force-pushed the refactor-datetime-metadata branch from 743fca8 to f4fd8bd Compare November 25, 2018 06:03
@eric-wieser
Copy link
Member

Out of date comment again on line 4209, otherwise looks good

@mattip mattip force-pushed the refactor-datetime-metadata branch from f4fd8bd to 2552e57 Compare November 25, 2018 06:24
@eric-wieser
Copy link
Member

Coverage report is nonsensical - the coverage markers don't match up with source lines in a way that makes sense. Any ideas, @tylerjereddy?

@eric-wieser eric-wieser merged commit d7e411b into numpy:master Nov 25, 2018
@tylerjereddy
Copy link
Contributor

tylerjereddy commented Nov 25, 2018

@eric-wieser I think I see what you mean -- some of the markers are on terminating braces while conditional statements and blocks of code seem to get ignored for some reason.

On the other hand, what can we reasonably expect codecov to do with a source file in a custom template language that looks a bit like C, but that it doesn't really know anything about?

Ideally we'd be able to just track the generated .c files and ignore the .src files? I'm guessing that tracking generated (but not under source control) .c files is maybe not straightforward w/ codecov, but I could be wrong.

Maybe ignoring the .src files is appropriate to reduce reviewer confusion / burden for the time being, with an issue open to make this better someday.

I've not had much success with fine-tuning codecov settings--we know it isn't super well-behaved (Ralf will tell you this & it is completely hosed for SciPy now) but not many better options unless we i.e., run cov ourselves and have a script parse it & keep the html in artifact like we started doing for CircleCI docs.

There are definitely some very nice coverage-analysis / html display tools out there, including Python libraries we could just pip install during CI. That would allow us to have really fine-grained control over things. I probably have a little too much fun working on devops stuff though, and the usual caveats about reinventing the wheel might apply I guess, but in this case the wheel is pretty bad to start with.

@eric-wieser
Copy link
Member

what can we reasonably expect codecov to do with a source file in a custom template language that looks a bit like C, but that it doesn't really know anything about?

What surprises me is that it seems to be so close to behaving correctly - on the order of 5-10 lines out of place. I think our generated code has some magic markers in it to tell gcc what the source line numbers are. Perhaps there's an off-by-one error in those?

@mattip mattip deleted the refactor-datetime-metadata branch March 4, 2019 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants