Skip to content

Commit 9f6dbe5

Browse files
authored
Merge branch 'main' into gh-155934-accept-error
2 parents 9ad4b31 + 5442687 commit 9f6dbe5

31 files changed

Lines changed: 246 additions & 66 deletions

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,12 @@ Lib/test/test_unittest/testmock/ @cjw296
620620
# Weakref
621621
**/*weakref* @kumaraditya303
622622

623+
# Zlib
624+
Doc/library/zlib.rst @StanFromIreland
625+
Lib/compression/zlib.py @StanFromIreland
626+
Lib/test/test_zlib.py @StanFromIreland
627+
Modules/_zlibmodule.c @StanFromIreland
628+
623629
# Zipfile.Path
624630
Lib/test/test_zipfile/_path/ @jaraco
625631
Lib/zipfile/_path/ @jaraco

Doc/glossary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ Glossary
509509
A piece of syntax which can be evaluated to some value. In other words,
510510
an expression is an accumulation of expression elements like literals,
511511
names, attribute access, operators or function calls which all return a
512-
value. In contrast to many other languages, not all language constructs
512+
value. Not all language constructs
513513
are expressions. There are also :term:`statement`\s which cannot be used
514514
as expressions, such as :keyword:`while`. Assignments are also statements,
515515
not expressions.

Doc/library/asyncio-stream.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ and work with streams:
4949

5050

5151
.. function:: open_connection(host=None, port=None, *, \
52-
limit=None, ssl=None, family=0, proto=0, \
52+
limit=65536, ssl=None, family=0, proto=0, \
5353
flags=0, sock=None, local_addr=None, \
5454
server_hostname=None, ssl_handshake_timeout=None, \
5555
ssl_shutdown_timeout=None, \
@@ -89,7 +89,7 @@ and work with streams:
8989

9090

9191
.. function:: start_server(client_connected_cb, host=None, \
92-
port=None, *, limit=None, \
92+
port=None, *, limit=65536, \
9393
family=socket.AF_UNSPEC, \
9494
flags=socket.AI_PASSIVE, sock=None, \
9595
backlog=100, ssl=None, reuse_address=None, \
@@ -137,7 +137,7 @@ and work with streams:
137137

138138
.. rubric:: Unix Sockets
139139

140-
.. function:: open_unix_connection(path=None, *, limit=None, \
140+
.. function:: open_unix_connection(path=None, *, limit=65536, \
141141
ssl=None, sock=None, server_hostname=None, \
142142
ssl_handshake_timeout=None, ssl_shutdown_timeout=None)
143143
:async:
@@ -169,7 +169,7 @@ and work with streams:
169169

170170

171171
.. function:: start_unix_server(client_connected_cb, path=None, \
172-
*, limit=None, sock=None, backlog=100, ssl=None, \
172+
*, limit=65536, sock=None, backlog=100, ssl=None, \
173173
ssl_handshake_timeout=None, \
174174
ssl_shutdown_timeout=None, start_serving=True, \
175175
cleanup_socket=True, mode=None)

Doc/library/asyncio-subprocess.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Creating Subprocesses
6262
=====================
6363

6464
.. function:: create_subprocess_exec(program, *args, stdin=None, \
65-
stdout=None, stderr=None, limit=None, **kwds)
65+
stdout=None, stderr=None, limit=65536, **kwds)
6666
:async:
6767
6868
Create a subprocess.
@@ -84,7 +84,7 @@ Creating Subprocesses
8484

8585

8686
.. function:: create_subprocess_shell(cmd, stdin=None, \
87-
stdout=None, stderr=None, limit=None, **kwds)
87+
stdout=None, stderr=None, limit=65536, **kwds)
8888
:async:
8989
9090
Run the *cmd* shell command.

Doc/library/zlib.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The available exception and functions in this module are:
2727
Exception raised on compression and decompression errors.
2828

2929

30-
.. function:: adler32(data[, value])
30+
.. function:: adler32(data, value=1, /)
3131

3232
Computes an Adler-32 checksum of *data*. (An Adler-32 checksum is almost as
3333
reliable as a CRC32 but can be computed much more quickly.) The result
@@ -127,7 +127,7 @@ The available exception and functions in this module are:
127127
Added the *zdict* parameter and keyword argument support.
128128

129129

130-
.. function:: crc32(data[, value])
130+
.. function:: crc32(data, value=0, /)
131131

132132
.. index::
133133
single: Cyclic Redundancy Check
@@ -205,7 +205,7 @@ The available exception and functions in this module are:
205205
.. versionchanged:: 3.6
206206
*wbits* and *bufsize* can be used as keyword arguments.
207207

208-
.. function:: decompressobj(wbits=MAX_WBITS[, zdict])
208+
.. function:: decompressobj(wbits=MAX_WBITS, zdict=b'')
209209

210210
Returns a decompression object, to be used for decompressing data streams that
211211
won't fit into memory at once.
@@ -231,15 +231,15 @@ The available exception and functions in this module are:
231231
Compression objects support the following methods:
232232

233233

234-
.. method:: Compress.compress(data)
234+
.. method:: Compress.compress(data, /)
235235

236236
Compress *data*, returning a bytes object containing compressed data for at least
237237
part of the data in *data*. This data should be concatenated to the output
238238
produced by any preceding calls to the :meth:`compress` method. Some input may
239239
be kept in internal buffers for later processing.
240240

241241

242-
.. method:: Compress.flush([mode])
242+
.. method:: Compress.flush(mode=Z_FINISH, /)
243243

244244
All pending input is processed, and a bytes object containing the remaining compressed
245245
output is returned. *mode* can be selected from the constants
@@ -294,7 +294,7 @@ Decompression objects support the following methods and attributes:
294294
.. versionadded:: 3.3
295295

296296

297-
.. method:: Decompress.decompress(data, max_length=0)
297+
.. method:: Decompress.decompress(data, /, max_length=0)
298298

299299
Decompress *data*, returning a bytes object containing the uncompressed data
300300
corresponding to at least part of the data in *string*. This data should be
@@ -318,7 +318,7 @@ Decompression objects support the following methods and attributes:
318318
*max_length* can be used as a keyword argument.
319319

320320

321-
.. method:: Decompress.flush([length])
321+
.. method:: Decompress.flush(length=DEF_BUF_SIZE, /)
322322

323323
All pending input is processed, and a bytes object containing the remaining
324324
uncompressed output is returned. After calling :meth:`flush`, the

Lib/idlelib/idle_test/README.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ insert the import and main lines before the htest lines.
3333

3434
if __name__ == "__main__":
3535
from unittest import main
36-
main('idlelib.idle_test.test_abc', verbosity=2, exit=False)
36+
main('idlelib.idle_test.test_abc', verbosity=2)
3737

38-
The ', exit=False' is only needed if an htest follows.
38+
Add ', exit=False' to the main call if and only if an htest follows.
3939

4040

4141

Lib/idlelib/idle_test/htest.py

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,51 @@
11
"""Run human tests of Idle's window, dialog, and popup widgets.
22
3-
run(*tests) Create a master Tk() htest window. Within that, run each
4-
callable in tests after finding the matching test spec in this file. If
5-
tests is empty, run an htest for each spec dict in this file after
6-
finding the matching callable in the module named in the spec. Close
7-
the master window to end testing.
8-
9-
In a tested module, let X be a global name bound to a callable (class or
10-
function) whose .__name__ attribute is also X (the usual situation). The
11-
first parameter of X must be 'parent' or 'master'. When called, the
12-
first argument will be the root window. X must create a child
13-
Toplevel(parent/master) (or subclass thereof). The Toplevel may be a
14-
test widget or dialog, in which case the callable is the corresponding
15-
class. Or the Toplevel may contain the widget to be tested or set up a
16-
context in which a test widget is invoked. In this latter case, the
17-
callable is a wrapper function that sets up the Toplevel and other
18-
objects. Wrapper function names, such as _editor_window', should start
19-
with '_' and be lowercase.
20-
3+
The main function, `run(*tests)`, is defined at the end of this file.
4+
Argument `tests` is a possibly empty tuple of callables defined in some
5+
idlelib.abc module (or possibly modules). Its steps:
6+
1. Create a master Tk() htest window. Within that window ...
7+
2a. If tuple `tests` is not empty, run was likely called from one
8+
module. Run each callable in `tests` after finding the matching
9+
callable_spec test spec in this file.
10+
2b. If tests is empty, run was likely called from this file.
11+
Run an htest for each spec dict in this file after finding the
12+
matching callable in the module named in the spec.
13+
3. Close the master window to end testing.
14+
15+
In a tested module, let X be a global name bound to a callable (class
16+
or function) whose .__name__ attribute (its `class` or `def` definition
17+
name) is also X. X must expect exactly 1 positional argument, a
18+
parent toplevel window. Run passes the htest window. X must create a
19+
child Toplevel(parent/master). The callable may be either a runtime
20+
object or a wrapper function written just for the test. In the latter
21+
case, its name should start with '_' and be lowercase (such as '_ttt').
2122
2223
End the module with
23-
24+
```
2425
if __name__ == '__main__':
25-
<run unittest.main with 'exit=False'>
26+
from unittest import main
27+
main("idlelib.idle_test.test_xyz", verbosity=2, exit=False)
28+
2629
from idlelib.idle_test.htest import run
27-
run(callable) # There could be multiple comma-separated callables.
30+
run(callable)
31+
```
32+
Replace 'xyz' as appropriate and 'callable' with the callable name or
33+
comma-separated names (multiple names is rare). 'exit=False' is needed
34+
for the htest to run.
2835
2936
To have wrapper functions ignored by coverage reports, tag the def
30-
header like so: "def _wrapper(parent): # htest #". Use the same tag
31-
for htest lines in widget code. Make sure that the 'if __name__' line
32-
matches the above. Then have make sure that .coveragerc includes the
33-
following:
34-
37+
header like so: "def _wrapper(root): # htest #". Use the same tag
38+
for htest-only lines in the main code. To ignore the 'if __name__'
39+
statement, match the example above. Add the below to coveragerc.
40+
```
3541
[report]
3642
exclude_lines =
3743
.*# htest #
3844
if __name__ == .__main__.:
39-
40-
(The "." instead of "'" is intentional and necessary.)
41-
45+
```
4246
4347
To run any X, this file must contain a matching instance of the
4448
following template, with X.__name__ prepended to '_spec'.
45-
When all tests are run, the prefix is use to get X.
4649
4750
callable_spec = {
4851
'file': '',
@@ -51,11 +54,10 @@
5154
}
5255
5356
file (no .py): run() imports file.py.
54-
kwds: augmented with {'parent':root} and passed to X as **kwds.
57+
kwds: run() augments with {'parent':root} and passes to X as **kwds.
5558
title: an example kwd; some widgets need this, delete line if not.
5659
msg: master window hints about testing the widget.
5760
58-
5961
TODO test these modules and classes:
6062
autocomplete_w.AutoCompleteWindow
6163
debugger.Debugger

Lib/idlelib/idle_test/test_delegator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ def test_mydel(self):
4141

4242

4343
if __name__ == '__main__':
44-
unittest.main(verbosity=2, exit=2)
44+
unittest.main(verbosity=2)

Lib/idlelib/idle_test/test_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,4 +665,4 @@ def test_rstrip_end(self):
665665

666666

667667
if __name__ == '__main__':
668-
unittest.main(verbosity=2, exit=2)
668+
unittest.main(verbosity=2)

Lib/idlelib/idle_test/test_history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,4 @@ def test_history_prev_next(self):
169169

170170

171171
if __name__ == '__main__':
172-
unittest.main(verbosity=2, exit=2)
172+
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)