| 2203 | |
| 2204 | |
| 2205 | def test_read_csv_gil_deadlock(): |
| 2206 | # GH-38676 |
| 2207 | # This test depends on several preconditions: |
| 2208 | # - the CSV input is a Python file object |
| 2209 | # - reading the CSV file produces an error |
| 2210 | data = b"a,b,c" |
| 2211 | |
| 2212 | class MyBytesIO(io.BytesIO): |
| 2213 | def read(self, *args): |
| 2214 | time.sleep(0.001) |
| 2215 | return super().read(*args) |
| 2216 | |
| 2217 | def readinto(self, *args): |
| 2218 | time.sleep(0.001) |
| 2219 | return super().readinto(*args) |
| 2220 | |
| 2221 | for i in range(20): |
| 2222 | with pytest.raises(pa.ArrowInvalid): |
| 2223 | read_csv(MyBytesIO(data)) |
| 2224 | |
| 2225 | |
| 2226 | @pytest.mark.parametrize("tables,expected", [ |