Skip to content

MAINT: Use utf8 strings in more of datetime#17186

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

MAINT: Use utf8 strings in more of datetime#17186
charris merged 6 commits intonumpy:masterfrom
eric-wieser:datetime-less-bytes

Conversation

@eric-wieser
Copy link
Member

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

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
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
@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
Copy link
Member

@seberg seberg left a comment

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.

strobj = timezone_obj;
}

Py_SETREF(timezone_obj, strobj);
Copy link
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
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.

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
@seberg
Copy link
Member

seberg commented Sep 29, 2020

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
Copy link
Member

charris commented Oct 10, 2020

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