summaryrefslogtreecommitdiff
path: root/Modules/_lzmamodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_lzmamodule.c')
-rw-r--r--Modules/_lzmamodule.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c
index e7b1ed9fb2..bb77552b67 100644
--- a/Modules/_lzmamodule.c
+++ b/Modules/_lzmamodule.c
@@ -18,12 +18,6 @@
#include <lzma.h>
-
-#ifndef PY_LONG_LONG
-#error "This module requires PY_LONG_LONG to be defined"
-#endif
-
-
#ifdef WITH_THREAD
#define ACQUIRE_LOCK(obj) do { \
if (!PyThread_acquire_lock((obj)->lock, 0)) { \
@@ -163,7 +157,7 @@ grow_buffer(PyObject **buf, Py_ssize_t max_length)
uint32_t - the "I" (unsigned int) specifier is the right size, but
silently ignores overflows on conversion.
- lzma_vli - the "K" (unsigned PY_LONG_LONG) specifier is the right
+ lzma_vli - the "K" (unsigned long long) specifier is the right
size, but like "I" it silently ignores overflows on conversion.
lzma_mode and lzma_match_finder - these are enumeration types, and
@@ -176,12 +170,12 @@ grow_buffer(PyObject **buf, Py_ssize_t max_length)
static int \
FUNCNAME(PyObject *obj, void *ptr) \
{ \
- unsigned PY_LONG_LONG val; \
+ unsigned long long val; \
\
val = PyLong_AsUnsignedLongLong(obj); \
if (PyErr_Occurred()) \
return 0; \
- if ((unsigned PY_LONG_LONG)(TYPE)val != val) { \
+ if ((unsigned long long)(TYPE)val != val) { \
PyErr_SetString(PyExc_OverflowError, \
"Value too large for " #TYPE " type"); \
return 0; \
@@ -398,7 +392,7 @@ parse_filter_chain_spec(lzma_filter filters[], PyObject *filterspecs)
Python-level filter specifiers (represented as dicts). */
static int
-spec_add_field(PyObject *spec, _Py_Identifier *key, unsigned PY_LONG_LONG value)
+spec_add_field(PyObject *spec, _Py_Identifier *key, unsigned long long value)
{
int status;
PyObject *value_object;
@@ -555,7 +549,6 @@ error:
/*[clinic input]
_lzma.LZMACompressor.compress
- self: self(type="Compressor *")
data: Py_buffer
/
@@ -569,7 +562,7 @@ flush() method to finish the compression process.
static PyObject *
_lzma_LZMACompressor_compress_impl(Compressor *self, Py_buffer *data)
-/*[clinic end generated code: output=31f615136963e00f input=8b60cb13e0ce6420]*/
+/*[clinic end generated code: output=31f615136963e00f input=64019eac7f2cc8d0]*/
{
PyObject *result = NULL;
@@ -585,8 +578,6 @@ _lzma_LZMACompressor_compress_impl(Compressor *self, Py_buffer *data)
/*[clinic input]
_lzma.LZMACompressor.flush
- self: self(type="Compressor *")
-
Finish the compression process.
Returns the compressed data left in internal buffers.
@@ -596,7 +587,7 @@ The compressor object may not be used after this method is called.
static PyObject *
_lzma_LZMACompressor_flush_impl(Compressor *self)
-/*[clinic end generated code: output=fec21f3e22504f50 input=3060fb26f9b4042c]*/
+/*[clinic end generated code: output=fec21f3e22504f50 input=6b369303f67ad0a8]*/
{
PyObject *result = NULL;
@@ -700,7 +691,6 @@ Compressor_init_raw(lzma_stream *lzs, PyObject *filterspecs)
/*[-clinic input]
_lzma.LZMACompressor.__init__
- self: self(type="Compressor *")
format: int(c_default="FORMAT_XZ") = FORMAT_XZ
The container format to use for the output. This can
be FORMAT_XZ (default), FORMAT_ALONE, or FORMAT_RAW.
@@ -1070,7 +1060,6 @@ error:
/*[clinic input]
_lzma.LZMADecompressor.decompress
- self: self(type="Decompressor *")
data: Py_buffer
max_length: Py_ssize_t=-1
@@ -1093,7 +1082,7 @@ the unused_data attribute.
static PyObject *
_lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data,
Py_ssize_t max_length)
-/*[clinic end generated code: output=ef4e20ec7122241d input=f2bb902cc1caf203]*/
+/*[clinic end generated code: output=ef4e20ec7122241d input=60c1f135820e309d]*/
{
PyObject *result = NULL;
@@ -1133,7 +1122,6 @@ Decompressor_init_raw(lzma_stream *lzs, PyObject *filterspecs)
/*[clinic input]
_lzma.LZMADecompressor.__init__
- self: self(type="Decompressor *")
format: int(c_default="FORMAT_AUTO") = FORMAT_AUTO
Specifies the container format of the input stream. If this is
FORMAT_AUTO (the default), the decompressor will automatically detect
@@ -1159,7 +1147,7 @@ For one-shot decompression, use the decompress() function instead.
static int
_lzma_LZMADecompressor___init___impl(Decompressor *self, int format,
PyObject *memlimit, PyObject *filters)
-/*[clinic end generated code: output=3e1821f8aa36564c input=458ca6132ef29801]*/
+/*[clinic end generated code: output=3e1821f8aa36564c input=81fe684a6c2f8a27]*/
{
const uint32_t decoder_flags = LZMA_TELL_ANY_CHECK | LZMA_TELL_NO_CHECK;
uint64_t memlimit_ = UINT64_MAX;
@@ -1454,7 +1442,7 @@ static PyModuleDef _lzmamodule = {
/* Some of our constants are more than 32 bits wide, so PyModule_AddIntConstant
would not work correctly on platforms with 32-bit longs. */
static int
-module_add_int_constant(PyObject *m, const char *name, PY_LONG_LONG value)
+module_add_int_constant(PyObject *m, const char *name, long long value)
{
PyObject *o = PyLong_FromLongLong(value);
if (o == NULL)