Skip to content

BUG: downstream segfault with Cython >= 3.0a5 #4394

@tylerjereddy

Description

@tylerjereddy

In short, we're seeing a segfault for a pickle-related line of code when using Cython >= 3.0a5, but not stable release or pre-release versions prior to that. The original issue description downstream is scipy/scipy#14732, but I will also paste the problematic code block for quick inspection (from Ralf's original description)--the last line below segfaults:

    def test_pickleable(self):
        # Make sure we can pickle and unpickle the interpolant without any
        # changes in the behavior.
        seq = Halton(1, scramble=False, seed=np.random.RandomState())

        x = 3*seq.random(50)
        xitp = 3*seq.random(50)

        y = _1d_test_function(x)

        interp = self.build(x, y)

        yitp1 = interp(xitp)
        yitp2 = pickle.loads(pickle.dumps(interp))(xitp)

While that doesn't exactly give you an isolated/minimal reproducer since it is buried in the depths of SciPy, perhaps you have suggestions for avoiding the segfault? For now, I'll propose using <3.0a5 in our pre-release tests in the absence of another way to avoid the segfault: scipy/scipy#14801

Although I did bisect Cython versions carefully with the reproducer below, I did not yet check to see if the usage of multiple threads by the test suite was contributing to the problem:

python runtests.py -t "scipy/interpolate/tests/test_rbfinterp.py" -- -n 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions