Skip to content

Commit 6c3771b

Browse files
authored
Merge branch 'main' into docs-list-missing-make-targets
2 parents 3198c56 + 8122ff4 commit 6c3771b

5 files changed

Lines changed: 17 additions & 12 deletions

File tree

‎Doc/library/optparse.rst‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ Choosing an argument parsing library
1616
The standard library includes three argument parsing libraries:
1717

1818
* :mod:`getopt`: a module that closely mirrors the procedural C ``getopt`` API.
19-
Included in the standard library since before the initial Python 1.0 release.
2019
* :mod:`!optparse`: a declarative replacement for ``getopt`` that
2120
provides equivalent functionality without requiring each application
22-
to implement its own procedural option parsing logic. Included
23-
in the standard library since the Python 2.3 release.
21+
to implement its own procedural option parsing logic.
2422
* :mod:`argparse`: a more opinionated alternative to ``optparse`` that
2523
provides more functionality by default, at the expense of reduced application
26-
flexibility in controlling exactly how arguments are processed. Included in
27-
the standard library since the Python 2.7 and Python 3.2 releases.
24+
flexibility in controlling exactly how arguments are processed.
2825

2926
In the absence of more specific argument parsing design constraints, :mod:`argparse`
3027
is the recommended choice for implementing command line applications, as it offers

‎Lib/optparse.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
"""A powerful, extensible, and easy-to-use option parser.
22
3-
By Greg Ward <gward@python.net>
4-
5-
Originally distributed as Optik.
6-
7-
For support, use the optik-users@lists.sourceforge.net mailing list
8-
(http://lists.sourceforge.net/lists/listinfo/optik-users).
9-
103
Simple usage example:
114
125
from optparse import OptionParser

‎Lib/test/test_zlib.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,18 @@ def test_decompress_unused_data(self):
822822
self.assertEqual(dco.unconsumed_tail, b'')
823823
self.assertEqual(dco.unused_data, remainder)
824824

825+
def test_decompress_unconsumed_tail_after_eof(self):
826+
source = b'abcdefghijklmnopqrstuvwxyz'
827+
remainder = b'0123456789'
828+
dco = zlib.decompressobj()
829+
data = dco.decompress(zlib.compress(source) + remainder, 1)
830+
data += dco.decompress(dco.unconsumed_tail)
831+
832+
self.assertTrue(dco.eof)
833+
self.assertEqual(data, source)
834+
self.assertEqual(dco.unconsumed_tail, b'')
835+
self.assertEqual(dco.unused_data, remainder)
836+
825837
# issue27164
826838
def test_decompress_raw_with_dictionary(self):
827839
zdict = b'abcdefghijklmnopqrstuvwxyz'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix :attr:`zlib.Decompress.unconsumed_tail` duplicating
2+
:attr:`~zlib.Decompress.unused_data` after end of stream when *max_length* was used.

‎Modules/zlibmodule.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ save_unconsumed_input(compobject *self, Py_buffer *data, int err)
838838
return -1;
839839
}
840840
Py_SETREF(self->unused_data, new_unused_data);
841+
self->zst.next_in += left_size;
841842
self->zst.avail_in = 0;
842843
}
843844
}

0 commit comments

Comments
 (0)