From 194b31ea6a47a103f4401554755ed904a7f2838e Mon Sep 17 00:00:00 2001 From: Adam Reeve Date: Fri, 11 Oct 2024 03:27:19 +1300 Subject: [PATCH] fix(python): Remove incorrect warning when using an `IO[bytes]` instance (#19154) --- crates/polars-python/src/file.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/crates/polars-python/src/file.rs b/crates/polars-python/src/file.rs index 33d084c5130c..1aab5d9c5829 100644 --- a/crates/polars-python/src/file.rs +++ b/crates/polars-python/src/file.rs @@ -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}; @@ -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 @@ -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