Skip to content
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

Read_Ncol crashes when being passed a pandas dataframe #446

Closed
vtraag opened this issue Oct 13, 2021 · 4 comments
Closed

Read_Ncol crashes when being passed a pandas dataframe #446

vtraag opened this issue Oct 13, 2021 · 4 comments
Assignees
Labels
todo Triaged for implementation in some unspecified future version
Milestone

Comments

@vtraag
Copy link
Member

vtraag commented Oct 13, 2021

Describe the bug
When a pandas dataframe is passed to Graph.Read_Ncol it crashes. Of course, a dataframe should not be passed to Graph.Read_Ncol, but this should not cause the Python session to crash, but should be correctly handled.

To reproduce

import igraph as ig
import pandas as pd
df = pd.DataFrame({'from': [1, 2],
                   'to': [2, 3]})
g = ig.Graph.Read_Ncol(df)

Version information
This is using version 0.9.6 installed from conda.

ntamas added a commit that referenced this issue Oct 14, 2021
@ntamas
Copy link
Member

ntamas commented Oct 14, 2021

Can you please try it with the latest dev version? I cannot reproduce it with the dev version on my machine; nevertheless I have added a regression test for it so we can see it in the CI if this fails on some platform.

On my machine, I get an exception like this:

TypeError: argument must be an int, or have a fileno() method

Edit: don't bother, there are CI failures so it looks like it's a genuine problem, at least with older versions of Python. I'll investigate a bit more.

@ntamas ntamas added this to the 0.9.7 milestone Oct 14, 2021
@ntamas ntamas self-assigned this Oct 14, 2021
@ntamas ntamas added bug todo Triaged for implementation in some unspecified future version labels Oct 14, 2021
@ntamas
Copy link
Member

ntamas commented Oct 14, 2021

Strangely enough, I have apparently found a completely unrelated bug in igraphmodule_PyObject_to_edge_type_sw_t(), which seems to have fixed the problem on Python 3.7 on my machine. Let's see how the CI tests go now.

Related commits: be01f01, 78adc9e

@ntamas
Copy link
Member

ntamas commented Oct 14, 2021

@vtraag Can you test now with the latest master to see if the problem is still there on your machine? (CI seems to pass now).

@vtraag
Copy link
Member Author

vtraag commented Oct 15, 2021

I can confirm that using the laster master this no longer crashes, I now also receive the error

TypeError: argument must be an int, or have a fileno() method.

Good to see it fixed, even thought it's not clear how it the original problem relates to the fix.

@vtraag vtraag closed this as completed Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
todo Triaged for implementation in some unspecified future version
Projects
None yet
Development

No branches or pull requests

2 participants