Skip to content

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

Closed
@ghost

Description

commit 681e6a9b07271a0955e6780e476ab2d7101e549c
Author: Phil Ruffwind <rf@rufflewind.com> 

    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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    BuildLibrary building on various platforms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions