Skip to content

MAINT: Use utf8 strings in more of datetime - #17186

Merged
charris merged 6 commits into
numpy:masterfrom
eric-wieser:datetime-less-bytes
Oct 10, 2020
Merged

charris merged 6 commits into
numpy:masterfrom
eric-wieser:datetime-less-bytes

Conversation

@eric-wieser

@eric-wieser eric-wieser commented Aug 30, 2020 •

Copy link
Copy Markdown
Member

This fixes an omission in a previous patch (#17176) that did not allow μs in datetime_as_string.
This also will very slightly speed up most uses, since all but very unusual code will be passing in str not bytes.

Motivated by #15317.

This fixes an omission in a previous patch that did not allow μs in datetime_as_string.
This also will very slightly speed up most uses, since all but very unusual code will be passing in `str` not `bytes`.
@eric-wieser

Copy link
Copy Markdown
Member Author

Looks like I screwed up the refcounting somewhere...

@eric-wieser
eric-wieser marked this pull request as draft August 30, 2020 12:30
Comment thread numpy/core/src/multiarray/datetime_busday.c Outdated
Comment thread numpy/core/src/multiarray/datetime_busdaycal.c Outdated
Comment thread numpy/core/src/multiarray/datetime_strings.c Outdated
Comment thread numpy/core/src/multiarray/datetime_strings.c Outdated
Comment thread numpy/core/src/multiarray/datetime_busdaycal.c Outdated
@eric-wieser
eric-wieser marked this pull request as ready for review September 23, 2020 14:56
@eric-wieser
eric-wieser requested a review from seberg September 26, 2020 13:45

@seberg seberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I would prefer to change the Py_ssize_t since we are here. The other comments are just potential nitpicks.

Comment thread numpy/core/src/multiarray/datetime_busdaycal.c Outdated
Comment thread numpy/core/src/multiarray/datetime_strings.c Outdated
strobj = timezone_obj;
}

Py_SETREF(timezone_obj, strobj);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This SETREF feels a bit weird, since it is just strobj. But I guess you wanted to keep the unicode-convert code snippet is always identical?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But I guess you wanted to keep the unicode-convert code snippet is always identical?

Yeah, I think that was my thought. I'd considered extracting it to a helper function a some point, likely bundling a deprecation warning because there's no reason to accept byte-strings here anyway.

@seberg

seberg commented Sep 29, 2020

Copy link
Copy Markdown
Member

Btw. I hesitated with merging, because I thought codecov has a point and some tests should just use byte strings. But I am willing to just push that some time myself, just didn't do it yet.

@charris
charris merged commit bb6b86e into numpy:master Oct 10, 2020
@charris

charris commented Oct 10, 2020

Copy link
Copy Markdown
Member

Thanks Eric.

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