Skip to content

Conversation

@jbrockmendel
Copy link
Member

cc @seberg was there a change in the ufunc code in the last day or so that might lead to a TypeError getting turned into a SystemError?

@seberg
Copy link
Contributor

seberg commented Mar 1, 2021

Hmm, yeah, it could be numpy/numpy#18450 which is backported to the 1.20.x branch, so we may want to take care here.

I would expected the opposite, SystemError getting turned into TypeError (i.e. bad/weird error being made OK), if the opposite happened here, we should look into it maybe. Do you have a reproducer?!

@jbrockmendel
Copy link
Member Author

Do you have a reproducer?!

https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=55279&view=logs&j=eab14f69-13b6-5db7-daeb-7b778629410b&t=ce687173-08c6-5301-838d-71b2dda24510&l=43

I haven't tried it locally, but this is a copy-pasteable version of whats failing on the CI.

import pandas as pd
import pandas._testing as tm

data = pd.array([True, True, pd.NA, pd.NA, False, False, True])
df = pd.DataFrame({"A": [1, 1, 2, 2, 3, 3, 1], "B": data})
result = df.groupby("A").B.apply(lambda x: x.array)
expected = pd.Series(
            [
                df.B.iloc[[0, 1, 6]].array,
                df.B.iloc[[2, 3]].array,
                df.B.iloc[[4, 5]].array,
            ],
            index=pd.Index([1, 2, 3], name="A"),
            name="B",
        )
tm.assert_series_equal(result, expected)

@seberg
Copy link
Contributor

seberg commented Mar 2, 2021

Thanks, that was perfect, already found the issue. (If you run it in a python debug version, by default this already causes an assert, and that means you immediately get a gdb stacktrace, which trivially finds the issue – it was a simple oversight in that PR I linked.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants