zlibmodule.c.h 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. /*[clinic input]
  2. preserve
  3. [clinic start generated code]*/
  4. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  5. # include "pycore_gc.h" // PyGC_Head
  6. # include "pycore_runtime.h" // _Py_ID()
  7. #endif
  8. PyDoc_STRVAR(zlib_compress__doc__,
  9. "compress($module, data, /, level=Z_DEFAULT_COMPRESSION, wbits=MAX_WBITS)\n"
  10. "--\n"
  11. "\n"
  12. "Returns a bytes object containing compressed data.\n"
  13. "\n"
  14. " data\n"
  15. " Binary data to be compressed.\n"
  16. " level\n"
  17. " Compression level, in 0-9 or -1.\n"
  18. " wbits\n"
  19. " The window buffer size and container format.");
  20. #define ZLIB_COMPRESS_METHODDEF \
  21. {"compress", _PyCFunction_CAST(zlib_compress), METH_FASTCALL|METH_KEYWORDS, zlib_compress__doc__},
  22. static PyObject *
  23. zlib_compress_impl(PyObject *module, Py_buffer *data, int level, int wbits);
  24. static PyObject *
  25. zlib_compress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  26. {
  27. PyObject *return_value = NULL;
  28. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  29. #define NUM_KEYWORDS 2
  30. static struct {
  31. PyGC_Head _this_is_not_used;
  32. PyObject_VAR_HEAD
  33. PyObject *ob_item[NUM_KEYWORDS];
  34. } _kwtuple = {
  35. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  36. .ob_item = { &_Py_ID(level), &_Py_ID(wbits), },
  37. };
  38. #undef NUM_KEYWORDS
  39. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  40. #else // !Py_BUILD_CORE
  41. # define KWTUPLE NULL
  42. #endif // !Py_BUILD_CORE
  43. static const char * const _keywords[] = {"", "level", "wbits", NULL};
  44. static _PyArg_Parser _parser = {
  45. .keywords = _keywords,
  46. .fname = "compress",
  47. .kwtuple = KWTUPLE,
  48. };
  49. #undef KWTUPLE
  50. PyObject *argsbuf[3];
  51. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  52. Py_buffer data = {NULL, NULL};
  53. int level = Z_DEFAULT_COMPRESSION;
  54. int wbits = MAX_WBITS;
  55. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
  56. if (!args) {
  57. goto exit;
  58. }
  59. if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
  60. goto exit;
  61. }
  62. if (!PyBuffer_IsContiguous(&data, 'C')) {
  63. _PyArg_BadArgument("compress", "argument 1", "contiguous buffer", args[0]);
  64. goto exit;
  65. }
  66. if (!noptargs) {
  67. goto skip_optional_pos;
  68. }
  69. if (args[1]) {
  70. level = _PyLong_AsInt(args[1]);
  71. if (level == -1 && PyErr_Occurred()) {
  72. goto exit;
  73. }
  74. if (!--noptargs) {
  75. goto skip_optional_pos;
  76. }
  77. }
  78. wbits = _PyLong_AsInt(args[2]);
  79. if (wbits == -1 && PyErr_Occurred()) {
  80. goto exit;
  81. }
  82. skip_optional_pos:
  83. return_value = zlib_compress_impl(module, &data, level, wbits);
  84. exit:
  85. /* Cleanup for data */
  86. if (data.obj) {
  87. PyBuffer_Release(&data);
  88. }
  89. return return_value;
  90. }
  91. PyDoc_STRVAR(zlib_decompress__doc__,
  92. "decompress($module, data, /, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE)\n"
  93. "--\n"
  94. "\n"
  95. "Returns a bytes object containing the uncompressed data.\n"
  96. "\n"
  97. " data\n"
  98. " Compressed data.\n"
  99. " wbits\n"
  100. " The window buffer size and container format.\n"
  101. " bufsize\n"
  102. " The initial output buffer size.");
  103. #define ZLIB_DECOMPRESS_METHODDEF \
  104. {"decompress", _PyCFunction_CAST(zlib_decompress), METH_FASTCALL|METH_KEYWORDS, zlib_decompress__doc__},
  105. static PyObject *
  106. zlib_decompress_impl(PyObject *module, Py_buffer *data, int wbits,
  107. Py_ssize_t bufsize);
  108. static PyObject *
  109. zlib_decompress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  110. {
  111. PyObject *return_value = NULL;
  112. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  113. #define NUM_KEYWORDS 2
  114. static struct {
  115. PyGC_Head _this_is_not_used;
  116. PyObject_VAR_HEAD
  117. PyObject *ob_item[NUM_KEYWORDS];
  118. } _kwtuple = {
  119. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  120. .ob_item = { &_Py_ID(wbits), &_Py_ID(bufsize), },
  121. };
  122. #undef NUM_KEYWORDS
  123. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  124. #else // !Py_BUILD_CORE
  125. # define KWTUPLE NULL
  126. #endif // !Py_BUILD_CORE
  127. static const char * const _keywords[] = {"", "wbits", "bufsize", NULL};
  128. static _PyArg_Parser _parser = {
  129. .keywords = _keywords,
  130. .fname = "decompress",
  131. .kwtuple = KWTUPLE,
  132. };
  133. #undef KWTUPLE
  134. PyObject *argsbuf[3];
  135. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  136. Py_buffer data = {NULL, NULL};
  137. int wbits = MAX_WBITS;
  138. Py_ssize_t bufsize = DEF_BUF_SIZE;
  139. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
  140. if (!args) {
  141. goto exit;
  142. }
  143. if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
  144. goto exit;
  145. }
  146. if (!PyBuffer_IsContiguous(&data, 'C')) {
  147. _PyArg_BadArgument("decompress", "argument 1", "contiguous buffer", args[0]);
  148. goto exit;
  149. }
  150. if (!noptargs) {
  151. goto skip_optional_pos;
  152. }
  153. if (args[1]) {
  154. wbits = _PyLong_AsInt(args[1]);
  155. if (wbits == -1 && PyErr_Occurred()) {
  156. goto exit;
  157. }
  158. if (!--noptargs) {
  159. goto skip_optional_pos;
  160. }
  161. }
  162. {
  163. Py_ssize_t ival = -1;
  164. PyObject *iobj = _PyNumber_Index(args[2]);
  165. if (iobj != NULL) {
  166. ival = PyLong_AsSsize_t(iobj);
  167. Py_DECREF(iobj);
  168. }
  169. if (ival == -1 && PyErr_Occurred()) {
  170. goto exit;
  171. }
  172. bufsize = ival;
  173. }
  174. skip_optional_pos:
  175. return_value = zlib_decompress_impl(module, &data, wbits, bufsize);
  176. exit:
  177. /* Cleanup for data */
  178. if (data.obj) {
  179. PyBuffer_Release(&data);
  180. }
  181. return return_value;
  182. }
  183. PyDoc_STRVAR(zlib_compressobj__doc__,
  184. "compressobj($module, /, level=Z_DEFAULT_COMPRESSION, method=DEFLATED,\n"
  185. " wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL,\n"
  186. " strategy=Z_DEFAULT_STRATEGY, zdict=None)\n"
  187. "--\n"
  188. "\n"
  189. "Return a compressor object.\n"
  190. "\n"
  191. " level\n"
  192. " The compression level (an integer in the range 0-9 or -1; default is\n"
  193. " currently equivalent to 6). Higher compression levels are slower,\n"
  194. " but produce smaller results.\n"
  195. " method\n"
  196. " The compression algorithm. If given, this must be DEFLATED.\n"
  197. " wbits\n"
  198. " +9 to +15: The base-two logarithm of the window size. Include a zlib\n"
  199. " container.\n"
  200. " -9 to -15: Generate a raw stream.\n"
  201. " +25 to +31: Include a gzip container.\n"
  202. " memLevel\n"
  203. " Controls the amount of memory used for internal compression state.\n"
  204. " Valid values range from 1 to 9. Higher values result in higher memory\n"
  205. " usage, faster compression, and smaller output.\n"
  206. " strategy\n"
  207. " Used to tune the compression algorithm. Possible values are\n"
  208. " Z_DEFAULT_STRATEGY, Z_FILTERED, and Z_HUFFMAN_ONLY.\n"
  209. " zdict\n"
  210. " The predefined compression dictionary - a sequence of bytes\n"
  211. " containing subsequences that are likely to occur in the input data.");
  212. #define ZLIB_COMPRESSOBJ_METHODDEF \
  213. {"compressobj", _PyCFunction_CAST(zlib_compressobj), METH_FASTCALL|METH_KEYWORDS, zlib_compressobj__doc__},
  214. static PyObject *
  215. zlib_compressobj_impl(PyObject *module, int level, int method, int wbits,
  216. int memLevel, int strategy, Py_buffer *zdict);
  217. static PyObject *
  218. zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  219. {
  220. PyObject *return_value = NULL;
  221. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  222. #define NUM_KEYWORDS 6
  223. static struct {
  224. PyGC_Head _this_is_not_used;
  225. PyObject_VAR_HEAD
  226. PyObject *ob_item[NUM_KEYWORDS];
  227. } _kwtuple = {
  228. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  229. .ob_item = { &_Py_ID(level), &_Py_ID(method), &_Py_ID(wbits), &_Py_ID(memLevel), &_Py_ID(strategy), &_Py_ID(zdict), },
  230. };
  231. #undef NUM_KEYWORDS
  232. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  233. #else // !Py_BUILD_CORE
  234. # define KWTUPLE NULL
  235. #endif // !Py_BUILD_CORE
  236. static const char * const _keywords[] = {"level", "method", "wbits", "memLevel", "strategy", "zdict", NULL};
  237. static _PyArg_Parser _parser = {
  238. .keywords = _keywords,
  239. .fname = "compressobj",
  240. .kwtuple = KWTUPLE,
  241. };
  242. #undef KWTUPLE
  243. PyObject *argsbuf[6];
  244. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
  245. int level = Z_DEFAULT_COMPRESSION;
  246. int method = DEFLATED;
  247. int wbits = MAX_WBITS;
  248. int memLevel = DEF_MEM_LEVEL;
  249. int strategy = Z_DEFAULT_STRATEGY;
  250. Py_buffer zdict = {NULL, NULL};
  251. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 6, 0, argsbuf);
  252. if (!args) {
  253. goto exit;
  254. }
  255. if (!noptargs) {
  256. goto skip_optional_pos;
  257. }
  258. if (args[0]) {
  259. level = _PyLong_AsInt(args[0]);
  260. if (level == -1 && PyErr_Occurred()) {
  261. goto exit;
  262. }
  263. if (!--noptargs) {
  264. goto skip_optional_pos;
  265. }
  266. }
  267. if (args[1]) {
  268. method = _PyLong_AsInt(args[1]);
  269. if (method == -1 && PyErr_Occurred()) {
  270. goto exit;
  271. }
  272. if (!--noptargs) {
  273. goto skip_optional_pos;
  274. }
  275. }
  276. if (args[2]) {
  277. wbits = _PyLong_AsInt(args[2]);
  278. if (wbits == -1 && PyErr_Occurred()) {
  279. goto exit;
  280. }
  281. if (!--noptargs) {
  282. goto skip_optional_pos;
  283. }
  284. }
  285. if (args[3]) {
  286. memLevel = _PyLong_AsInt(args[3]);
  287. if (memLevel == -1 && PyErr_Occurred()) {
  288. goto exit;
  289. }
  290. if (!--noptargs) {
  291. goto skip_optional_pos;
  292. }
  293. }
  294. if (args[4]) {
  295. strategy = _PyLong_AsInt(args[4]);
  296. if (strategy == -1 && PyErr_Occurred()) {
  297. goto exit;
  298. }
  299. if (!--noptargs) {
  300. goto skip_optional_pos;
  301. }
  302. }
  303. if (PyObject_GetBuffer(args[5], &zdict, PyBUF_SIMPLE) != 0) {
  304. goto exit;
  305. }
  306. if (!PyBuffer_IsContiguous(&zdict, 'C')) {
  307. _PyArg_BadArgument("compressobj", "argument 'zdict'", "contiguous buffer", args[5]);
  308. goto exit;
  309. }
  310. skip_optional_pos:
  311. return_value = zlib_compressobj_impl(module, level, method, wbits, memLevel, strategy, &zdict);
  312. exit:
  313. /* Cleanup for zdict */
  314. if (zdict.obj) {
  315. PyBuffer_Release(&zdict);
  316. }
  317. return return_value;
  318. }
  319. PyDoc_STRVAR(zlib_decompressobj__doc__,
  320. "decompressobj($module, /, wbits=MAX_WBITS, zdict=b\'\')\n"
  321. "--\n"
  322. "\n"
  323. "Return a decompressor object.\n"
  324. "\n"
  325. " wbits\n"
  326. " The window buffer size and container format.\n"
  327. " zdict\n"
  328. " The predefined compression dictionary. This must be the same\n"
  329. " dictionary as used by the compressor that produced the input data.");
  330. #define ZLIB_DECOMPRESSOBJ_METHODDEF \
  331. {"decompressobj", _PyCFunction_CAST(zlib_decompressobj), METH_FASTCALL|METH_KEYWORDS, zlib_decompressobj__doc__},
  332. static PyObject *
  333. zlib_decompressobj_impl(PyObject *module, int wbits, PyObject *zdict);
  334. static PyObject *
  335. zlib_decompressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  336. {
  337. PyObject *return_value = NULL;
  338. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  339. #define NUM_KEYWORDS 2
  340. static struct {
  341. PyGC_Head _this_is_not_used;
  342. PyObject_VAR_HEAD
  343. PyObject *ob_item[NUM_KEYWORDS];
  344. } _kwtuple = {
  345. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  346. .ob_item = { &_Py_ID(wbits), &_Py_ID(zdict), },
  347. };
  348. #undef NUM_KEYWORDS
  349. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  350. #else // !Py_BUILD_CORE
  351. # define KWTUPLE NULL
  352. #endif // !Py_BUILD_CORE
  353. static const char * const _keywords[] = {"wbits", "zdict", NULL};
  354. static _PyArg_Parser _parser = {
  355. .keywords = _keywords,
  356. .fname = "decompressobj",
  357. .kwtuple = KWTUPLE,
  358. };
  359. #undef KWTUPLE
  360. PyObject *argsbuf[2];
  361. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
  362. int wbits = MAX_WBITS;
  363. PyObject *zdict = NULL;
  364. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
  365. if (!args) {
  366. goto exit;
  367. }
  368. if (!noptargs) {
  369. goto skip_optional_pos;
  370. }
  371. if (args[0]) {
  372. wbits = _PyLong_AsInt(args[0]);
  373. if (wbits == -1 && PyErr_Occurred()) {
  374. goto exit;
  375. }
  376. if (!--noptargs) {
  377. goto skip_optional_pos;
  378. }
  379. }
  380. zdict = args[1];
  381. skip_optional_pos:
  382. return_value = zlib_decompressobj_impl(module, wbits, zdict);
  383. exit:
  384. return return_value;
  385. }
  386. PyDoc_STRVAR(zlib_Compress_compress__doc__,
  387. "compress($self, data, /)\n"
  388. "--\n"
  389. "\n"
  390. "Returns a bytes object containing compressed data.\n"
  391. "\n"
  392. " data\n"
  393. " Binary data to be compressed.\n"
  394. "\n"
  395. "After calling this function, some of the input data may still\n"
  396. "be stored in internal buffers for later processing.\n"
  397. "Call the flush() method to clear these buffers.");
  398. #define ZLIB_COMPRESS_COMPRESS_METHODDEF \
  399. {"compress", _PyCFunction_CAST(zlib_Compress_compress), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress_compress__doc__},
  400. static PyObject *
  401. zlib_Compress_compress_impl(compobject *self, PyTypeObject *cls,
  402. Py_buffer *data);
  403. static PyObject *
  404. zlib_Compress_compress(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  405. {
  406. PyObject *return_value = NULL;
  407. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  408. # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
  409. #else
  410. # define KWTUPLE NULL
  411. #endif
  412. static const char * const _keywords[] = {"", NULL};
  413. static _PyArg_Parser _parser = {
  414. .keywords = _keywords,
  415. .fname = "compress",
  416. .kwtuple = KWTUPLE,
  417. };
  418. #undef KWTUPLE
  419. PyObject *argsbuf[1];
  420. Py_buffer data = {NULL, NULL};
  421. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
  422. if (!args) {
  423. goto exit;
  424. }
  425. if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
  426. goto exit;
  427. }
  428. if (!PyBuffer_IsContiguous(&data, 'C')) {
  429. _PyArg_BadArgument("compress", "argument 1", "contiguous buffer", args[0]);
  430. goto exit;
  431. }
  432. return_value = zlib_Compress_compress_impl(self, cls, &data);
  433. exit:
  434. /* Cleanup for data */
  435. if (data.obj) {
  436. PyBuffer_Release(&data);
  437. }
  438. return return_value;
  439. }
  440. PyDoc_STRVAR(zlib_Decompress_decompress__doc__,
  441. "decompress($self, data, /, max_length=0)\n"
  442. "--\n"
  443. "\n"
  444. "Return a bytes object containing the decompressed version of the data.\n"
  445. "\n"
  446. " data\n"
  447. " The binary data to decompress.\n"
  448. " max_length\n"
  449. " The maximum allowable length of the decompressed data.\n"
  450. " Unconsumed input data will be stored in\n"
  451. " the unconsumed_tail attribute.\n"
  452. "\n"
  453. "After calling this function, some of the input data may still be stored in\n"
  454. "internal buffers for later processing.\n"
  455. "Call the flush() method to clear these buffers.");
  456. #define ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF \
  457. {"decompress", _PyCFunction_CAST(zlib_Decompress_decompress), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress_decompress__doc__},
  458. static PyObject *
  459. zlib_Decompress_decompress_impl(compobject *self, PyTypeObject *cls,
  460. Py_buffer *data, Py_ssize_t max_length);
  461. static PyObject *
  462. zlib_Decompress_decompress(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  463. {
  464. PyObject *return_value = NULL;
  465. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  466. #define NUM_KEYWORDS 1
  467. static struct {
  468. PyGC_Head _this_is_not_used;
  469. PyObject_VAR_HEAD
  470. PyObject *ob_item[NUM_KEYWORDS];
  471. } _kwtuple = {
  472. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  473. .ob_item = { &_Py_ID(max_length), },
  474. };
  475. #undef NUM_KEYWORDS
  476. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  477. #else // !Py_BUILD_CORE
  478. # define KWTUPLE NULL
  479. #endif // !Py_BUILD_CORE
  480. static const char * const _keywords[] = {"", "max_length", NULL};
  481. static _PyArg_Parser _parser = {
  482. .keywords = _keywords,
  483. .fname = "decompress",
  484. .kwtuple = KWTUPLE,
  485. };
  486. #undef KWTUPLE
  487. PyObject *argsbuf[2];
  488. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  489. Py_buffer data = {NULL, NULL};
  490. Py_ssize_t max_length = 0;
  491. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
  492. if (!args) {
  493. goto exit;
  494. }
  495. if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
  496. goto exit;
  497. }
  498. if (!PyBuffer_IsContiguous(&data, 'C')) {
  499. _PyArg_BadArgument("decompress", "argument 1", "contiguous buffer", args[0]);
  500. goto exit;
  501. }
  502. if (!noptargs) {
  503. goto skip_optional_pos;
  504. }
  505. {
  506. Py_ssize_t ival = -1;
  507. PyObject *iobj = _PyNumber_Index(args[1]);
  508. if (iobj != NULL) {
  509. ival = PyLong_AsSsize_t(iobj);
  510. Py_DECREF(iobj);
  511. }
  512. if (ival == -1 && PyErr_Occurred()) {
  513. goto exit;
  514. }
  515. max_length = ival;
  516. }
  517. skip_optional_pos:
  518. return_value = zlib_Decompress_decompress_impl(self, cls, &data, max_length);
  519. exit:
  520. /* Cleanup for data */
  521. if (data.obj) {
  522. PyBuffer_Release(&data);
  523. }
  524. return return_value;
  525. }
  526. PyDoc_STRVAR(zlib_Compress_flush__doc__,
  527. "flush($self, mode=zlib.Z_FINISH, /)\n"
  528. "--\n"
  529. "\n"
  530. "Return a bytes object containing any remaining compressed data.\n"
  531. "\n"
  532. " mode\n"
  533. " One of the constants Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH.\n"
  534. " If mode == Z_FINISH, the compressor object can no longer be\n"
  535. " used after calling the flush() method. Otherwise, more data\n"
  536. " can still be compressed.");
  537. #define ZLIB_COMPRESS_FLUSH_METHODDEF \
  538. {"flush", _PyCFunction_CAST(zlib_Compress_flush), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress_flush__doc__},
  539. static PyObject *
  540. zlib_Compress_flush_impl(compobject *self, PyTypeObject *cls, int mode);
  541. static PyObject *
  542. zlib_Compress_flush(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  543. {
  544. PyObject *return_value = NULL;
  545. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  546. # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
  547. #else
  548. # define KWTUPLE NULL
  549. #endif
  550. static const char * const _keywords[] = {"", NULL};
  551. static _PyArg_Parser _parser = {
  552. .keywords = _keywords,
  553. .fname = "flush",
  554. .kwtuple = KWTUPLE,
  555. };
  556. #undef KWTUPLE
  557. PyObject *argsbuf[1];
  558. int mode = Z_FINISH;
  559. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
  560. if (!args) {
  561. goto exit;
  562. }
  563. if (nargs < 1) {
  564. goto skip_optional_posonly;
  565. }
  566. mode = _PyLong_AsInt(args[0]);
  567. if (mode == -1 && PyErr_Occurred()) {
  568. goto exit;
  569. }
  570. skip_optional_posonly:
  571. return_value = zlib_Compress_flush_impl(self, cls, mode);
  572. exit:
  573. return return_value;
  574. }
  575. #if defined(HAVE_ZLIB_COPY)
  576. PyDoc_STRVAR(zlib_Compress_copy__doc__,
  577. "copy($self, /)\n"
  578. "--\n"
  579. "\n"
  580. "Return a copy of the compression object.");
  581. #define ZLIB_COMPRESS_COPY_METHODDEF \
  582. {"copy", _PyCFunction_CAST(zlib_Compress_copy), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress_copy__doc__},
  583. static PyObject *
  584. zlib_Compress_copy_impl(compobject *self, PyTypeObject *cls);
  585. static PyObject *
  586. zlib_Compress_copy(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  587. {
  588. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  589. PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
  590. return NULL;
  591. }
  592. return zlib_Compress_copy_impl(self, cls);
  593. }
  594. #endif /* defined(HAVE_ZLIB_COPY) */
  595. #if defined(HAVE_ZLIB_COPY)
  596. PyDoc_STRVAR(zlib_Compress___copy____doc__,
  597. "__copy__($self, /)\n"
  598. "--\n"
  599. "\n");
  600. #define ZLIB_COMPRESS___COPY___METHODDEF \
  601. {"__copy__", _PyCFunction_CAST(zlib_Compress___copy__), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress___copy____doc__},
  602. static PyObject *
  603. zlib_Compress___copy___impl(compobject *self, PyTypeObject *cls);
  604. static PyObject *
  605. zlib_Compress___copy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  606. {
  607. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  608. PyErr_SetString(PyExc_TypeError, "__copy__() takes no arguments");
  609. return NULL;
  610. }
  611. return zlib_Compress___copy___impl(self, cls);
  612. }
  613. #endif /* defined(HAVE_ZLIB_COPY) */
  614. #if defined(HAVE_ZLIB_COPY)
  615. PyDoc_STRVAR(zlib_Compress___deepcopy____doc__,
  616. "__deepcopy__($self, memo, /)\n"
  617. "--\n"
  618. "\n");
  619. #define ZLIB_COMPRESS___DEEPCOPY___METHODDEF \
  620. {"__deepcopy__", _PyCFunction_CAST(zlib_Compress___deepcopy__), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Compress___deepcopy____doc__},
  621. static PyObject *
  622. zlib_Compress___deepcopy___impl(compobject *self, PyTypeObject *cls,
  623. PyObject *memo);
  624. static PyObject *
  625. zlib_Compress___deepcopy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  626. {
  627. PyObject *return_value = NULL;
  628. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  629. # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
  630. #else
  631. # define KWTUPLE NULL
  632. #endif
  633. static const char * const _keywords[] = {"", NULL};
  634. static _PyArg_Parser _parser = {
  635. .keywords = _keywords,
  636. .fname = "__deepcopy__",
  637. .kwtuple = KWTUPLE,
  638. };
  639. #undef KWTUPLE
  640. PyObject *argsbuf[1];
  641. PyObject *memo;
  642. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
  643. if (!args) {
  644. goto exit;
  645. }
  646. memo = args[0];
  647. return_value = zlib_Compress___deepcopy___impl(self, cls, memo);
  648. exit:
  649. return return_value;
  650. }
  651. #endif /* defined(HAVE_ZLIB_COPY) */
  652. #if defined(HAVE_ZLIB_COPY)
  653. PyDoc_STRVAR(zlib_Decompress_copy__doc__,
  654. "copy($self, /)\n"
  655. "--\n"
  656. "\n"
  657. "Return a copy of the decompression object.");
  658. #define ZLIB_DECOMPRESS_COPY_METHODDEF \
  659. {"copy", _PyCFunction_CAST(zlib_Decompress_copy), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress_copy__doc__},
  660. static PyObject *
  661. zlib_Decompress_copy_impl(compobject *self, PyTypeObject *cls);
  662. static PyObject *
  663. zlib_Decompress_copy(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  664. {
  665. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  666. PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
  667. return NULL;
  668. }
  669. return zlib_Decompress_copy_impl(self, cls);
  670. }
  671. #endif /* defined(HAVE_ZLIB_COPY) */
  672. #if defined(HAVE_ZLIB_COPY)
  673. PyDoc_STRVAR(zlib_Decompress___copy____doc__,
  674. "__copy__($self, /)\n"
  675. "--\n"
  676. "\n");
  677. #define ZLIB_DECOMPRESS___COPY___METHODDEF \
  678. {"__copy__", _PyCFunction_CAST(zlib_Decompress___copy__), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress___copy____doc__},
  679. static PyObject *
  680. zlib_Decompress___copy___impl(compobject *self, PyTypeObject *cls);
  681. static PyObject *
  682. zlib_Decompress___copy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  683. {
  684. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  685. PyErr_SetString(PyExc_TypeError, "__copy__() takes no arguments");
  686. return NULL;
  687. }
  688. return zlib_Decompress___copy___impl(self, cls);
  689. }
  690. #endif /* defined(HAVE_ZLIB_COPY) */
  691. #if defined(HAVE_ZLIB_COPY)
  692. PyDoc_STRVAR(zlib_Decompress___deepcopy____doc__,
  693. "__deepcopy__($self, memo, /)\n"
  694. "--\n"
  695. "\n");
  696. #define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF \
  697. {"__deepcopy__", _PyCFunction_CAST(zlib_Decompress___deepcopy__), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress___deepcopy____doc__},
  698. static PyObject *
  699. zlib_Decompress___deepcopy___impl(compobject *self, PyTypeObject *cls,
  700. PyObject *memo);
  701. static PyObject *
  702. zlib_Decompress___deepcopy__(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  703. {
  704. PyObject *return_value = NULL;
  705. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  706. # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
  707. #else
  708. # define KWTUPLE NULL
  709. #endif
  710. static const char * const _keywords[] = {"", NULL};
  711. static _PyArg_Parser _parser = {
  712. .keywords = _keywords,
  713. .fname = "__deepcopy__",
  714. .kwtuple = KWTUPLE,
  715. };
  716. #undef KWTUPLE
  717. PyObject *argsbuf[1];
  718. PyObject *memo;
  719. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
  720. if (!args) {
  721. goto exit;
  722. }
  723. memo = args[0];
  724. return_value = zlib_Decompress___deepcopy___impl(self, cls, memo);
  725. exit:
  726. return return_value;
  727. }
  728. #endif /* defined(HAVE_ZLIB_COPY) */
  729. PyDoc_STRVAR(zlib_Decompress_flush__doc__,
  730. "flush($self, length=zlib.DEF_BUF_SIZE, /)\n"
  731. "--\n"
  732. "\n"
  733. "Return a bytes object containing any remaining decompressed data.\n"
  734. "\n"
  735. " length\n"
  736. " the initial size of the output buffer.");
  737. #define ZLIB_DECOMPRESS_FLUSH_METHODDEF \
  738. {"flush", _PyCFunction_CAST(zlib_Decompress_flush), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, zlib_Decompress_flush__doc__},
  739. static PyObject *
  740. zlib_Decompress_flush_impl(compobject *self, PyTypeObject *cls,
  741. Py_ssize_t length);
  742. static PyObject *
  743. zlib_Decompress_flush(compobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  744. {
  745. PyObject *return_value = NULL;
  746. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  747. # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
  748. #else
  749. # define KWTUPLE NULL
  750. #endif
  751. static const char * const _keywords[] = {"", NULL};
  752. static _PyArg_Parser _parser = {
  753. .keywords = _keywords,
  754. .fname = "flush",
  755. .kwtuple = KWTUPLE,
  756. };
  757. #undef KWTUPLE
  758. PyObject *argsbuf[1];
  759. Py_ssize_t length = DEF_BUF_SIZE;
  760. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
  761. if (!args) {
  762. goto exit;
  763. }
  764. if (nargs < 1) {
  765. goto skip_optional_posonly;
  766. }
  767. {
  768. Py_ssize_t ival = -1;
  769. PyObject *iobj = _PyNumber_Index(args[0]);
  770. if (iobj != NULL) {
  771. ival = PyLong_AsSsize_t(iobj);
  772. Py_DECREF(iobj);
  773. }
  774. if (ival == -1 && PyErr_Occurred()) {
  775. goto exit;
  776. }
  777. length = ival;
  778. }
  779. skip_optional_posonly:
  780. return_value = zlib_Decompress_flush_impl(self, cls, length);
  781. exit:
  782. return return_value;
  783. }
  784. PyDoc_STRVAR(zlib_ZlibDecompressor_decompress__doc__,
  785. "decompress($self, /, data, max_length=-1)\n"
  786. "--\n"
  787. "\n"
  788. "Decompress *data*, returning uncompressed data as bytes.\n"
  789. "\n"
  790. "If *max_length* is nonnegative, returns at most *max_length* bytes of\n"
  791. "decompressed data. If this limit is reached and further output can be\n"
  792. "produced, *self.needs_input* will be set to ``False``. In this case, the next\n"
  793. "call to *decompress()* may provide *data* as b\'\' to obtain more of the output.\n"
  794. "\n"
  795. "If all of the input data was decompressed and returned (either because this\n"
  796. "was less than *max_length* bytes, or because *max_length* was negative),\n"
  797. "*self.needs_input* will be set to True.\n"
  798. "\n"
  799. "Attempting to decompress data after the end of stream is reached raises an\n"
  800. "EOFError. Any data found after the end of the stream is ignored and saved in\n"
  801. "the unused_data attribute.");
  802. #define ZLIB_ZLIBDECOMPRESSOR_DECOMPRESS_METHODDEF \
  803. {"decompress", _PyCFunction_CAST(zlib_ZlibDecompressor_decompress), METH_FASTCALL|METH_KEYWORDS, zlib_ZlibDecompressor_decompress__doc__},
  804. static PyObject *
  805. zlib_ZlibDecompressor_decompress_impl(ZlibDecompressor *self,
  806. Py_buffer *data, Py_ssize_t max_length);
  807. static PyObject *
  808. zlib_ZlibDecompressor_decompress(ZlibDecompressor *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  809. {
  810. PyObject *return_value = NULL;
  811. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  812. #define NUM_KEYWORDS 2
  813. static struct {
  814. PyGC_Head _this_is_not_used;
  815. PyObject_VAR_HEAD
  816. PyObject *ob_item[NUM_KEYWORDS];
  817. } _kwtuple = {
  818. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  819. .ob_item = { &_Py_ID(data), &_Py_ID(max_length), },
  820. };
  821. #undef NUM_KEYWORDS
  822. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  823. #else // !Py_BUILD_CORE
  824. # define KWTUPLE NULL
  825. #endif // !Py_BUILD_CORE
  826. static const char * const _keywords[] = {"data", "max_length", NULL};
  827. static _PyArg_Parser _parser = {
  828. .keywords = _keywords,
  829. .fname = "decompress",
  830. .kwtuple = KWTUPLE,
  831. };
  832. #undef KWTUPLE
  833. PyObject *argsbuf[2];
  834. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  835. Py_buffer data = {NULL, NULL};
  836. Py_ssize_t max_length = -1;
  837. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
  838. if (!args) {
  839. goto exit;
  840. }
  841. if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
  842. goto exit;
  843. }
  844. if (!PyBuffer_IsContiguous(&data, 'C')) {
  845. _PyArg_BadArgument("decompress", "argument 'data'", "contiguous buffer", args[0]);
  846. goto exit;
  847. }
  848. if (!noptargs) {
  849. goto skip_optional_pos;
  850. }
  851. {
  852. Py_ssize_t ival = -1;
  853. PyObject *iobj = _PyNumber_Index(args[1]);
  854. if (iobj != NULL) {
  855. ival = PyLong_AsSsize_t(iobj);
  856. Py_DECREF(iobj);
  857. }
  858. if (ival == -1 && PyErr_Occurred()) {
  859. goto exit;
  860. }
  861. max_length = ival;
  862. }
  863. skip_optional_pos:
  864. return_value = zlib_ZlibDecompressor_decompress_impl(self, &data, max_length);
  865. exit:
  866. /* Cleanup for data */
  867. if (data.obj) {
  868. PyBuffer_Release(&data);
  869. }
  870. return return_value;
  871. }
  872. PyDoc_STRVAR(zlib_adler32__doc__,
  873. "adler32($module, data, value=1, /)\n"
  874. "--\n"
  875. "\n"
  876. "Compute an Adler-32 checksum of data.\n"
  877. "\n"
  878. " value\n"
  879. " Starting value of the checksum.\n"
  880. "\n"
  881. "The returned checksum is an integer.");
  882. #define ZLIB_ADLER32_METHODDEF \
  883. {"adler32", _PyCFunction_CAST(zlib_adler32), METH_FASTCALL, zlib_adler32__doc__},
  884. static PyObject *
  885. zlib_adler32_impl(PyObject *module, Py_buffer *data, unsigned int value);
  886. static PyObject *
  887. zlib_adler32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  888. {
  889. PyObject *return_value = NULL;
  890. Py_buffer data = {NULL, NULL};
  891. unsigned int value = 1;
  892. if (!_PyArg_CheckPositional("adler32", nargs, 1, 2)) {
  893. goto exit;
  894. }
  895. if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
  896. goto exit;
  897. }
  898. if (!PyBuffer_IsContiguous(&data, 'C')) {
  899. _PyArg_BadArgument("adler32", "argument 1", "contiguous buffer", args[0]);
  900. goto exit;
  901. }
  902. if (nargs < 2) {
  903. goto skip_optional;
  904. }
  905. value = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
  906. if (value == (unsigned int)-1 && PyErr_Occurred()) {
  907. goto exit;
  908. }
  909. skip_optional:
  910. return_value = zlib_adler32_impl(module, &data, value);
  911. exit:
  912. /* Cleanup for data */
  913. if (data.obj) {
  914. PyBuffer_Release(&data);
  915. }
  916. return return_value;
  917. }
  918. PyDoc_STRVAR(zlib_crc32__doc__,
  919. "crc32($module, data, value=0, /)\n"
  920. "--\n"
  921. "\n"
  922. "Compute a CRC-32 checksum of data.\n"
  923. "\n"
  924. " value\n"
  925. " Starting value of the checksum.\n"
  926. "\n"
  927. "The returned checksum is an integer.");
  928. #define ZLIB_CRC32_METHODDEF \
  929. {"crc32", _PyCFunction_CAST(zlib_crc32), METH_FASTCALL, zlib_crc32__doc__},
  930. static unsigned int
  931. zlib_crc32_impl(PyObject *module, Py_buffer *data, unsigned int value);
  932. static PyObject *
  933. zlib_crc32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  934. {
  935. PyObject *return_value = NULL;
  936. Py_buffer data = {NULL, NULL};
  937. unsigned int value = 0;
  938. unsigned int _return_value;
  939. if (!_PyArg_CheckPositional("crc32", nargs, 1, 2)) {
  940. goto exit;
  941. }
  942. if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
  943. goto exit;
  944. }
  945. if (!PyBuffer_IsContiguous(&data, 'C')) {
  946. _PyArg_BadArgument("crc32", "argument 1", "contiguous buffer", args[0]);
  947. goto exit;
  948. }
  949. if (nargs < 2) {
  950. goto skip_optional;
  951. }
  952. value = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
  953. if (value == (unsigned int)-1 && PyErr_Occurred()) {
  954. goto exit;
  955. }
  956. skip_optional:
  957. _return_value = zlib_crc32_impl(module, &data, value);
  958. if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
  959. goto exit;
  960. }
  961. return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
  962. exit:
  963. /* Cleanup for data */
  964. if (data.obj) {
  965. PyBuffer_Release(&data);
  966. }
  967. return return_value;
  968. }
  969. #ifndef ZLIB_COMPRESS_COPY_METHODDEF
  970. #define ZLIB_COMPRESS_COPY_METHODDEF
  971. #endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
  972. #ifndef ZLIB_COMPRESS___COPY___METHODDEF
  973. #define ZLIB_COMPRESS___COPY___METHODDEF
  974. #endif /* !defined(ZLIB_COMPRESS___COPY___METHODDEF) */
  975. #ifndef ZLIB_COMPRESS___DEEPCOPY___METHODDEF
  976. #define ZLIB_COMPRESS___DEEPCOPY___METHODDEF
  977. #endif /* !defined(ZLIB_COMPRESS___DEEPCOPY___METHODDEF) */
  978. #ifndef ZLIB_DECOMPRESS_COPY_METHODDEF
  979. #define ZLIB_DECOMPRESS_COPY_METHODDEF
  980. #endif /* !defined(ZLIB_DECOMPRESS_COPY_METHODDEF) */
  981. #ifndef ZLIB_DECOMPRESS___COPY___METHODDEF
  982. #define ZLIB_DECOMPRESS___COPY___METHODDEF
  983. #endif /* !defined(ZLIB_DECOMPRESS___COPY___METHODDEF) */
  984. #ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
  985. #define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
  986. #endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
  987. /*[clinic end generated code: output=244bf5f33deee674 input=a9049054013a1b77]*/