summaryrefslogtreecommitdiffstats
path: root/Modules/zlibmodule.c
diff options
context:
space:
mode:
authorXiang Zhang <angwerzx@126.com>2018-03-07 05:05:37 (GMT)
committerGitHub <noreply@github.com>2018-03-07 05:05:37 (GMT)
commitbc3f2289b9007396bfb7f986bee477b6176c1822 (patch)
tree99415986a9eca1cfc98dff9aba5e96d838be242a /Modules/zlibmodule.c
parent8a387219bdfb6ee34928d6168ac42ca559f11c9a (diff)
downloadcpython-bc3f2289b9007396bfb7f986bee477b6176c1822.zip
cpython-bc3f2289b9007396bfb7f986bee477b6176c1822.tar.gz
cpython-bc3f2289b9007396bfb7f986bee477b6176c1822.tar.bz2
bpo-32969: Expose some missing constants in zlib and fix the doc (GH-5988)
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r--Modules/zlibmodule.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index cb2aae1..cd587b4 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -1361,18 +1361,33 @@ PyInit_zlib(void)
PyModule_AddIntMacro(m, DEFLATED);
PyModule_AddIntMacro(m, DEF_MEM_LEVEL);
PyModule_AddIntMacro(m, DEF_BUF_SIZE);
+ // compression levels
+ PyModule_AddIntMacro(m, Z_NO_COMPRESSION);
PyModule_AddIntMacro(m, Z_BEST_SPEED);
PyModule_AddIntMacro(m, Z_BEST_COMPRESSION);
PyModule_AddIntMacro(m, Z_DEFAULT_COMPRESSION);
+ // compression strategies
PyModule_AddIntMacro(m, Z_FILTERED);
PyModule_AddIntMacro(m, Z_HUFFMAN_ONLY);
+#ifdef Z_RLE // 1.2.0.1
+ PyModule_AddIntMacro(m, Z_RLE);
+#endif
+#ifdef Z_FIXED // 1.2.2.2
+ PyModule_AddIntMacro(m, Z_FIXED);
+#endif
PyModule_AddIntMacro(m, Z_DEFAULT_STRATEGY);
-
- PyModule_AddIntMacro(m, Z_FINISH);
+ // allowed flush values
PyModule_AddIntMacro(m, Z_NO_FLUSH);
+ PyModule_AddIntMacro(m, Z_PARTIAL_FLUSH);
PyModule_AddIntMacro(m, Z_SYNC_FLUSH);
PyModule_AddIntMacro(m, Z_FULL_FLUSH);
-
+ PyModule_AddIntMacro(m, Z_FINISH);
+#ifdef Z_BLOCK // 1.2.0.5 for inflate, 1.2.3.4 for deflate
+ PyModule_AddIntMacro(m, Z_BLOCK);
+#endif
+#ifdef Z_TREES // 1.2.3.4, only for inflate
+ PyModule_AddIntMacro(m, Z_TREES);
+#endif
ver = PyUnicode_FromString(ZLIB_VERSION);
if (ver != NULL)
PyModule_AddObject(m, "ZLIB_VERSION", ver);