pyodide/packages/pandas/patches/avoid-mmap.patch

35 lines
1.1 KiB
Diff

diff --git a/pandas/io/common.py b/pandas/io/common.py
index ac9077f2d..9303fe721 100644
--- a/pandas/io/common.py
+++ b/pandas/io/common.py
@@ -3,7 +3,10 @@
import os
import csv
import codecs
-import mmap
+try:
+ from mmap import mmap
+except ImportError:
+ mmap = type(None)
from contextlib import contextmanager, closing
import zipfile
@@ -210,7 +213,7 @@ def get_filepath_or_buffer(filepath_or_buffer, encoding=None,
if isinstance(filepath_or_buffer, (compat.string_types,
compat.binary_type,
- mmap.mmap)):
+ mmap)):
return _expand_user(filepath_or_buffer), None, compression, False
if not is_file_like(filepath_or_buffer):
@@ -464,7 +467,7 @@ class MMapWrapper(BaseIterator):
"""
def __init__(self, f):
- self.mmap = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
+ self.mmap = mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
def __getattr__(self, name):
return getattr(self.mmap, name)