Skip to content

Commit 1f3ccaa

Browse files
committed
refactor: replace IOError with OSError
<https://peps.python.org/pep-3151/>
1 parent 56b5ad8 commit 1f3ccaa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

gunicorn/http/errors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ParseException(Exception):
1313
pass
1414

1515

16-
class NoMoreData(IOError):
16+
class NoMoreData(OSError):
1717
def __init__(self, buf=None):
1818
self.buf = buf
1919

@@ -89,15 +89,15 @@ def __str__(self):
8989
return "Unsupported transfer coding: %r" % self.hdr
9090

9191

92-
class InvalidChunkSize(IOError):
92+
class InvalidChunkSize(OSError):
9393
def __init__(self, data):
9494
self.data = data
9595

9696
def __str__(self):
9797
return "Invalid chunk size: %r" % self.data
9898

9999

100-
class ChunkMissingTerminator(IOError):
100+
class ChunkMissingTerminator(OSError):
101101
def __init__(self, term):
102102
self.term = term
103103

tests/test_pidfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def builtin(name):
1515
@mock.patch(builtin('open'), new_callable=mock.mock_open)
1616
def test_validate_no_file(_open):
1717
pidfile = gunicorn.pidfile.Pidfile('test.pid')
18-
_open.side_effect = IOError(errno.ENOENT)
18+
_open.side_effect = OSError(errno.ENOENT)
1919
assert pidfile.validate() is None
2020

2121

0 commit comments

Comments
 (0)