Skip to content

DeprecationWarning: PY_SSIZE_T_CLEAN  #28

Description

@riscman

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,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions