Skip to content

Commit

Permalink
fix(python): Remove incorrect warning when using an IO[bytes] insta…
Browse files Browse the repository at this point in the history
…nce (#19154)
  • Loading branch information
adamreeve authored Oct 10, 2024
1 parent 9162f67 commit 194b31e
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions crates/polars-python/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::os::fd::{FromRawFd, RawFd};
use std::path::PathBuf;

use polars::io::mmap::MmapBytesReader;
use polars_error::{polars_err, polars_warn};
use polars_error::polars_err;
use pyo3::exceptions::PyTypeError;
use pyo3::prelude::*;
use pyo3::types::{PyBytes, PyString, PyStringMethods};
Expand Down Expand Up @@ -284,14 +284,6 @@ pub fn get_python_scan_source_input(
}));
}

// BytesIO / StringIO is relatively fast, and some code relies on it.
if !py_f.is_exact_instance(&io.getattr("BytesIO").unwrap())
&& !py_f.is_exact_instance(&io.getattr("StringIO").unwrap())
{
polars_warn!("Polars found a filename. \
Ensure you pass a path to the file instead of a python file object when possible for best \
performance.");
}
// Unwrap TextIOWrapper
// Allow subclasses to allow things like pytest.capture.CaptureIO
let py_f = if py_f
Expand Down Expand Up @@ -397,14 +389,6 @@ fn get_either_buffer_or_path(
));
}

// BytesIO / StringIO is relatively fast, and some code relies on it.
if !py_f.is_exact_instance(&io.getattr("BytesIO").unwrap())
&& !py_f.is_exact_instance(&io.getattr("StringIO").unwrap())
{
polars_warn!("Polars found a filename. \
Ensure you pass a path to the file instead of a python file object when possible for best \
performance.");
}
// Unwrap TextIOWrapper
// Allow subclasses to allow things like pytest.capture.CaptureIO
let py_f = if py_f
Expand Down

0 comments on commit 194b31e

Please sign in to comment.