Skip to content

Cython warning about unsafe nogil cast in parsers.pyx #27372

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

Closed
ghost opened this issue Jul 12, 2019 · 4 comments
Closed

Cython warning about unsafe nogil cast in parsers.pyx #27372

ghost opened this issue Jul 12, 2019 · 4 comments
Labels
Build Library building on various platforms

Comments

@ghost
Copy link

ghost commented Jul 12, 2019

commit 681e6a9b07271a0955e6780e476ab2d7101e549c
Author: Phil Ruffwind <[email protected]> 

    BUG: Segfault due to float_precision='round_trip'
    
    `round_trip` calls back into Python, so the GIL must be held.  It also
    fails to silence the Python exception, leading to spurious errors.
    Closes #15140. 

681e6a9 closed #15140 but introduced a cython warning (seen with 0.29.12)

warning: pandas/_libs/parsers.pyx:1724:34: Casting a GIL-requiring 
function into a nogil function circumvents GIL validation

The commit says it fixes a segfault, while the cython warning suggests this is still unsafe.

The lines in question are

error = _try_double_nogil(parser,
<float64_t (*)(const char *, char **,
char, char, char,
int, int *, int *)
nogil>parser.double_converter_withgil,

@simonjayhawkins simonjayhawkins added the Build Library building on various platforms label Jul 13, 2019
@ShaharNaveh
Copy link
Member

I dont see this error message for

https://github.com/pandas-dev/pandas/blob/493363ef60dd9045888336b5c801b2a3d00e976d/pandas/_libs/parsers.pyx

(Most recent version, at the time of writing this comment)

can we close this issue?

cc @jreback

@jreback
Copy link
Contributor

jreback commented Jan 19, 2020

iirc we just revised this code

cc @jbrockmendel

@jbrockmendel
Copy link
Member

I dont recall messing with this recently; I think @WillAyd did something similar w/r/t gil acquisition recently, but that was in the json code.

@WillAyd
Copy link
Member

WillAyd commented Jan 19, 2020

closed via #30369

@WillAyd WillAyd closed this as completed Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants