@@ -627,10 +627,20 @@ static PyType_Spec Comptype_spec = {
627627
628628#define COMP_OFF (x ) offsetof(decompobject, x)
629629
630+ PyDoc_STRVAR (Decomp_unconsumed_tail ,
631+ "A bytes object that contains any data that was not consumed by the last\n"
632+ "decompress() call because it exceeded the limit for the uncompressed data\n"
633+ "buffer. This data has not yet been seen by the zlib machinery, so you must\n"
634+ "feed it (possibly with further data concatenated to it) back to a \n"
635+ "subsequent decompress() method call in order to get correct output." );
636+
630637static PyMemberDef Decomp_members [] = {
631- {"unused_data" , T_OBJECT , COMP_OFF (unused_data ), READONLY },
632- {"unconsumed_tail" , T_OBJECT , COMP_OFF (unconsumed_tail ), READONLY },
633- {"eof" , T_BOOL , COMP_OFF (eof ), READONLY },
638+ {"unused_data" , T_OBJECT , COMP_OFF (unused_data ), READONLY ,
639+ "Data found after the end of the compressed stream." },
640+ {"unconsumed_tail" , T_OBJECT , COMP_OFF (unconsumed_tail ), READONLY ,
641+ Decomp_unconsumed_tail },
642+ {"eof" , T_BOOL , COMP_OFF (eof ), READONLY ,
643+ "True if the end-of-stream marker has been reached." },
634644 {NULL },
635645};
636646
@@ -734,6 +744,18 @@ PyInit_isal_zlib(void)
734744 return NULL ;
735745 get_isal_zlib_state (m )-> Decomptype = Decomptype ;
736746
747+ if (PyType_Ready (Comptype ) != 0 )
748+ return NULL ;
749+ Py_INCREF (Comptype );
750+ if (PyModule_AddObject (m , "Compress" , (PyObject * )Comptype ) < 0 ) {
751+ return NULL ;
752+ }
753+ if (PyType_Ready (Decomptype ) != 0 )
754+ return NULL ;
755+ Py_INCREF (Decomptype );
756+ if (PyModule_AddObject (m , "Decompress" , (PyObject * )Decomptype ) < 0 ) {
757+ return NULL ;
758+ }
737759
738760 PyModule_AddIntConstant (m , "MAX_WBITS" , ISAL_DEF_MAX_HIST_BITS );
739761 PyModule_AddIntConstant (m , "DEFLATED" , Z_DEFLATED );
0 commit comments