diff --git a/pandas/io/parsers/readers.py b/pandas/io/parsers/readers.py index 54877017f76fc..67193f930b4dc 100644 --- a/pandas/io/parsers/readers.py +++ b/pandas/io/parsers/readers.py @@ -1219,8 +1219,7 @@ def _get_options_with_defaults(self, engine: CSVEngine) -> dict[str, Any]: and value != getattr(value, "value", default) ): raise ValueError( - f"The {argname!r} option is not supported with the " - f"'pyarrow' engine" + f"The {argname!r} option is not supported with the 'pyarrow' engine" ) options[argname] = value @@ -1396,8 +1395,7 @@ def _clean_options( if not is_integer(skiprows) and skiprows is not None: # pyarrow expects skiprows to be passed as an integer raise ValueError( - "skiprows argument must be an integer when using " - "engine='pyarrow'" + "skiprows argument must be an integer when using engine='pyarrow'" ) else: if is_integer(skiprows): diff --git a/pandas/util/_exceptions.py b/pandas/util/_exceptions.py index b3c8e54d3ca7f..4570c7f9c148f 100644 --- a/pandas/util/_exceptions.py +++ b/pandas/util/_exceptions.py @@ -50,7 +50,7 @@ def find_stack_level() -> int: try: n = 0 while frame: - filename = inspect.getfile(frame) + filename = frame.f_code.co_filename if filename.startswith(pkg_dir) and not filename.startswith(test_dir): frame = frame.f_back n += 1