summaryrefslogtreecommitdiff
path: root/Modules/zlibmodule.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-03-06 21:26:19 -0800
committerGitHub <noreply@github.com>2018-03-06 21:26:19 -0800
commitc4d77a661138debbbe584b8b08410afc8719a9b1 (patch)
tree64c8c41903742be5d71426526f536ee6a216e927 /Modules/zlibmodule.c
parent112f799666bac1bdbb320840d5fda3132255eb5e (diff)
downloadcpython-git-c4d77a661138debbbe584b8b08410afc8719a9b1.tar.gz
bpo-32969: Expose some missing constants in zlib and fix the doc (GH-5988)
(cherry picked from commit bc3f2289b9007396bfb7f986bee477b6176c1822) Co-authored-by: Xiang Zhang <angwerzx@126.com>
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 cb2aae1069..cd587b4ac9 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);