File tree Expand file tree Collapse file tree 2 files changed +8
-24
lines changed Expand file tree Collapse file tree 2 files changed +8
-24
lines changed Original file line number Diff line number Diff line change 1
1
import io
2
2
from os import PathLike
3
- from _zstd import (ZstdCompressor , ZstdDecompressor , _ZSTD_DStreamSizes ,
4
- ZstdError )
3
+ from _zstd import (ZstdCompressor , ZstdDecompressor , ZstdError ,
4
+ ZSTD_DStreamOutSize )
5
5
from compression ._common import _streams
6
6
7
7
__all__ = ("ZstdFile" , "open" )
8
8
9
- _ZSTD_DStreamOutSize = _ZSTD_DStreamSizes [1 ]
10
-
11
9
_MODE_CLOSED = 0
12
10
_MODE_READ = 1
13
11
_MODE_WRITE = 2
@@ -188,7 +186,7 @@ def read1(self, size=-1):
188
186
# Note this should *not* be io.DEFAULT_BUFFER_SIZE.
189
187
# ZSTD_DStreamOutSize is the minimum amount to read guaranteeing
190
188
# a full block is read.
191
- size = _ZSTD_DStreamOutSize
189
+ size = ZSTD_DStreamOutSize
192
190
return self ._buffer .read1 (size )
193
191
194
192
def readinto (self , b ):
Original file line number Diff line number Diff line change @@ -644,30 +644,16 @@ add_vars_to_module(PyObject *module)
644
644
}
645
645
#endif
646
646
647
- /* Add zstd parameters */
648
- if (add_parameters (module ) < 0 ) {
647
+ /* ZSTD_DStreamOutSize, int */
648
+ if (PyModule_AddIntConstant (module , "ZSTD_DStreamOutSize" ,
649
+ (uint32_t )ZSTD_DStreamOutSize ()) < 0 ) {
649
650
return -1 ;
650
651
}
651
652
652
- /* _ZSTD_CStreamSizes */
653
- obj = Py_BuildValue ("II" ,
654
- (uint32_t )ZSTD_CStreamInSize (),
655
- (uint32_t )ZSTD_CStreamOutSize ());
656
- if (PyModule_AddObjectRef (module , "_ZSTD_CStreamSizes" , obj ) < 0 ) {
657
- Py_XDECREF (obj );
658
- return -1 ;
659
- }
660
- Py_DECREF (obj );
661
-
662
- /* _ZSTD_DStreamSizes */
663
- obj = Py_BuildValue ("II" ,
664
- (uint32_t )ZSTD_DStreamInSize (),
665
- (uint32_t )ZSTD_DStreamOutSize ());
666
- if (PyModule_AddObjectRef (module , "_ZSTD_DStreamSizes" , obj ) < 0 ) {
667
- Py_XDECREF (obj );
653
+ /* Add zstd parameters */
654
+ if (add_parameters (module ) < 0 ) {
668
655
return -1 ;
669
656
}
670
- Py_DECREF (obj );
671
657
672
658
/* _ZSTD_CONFIG */
673
659
obj = Py_BuildValue ("isOOO" , 8 * (int )sizeof (Py_ssize_t ), "c" ,
You can’t perform that action at this time.
0 commit comments