Skip to content

Commit 1ad041d

Browse files
committed
Fix wrong condition check
1 parent a6f4b9e commit 1ad041d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/xopen/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def _filepath_from_path_or_filelike(fileorpath: FileOrPath) -> str:
732732
def _file_is_a_socket_or_pipe(filepath):
733733
try:
734734
mode = os.stat(filepath).st_mode
735-
return not (stat.S_ISFIFO(mode) or stat.S_ISSOCK(mode) or stat.S_ISPORT(mode))
735+
return stat.S_ISFIFO(mode) or stat.S_ISSOCK(mode) or stat.S_ISPORT(mode)
736736
except (OSError, TypeError): # Type error for unexpected types in stat.
737737
return False
738738

tests/test_xopen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ def test_pass_bytesio_for_reading_and_writing(ext, threads):
642642
def test_xopen_stdin(monkeypatch, ext, threads):
643643
if ext == ".zst" and zstandard is None:
644644
return
645-
with open(TEST_DIR / f"file.txt{ext}") as in_file:
645+
with open(TEST_DIR / f"file.txt{ext}", "rt") as in_file:
646646
monkeypatch.setattr("sys.stdin", in_file)
647647
with xopen("-", "rt", threads=threads) as f:
648648
data = f.read()

0 commit comments

Comments
 (0)