Skip to content

Commit 752fb2a

Browse files
authored
Merge pull request #83 from xiusmo/master
Update tp_print to use PYLZMA_TP_PRINT for compatibility with Python 3.8+
2 parents ccb0e7c + f6f64a2 commit 752fb2a

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

src/pylzma/pylzma.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ PyInterpreterState* _pylzma_interpreterState;
104104
#define PARSE_LENGTH_FORMAT "%d"
105105
#endif
106106

107+
// Handle tp_print -> tp_vectorcall_offset change in Python 3.8+
108+
#if PY_VERSION_HEX >= 0x03080000
109+
#define PYLZMA_TP_PRINT 0
110+
#else
111+
#define PYLZMA_TP_PRINT NULL
112+
#endif
113+
107114
extern ISzAlloc allocator;
108115

109116
#endif

src/pylzma/pylzma_aes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ CAESDecrypt_Type = {
155155
sizeof(CAESDecryptObject), /* int tp_basicsize; */
156156
0, /* int tp_itemsize; // not used much */
157157
NULL, /* destructor tp_dealloc; */
158-
NULL, /* printfunc tp_print; */
158+
PYLZMA_TP_PRINT, /* printfunc tp_print; */
159159
NULL, /* getattrfunc tp_getattr; // __getattr__ */
160160
NULL, /* setattrfunc tp_setattr; // __setattr__ */
161161
NULL, /* cmpfunc tp_compare; // __cmp__ */

src/pylzma/pylzma_compressfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ CCompressionFileObject_Type = {
231231
sizeof(CCompressionFileObject), /* int tp_basicsize; */
232232
0, /* int tp_itemsize; // not used much */
233233
(destructor)pylzma_compfile_dealloc, /* destructor tp_dealloc; */
234-
NULL, /* printfunc tp_print; */
234+
PYLZMA_TP_PRINT, /* printfunc tp_print; */
235235
NULL, /* getattrfunc tp_getattr; // __getattr__ */
236236
NULL, /* setattrfunc tp_setattr; // __setattr__ */
237237
NULL, /* cmpfunc tp_compare; // __cmp__ */

src/pylzma/pylzma_compressobj.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ CCompressionObject_Type = {
224224
sizeof(CCompressionObject), /* int tp_basicsize; */
225225
0, /* int tp_itemsize; // not used much */
226226
(destructor)pylzma_comp_dealloc, /* destructor tp_dealloc; */
227-
NULL, /* printfunc tp_print; */
227+
PYLZMA_TP_PRINT, /* printfunc tp_print; */
228228
NULL, /* getattrfunc tp_getattr; // __getattr__ */
229229
NULL, /* setattrfunc tp_setattr; // __setattr__ */
230230
NULL, /* cmpfunc tp_compare; // __cmp__ */

src/pylzma/pylzma_decompressobj.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ CDecompressionObject_Type = {
382382
sizeof(CDecompressionObject), /* int tp_basicsize; */
383383
0, /* int tp_itemsize; // not used much */
384384
(destructor)pylzma_decomp_dealloc, /* destructor tp_dealloc; */
385-
NULL, /* printfunc tp_print; */
385+
PYLZMA_TP_PRINT, /* printfunc tp_print; */
386386
NULL, /* getattrfunc tp_getattr; // __getattr__ */
387387
NULL, /* setattrfunc tp_setattr; // __setattr__ */
388388
NULL, /* cmpfunc tp_compare; // __cmp__ */

src/pylzma/pylzma_decompressobj_compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ PyTypeObject CompatDecompressionObject_Type = {
202202
sizeof(CCompatDecompressionObject), /* int tp_basicsize; */
203203
0, /* int tp_itemsize; // not used much */
204204
(destructor)pylzma_decomp_dealloc, /* destructor tp_dealloc; */
205-
NULL, /* printfunc tp_print; */
205+
PYLZMA_TP_PRINT, /* printfunc tp_print; */
206206
NULL, /* getattrfunc tp_getattr; // __getattr__ */
207207
NULL, /* setattrfunc tp_setattr; // __setattr__ */
208208
NULL, /* cmpfunc tp_compare; // __cmp__ */

0 commit comments

Comments
 (0)