Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-101322: Ensure test_zlib.ZlibDecompressorTest runs, fix errors in ZlibDecompressor#101323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gpshead merged 2 commits intopython:mainfromrhpvorderman:testfix
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletionsLib/test/test_zlib.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -944,13 +944,18 @@ def choose_lines(source, number, seed=None, generator=random):
"""


class ZlibDecompressorTest():
class ZlibDecompressorTest(unittest.TestCase):
# Test adopted from test_bz2.py
TEXT = HAMLET_SCENE
DATA = zlib.compress(HAMLET_SCENE)
BAD_DATA = b"Not a valid deflate block"
BIG_TEXT = DATA * ((128 * 1024 // len(DATA)) + 1)
BIG_DATA = zlib.compress(BIG_TEXT)

def test_Constructor(self):
self.assertRaises(TypeError, zlib._ZlibDecompressor, 42)
self.assertRaises(TypeError, zlib._ZlibDecompressor, "ASDA")
self.assertRaises(TypeError, zlib._ZlibDecompressor, -15, "notbytes")
self.assertRaises(TypeError, zlib._ZlibDecompressor, -15, b"bytes", 5)

def testDecompress(self):
zlibd = zlib._ZlibDecompressor()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
Fix a bug where errors where not thrown by zlib._ZlibDecompressor if
encountered during decompressing.
1 change: 1 addition & 0 deletionsModules/zlibmodule.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1519,6 +1519,7 @@ decompress_buf(ZlibDecompressor *self, Py_ssize_t max_length)
}
} else if (err != Z_OK && err != Z_BUF_ERROR) {
zlib_error(state, self->zst, err, "while decompressing data");
goto error;
}

self->avail_in_real += self->zst.avail_in;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp