Skip to content

ENH: port time.pxd from cython #45864

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 5 commits into from
Feb 15, 2022
Merged

Conversation

jbrockmendel
Copy link
Member

Until cython3 is out, we port it here. This will allow a cython implementation of dateutil's tzlocal, which will [yak-shaving] for non-nano dt64/td64.

@jbrockmendel jbrockmendel added the Non-Nano datetime64/timedelta64 with non-nanosecond resolution label Feb 7, 2022
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

Actually, looks like this doesn't build on windows?

building 'pandas._libs.tslibs.ctime' extension
ctime.c
pandas\_libs/tslibs/ctime.c(2383): error C2039: 'tm_zone': is not a member of 'tm'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\corecrt_wtime.h(26): note: see declaration of 'tm'
pandas\_libs/tslibs/ctime.c(2383): error C2198: 'PyBytes_FromString': too few arguments for call
pandas\_libs/tslibs/ctime.c(2386): error C2039: 'tm_gmtoff': is not a member of 'tm'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\corecrt_wtime.h(26): note: see declaration of 'tm'
pandas\_libs/tslibs/ctime.c(2386): error C2198: '__Pyx_PyInt_From_long': too few arguments for call
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

@jbrockmendel
Copy link
Member Author

Actually, looks like this doesn't build on windows?

Well that doesn't look good. @scoder area the analogous tests not run on any windows builds in the cython CI?

@scoder
Copy link

scoder commented Feb 8, 2022

are the analogous tests not run on any windows builds in the cython CI?

libc/time.pxd is different in 0.29.x. It still contains two struct fields that were commented out in 3.0 because they are GNU specific. Removing them from 0.29.x would be a backwards incompatible change, though.

https://github.com/cython/cython/blob/f0ccd6851e80654585fa6acb7a0626bf615857fe/Cython/Includes/libc/time.pxd
cython/cython@1a6bba9

Note that the field declarations shouldn't hurt as long as you're not trying to (auto-)convert the struct into a Python dict. So you can probably get by with adapting the tests Python exposed functions.

@mroeschke
Copy link
Member

pandas/tests/tslibs/test_ctime.py:10: error: Module "pandas._libs.tslibs" has no attribute "ctime" [attr-defined]

@mroeschke mroeschke added this to the 1.5 milestone Feb 14, 2022
@mroeschke mroeschke merged commit cdca67a into pandas-dev:main Feb 15, 2022
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the enh-cytime branch February 15, 2022 06:13
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
* ENH: port time.pxd from cython

* update API test

* manually convert to dict for windows compat

* mypy fixup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Non-Nano datetime64/timedelta64 with non-nanosecond resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants