Skip to content

Commit c7f1da9

Browse files
StanFromIrelandhugovkvstinner
authored
gh-101100: Document zlib public constants to fix reference warnings (#139835)
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
1 parent 302f19d commit c7f1da9

File tree

2 files changed

+133
-4
lines changed

2 files changed

+133
-4
lines changed

Doc/library/zlib.rst

Lines changed: 133 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ earlier than 1.1.3; 1.1.3 has a `security vulnerability <https://zlib.net/zlib_f
1616

1717
zlib's functions have many options and often need to be used in a particular
1818
order. This documentation doesn't attempt to cover all of the permutations;
19-
consult the zlib manual at http://www.zlib.net/manual.html for authoritative
19+
consult the `zlib manual <https://www.zlib.net/manual.html>`_ for authoritative
2020
information.
2121

2222
For reading and writing ``.gz`` files see the :mod:`gzip` module.
@@ -340,6 +340,136 @@ Decompression objects support the following methods and attributes:
340340
objects.
341341

342342

343+
The following constants are available to configure compression and decompression
344+
behavior:
345+
346+
.. data:: DEFLATED
347+
348+
The deflate compression method.
349+
350+
351+
.. data:: MAX_WBITS
352+
353+
The maximum window size, expressed as a power of 2.
354+
For example, if :const:`!MAX_WBITS` is ``15`` it results in a window size
355+
of ``32 KiB``.
356+
357+
358+
.. data:: DEF_MEM_LEVEL
359+
360+
The default memory level for compression objects.
361+
362+
363+
.. data:: DEF_BUF_SIZE
364+
365+
The default buffer size for decompression operations.
366+
367+
368+
.. data:: Z_NO_COMPRESSION
369+
370+
Compression level ``0``.
371+
372+
.. versionadded:: 3.6
373+
374+
375+
.. data:: Z_BEST_SPEED
376+
377+
Compression level ``1``.
378+
379+
380+
.. data:: Z_BEST_COMPRESSION
381+
382+
Compression level ``9``.
383+
384+
385+
.. data:: Z_DEFAULT_COMPRESSION
386+
387+
Default compression level (``-1``).
388+
389+
390+
.. data:: Z_DEFAULT_STRATEGY
391+
392+
Default compression strategy, for normal data.
393+
394+
395+
.. data:: Z_FILTERED
396+
397+
Compression strategy for data produced by a filter (or predictor).
398+
399+
400+
.. data:: Z_HUFFMAN_ONLY
401+
402+
Compression strategy that forces Huffman coding only.
403+
404+
405+
.. data:: Z_RLE
406+
407+
Compression strategy that limits match distances to one (run-length encoding).
408+
409+
This constant is only available if Python was compiled with zlib
410+
1.2.0.1 or greater.
411+
412+
.. versionadded:: 3.6
413+
414+
415+
.. data:: Z_FIXED
416+
417+
Compression strategy that prevents the use of dynamic Huffman codes.
418+
419+
This constant is only available if Python was compiled with zlib
420+
1.2.2.2 or greater.
421+
422+
.. versionadded:: 3.6
423+
424+
425+
.. data:: Z_NO_FLUSH
426+
427+
Flush mode ``0``. No special flushing behavior.
428+
429+
.. versionadded:: 3.6
430+
431+
432+
.. data:: Z_PARTIAL_FLUSH
433+
434+
Flush mode ``1``. Flush as much output as possible.
435+
436+
437+
.. data:: Z_SYNC_FLUSH
438+
439+
Flush mode ``2``. All output is flushed and the output is aligned to a byte boundary.
440+
441+
442+
.. data:: Z_FULL_FLUSH
443+
444+
Flush mode ``3``. All output is flushed and the compression state is reset.
445+
446+
447+
.. data:: Z_FINISH
448+
449+
Flush mode ``4``. All pending input is processed, no more input is expected.
450+
451+
452+
.. data:: Z_BLOCK
453+
454+
Flush mode ``5``. A deflate block is completed and emitted.
455+
456+
This constant is only available if Python was compiled with zlib
457+
1.2.2.2 or greater.
458+
459+
.. versionadded:: 3.6
460+
461+
462+
.. data:: Z_TREES
463+
464+
Flush mode ``6``, for inflate operations. Instructs inflate to return when
465+
it gets to the next deflate block boundary.
466+
467+
This constant is only available if Python was compiled with zlib
468+
1.2.3.4 or greater.
469+
470+
.. versionadded:: 3.6
471+
472+
343473
Information about the version of the zlib library in use is available through
344474
the following constants:
345475

@@ -375,10 +505,10 @@ the following constants:
375505
Module :mod:`gzip`
376506
Reading and writing :program:`gzip`\ -format files.
377507

378-
http://www.zlib.net
508+
https://www.zlib.net
379509
The zlib library home page.
380510

381-
http://www.zlib.net/manual.html
511+
https://www.zlib.net/manual.html
382512
The zlib manual explains the semantics and usage of the library's many
383513
functions.
384514

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Doc/library/xml.sax.reader.rst
5151
Doc/library/xml.sax.rst
5252
Doc/library/xmlrpc.client.rst
5353
Doc/library/xmlrpc.server.rst
54-
Doc/library/zlib.rst
5554
Doc/whatsnew/2.4.rst
5655
Doc/whatsnew/2.5.rst
5756
Doc/whatsnew/2.6.rst

0 commit comments

Comments
 (0)