Skip to content

CLN: fix build warning in c_timestamp.pyx #27423

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 2 commits into from Jul 20, 2019
Merged

CLN: fix build warning in c_timestamp.pyx #27423

merged 2 commits into from Jul 20, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jul 16, 2019

pandas/_libs/tslibs/c_timestamp.c: In function ‘__pyx_f_6pandas_5_libs_6tslibs_11c_timestamp_10_Timestamp__get_start_end_field’:
pandas/_libs/tslibs/c_timestamp.c:7257:25: warning: ‘__pyx_t_10’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 7257 |   __pyx_t_5numpy_int8_t __pyx_t_10[1];
      |  

Retrying fix dropped from #27371

a review comment there disliked reintroducing ndarray here because the file had been converted to using memoryviews. get_start_end_field returns a view of type npy_bool soout should therefore be either a memoryview or an ndarray, and bool memoryviews will only be supported in cython 0.30
(see cython/cython/pull/2676).

@WillAyd
Copy link
Member

WillAyd commented Jul 16, 2019

Haven't closely followed that conversation or checked links so apologies if stupid question but does a unit8 memory view not work in the meantime? IIRC we've used that in the past instead

@ghost
Copy link
Author

ghost commented Jul 16, 2019

No, that's a reasonable question. But no, that doesn't work either because on cython<0.30 bool arrays require an explicit cast in the cdef even for assigning to a ndarray[npy_bool], while memory views just don't work. If you try a memory view (bool or int8_t) what you get is

ValueError: Does not understand character buffer dtype format string ('?')

The linked cython PR fixes this in the next release.

@jbrockmendel
Copy link
Member

It looks like the linked cython issue makes it unnecessary to specify cast=True in some ndarray declarations. We use that in a few places, so once we update to require cython>=0.30.0, feel free to take point on removing that no-longer-necessary usage

@ghost
Copy link
Author

ghost commented Jul 17, 2019

ok. There's also the conditional gil support in 0.30 which is needed. Should probably update soon after release.

@jreback jreback added Clean Internals Related to non-user accessible pandas implementation labels Jul 18, 2019
@jreback jreback added this to the 1.0 milestone Jul 20, 2019
@jreback jreback merged commit 5bd57f9 into pandas-dev:master Jul 20, 2019
@ghost ghost deleted the warning2 branch July 20, 2019 21:38
quintusdias pushed a commit to quintusdias/pandas_dev that referenced this pull request Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Internals Related to non-user accessible pandas implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants