The following code generates a Deprecation warning.
"""create a swi block and print contents"""
import swi
bufsize = 4
buf = swi.block(4) # 4 words
print (f'buf {buf}')
buf.padstring('hello world', b'.') # deprecated warning
print (f'block.tostring {buf.tostring()}')
`DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
The problem appears to be in the c code of the swimodule.c
A search of the topic revealed two main types of answer.
Fix it in my code by suppressing the message, or fix it in the swi module.
Here is what it suggests:
to fix this issue define PY_SSIZE_T_CLEAN before including python.h:
#define NOT_MAIN 1
#define PY_SSIZE_T_CLEAN
#include "xdelta3.h"
#include "xdelta3.c"
#include <Python.h>
You will also need to change the type passed to '#' formats from int to Py_ssize_t,
The following code generates a Deprecation warning.
`DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
The problem appears to be in the c code of the swimodule.c A search of the topic revealed two main types of answer. Fix it in my code by suppressing the message, or fix it in the swi module. Here is what it suggests: