Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats #13

Open
vadimszzz opened this issue Oct 28, 2021 · 9 comments
Open

Comments

@vadimszzz
Copy link

vadimszzz commented Oct 28, 2021

Running

with open(ramdisk['path'], "rb") as original, \
       open(f"{ramdisk['path']}.im4p", "rb") as new_file, \
       open(f"{bundle}/{ramdisk['name'][:-4]}.asr.delta", "wb") as delta:
       delta.write(xdelta3.encode(original.read(), new_file.read()))

results in

/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/xdelta3/main.py:89: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
  return _xdelta3.execute(new_value, original, flags, 0)
/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/xdelta3/main.py:89: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
  return _xdelta3.execute(new_value, original, flags, 0)
/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/xdelta3/main.py:89: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
  return _xdelta3.execute(new_value, original, flags, 0)

View this issue for details: python-pillow/Pillow#3750

Please update code to remove warnings

@vadimszzz
Copy link
Author

The meaning of PY_SSIZE_T_CLEAN is described in https://python.readthedocs.io/en/stable/c-api/arg.html#strings-and-buffers.

@vadimszzz
Copy link
Author

vadimszzz commented Oct 28, 2021

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,

@samuelcolvin
Copy link
Owner

I'm not using this library at the moment, feel free to submit a PR.

@vadimszzz
Copy link
Author

@samuelcolvin review the PR please and publish new version.

@samuelcolvin
Copy link
Owner

Thanks, I'll look at soon as I can.

@vadimszzz
Copy link
Author

vadimszzz commented Nov 8, 2021

Hello! dude! Looks like I need to switch to another diff library, you forgot about your project. It doesn't work starting from Python 3.10 because of current issue.

@samuelcolvin
Copy link
Owner

Hi "dude", no I didn't forget about my project. I have a baby, am CTO of a PLC and maintain numerous open soccer projects. I don't have time to review, merge and deploy every pull request quickly.

By all means use another library.

@vadimszzz
Copy link
Author

Understandable, have a nice day

@vadimszzz
Copy link
Author

vadimszzz commented Dec 5, 2021

@samuelcolvin transfer ownership of the repository and pip project to me please if you don't want to maintain it. 30 days passed... My jabber: vadimszzz[at]xmpp.is.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants