Skip to content

BUG: read_csv with list causes segfault #46407

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
2 of 3 tasks
camillescott opened this issue Mar 17, 2022 · 1 comment
Closed
2 of 3 tasks

BUG: read_csv with list causes segfault #46407

camillescott opened this issue Mar 17, 2022 · 1 comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@camillescott
Copy link

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd

test = ['test.csv']
pd.read_csv(test)

Issue Description

Running this code results in an immediate segfault. Specifying engine = 'python' does not, so presumably bad data is passed to the C engine. If test is a dict, set, or numpy.ndarray, a ValueError is raised as expected.

We discovered this error in a Snakemake rule, where the user passed input, which by default a list, directly to read_csv in a run block. Given Snakemake's popularity, this seems like something that could pop up fairly often.

Expected Behavior

It should raise a ValueError.

Installed Versions

My environment seems to break with this.

File ~/miniconda/envs/dissertation/lib/python3.8/site-packages/setuptools/init.py:8, in
5 import os
6 import re
----> 8 import _distutils_hack.override # noqa: F401
10 import distutils.core
11 from distutils.errors import DistutilsOptionError

File ~/miniconda/envs/dissertation/lib/python3.8/site-packages/_distutils_hack/override.py:1, in
----> 1 import('_distutils_hack').do_override()

File ~/miniconda/envs/dissertation/lib/python3.8/site-packages/_distutils_hack/init.py:71, in do_override()
69 if enabled():
70 warn_distutils_present()
---> 71 ensure_local_distutils()

File ~/miniconda/envs/dissertation/lib/python3.8/site-packages/_distutils_hack/init.py:59, in ensure_local_distutils()
57 # check that submodules load as expected
58 core = importlib.import_module('distutils.core')
---> 59 assert '_distutils' in core.file, core.file

AssertionError: /home/camille/miniconda/envs/dissertation/lib/python3.8/distutils/core.py

@camillescott camillescott added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 17, 2022
@mroeschke
Copy link
Member

Thanks for the report. This was a duplicate of #45957 which was fixed in #46325, planned to be released in 1.4.2 soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants