diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 6f296d3c8d92f..853a982536d40 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -1912,11 +1912,8 @@ def read_stata( if iterator or chunksize: return reader - try: - data = reader.read() - finally: - reader.close() - return data + with reader: + return reader.read() def _set_endianness(endianness: str) -> str: