Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mgedmin opened this issue Mar 26, 2019 · 1 comment · Fixed by #109
Closed

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

mgedmin opened this issue Mar 26, 2019 · 1 comment · Fixed by #109

Comments

@mgedmin
Copy link
Member

mgedmin commented Mar 26, 2019

I've been testing zodbbrowser on Python 3.8.0a3, and I noticed new deprecation warnings:

/home/mg/src/zodbbrowser/.tox/py38/lib/python3.8/site-packages/ZODB/FileStorage/FileStorage.py:316: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
  self._ts = tid = TimeStamp(tid)
/home/mg/src/zodbbrowser/.tox/py38/lib/python3.8/site-packages/ZODB/FileStorage/FileStorage.py:1154: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
  d.update({"time": TimeStamp(h.tid).timeTime(),
/home/mg/src/zodbbrowser/.tox/py38/lib/python3.8/site-packages/zodbbrowser/browser.py:483: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
  ts = TimeStamp(d.tid).timeTime()
...

There are many more, but they all mention TimeStamp(...), so I assume that's where the bug is.

These were introduced by https://bugs.python.org/issue36381 to warn about an upcoming Python C API change. The meaning of PY_SSIZE_T_CLEAN is described in https://python.readthedocs.io/en/stable/c-api/arg.html#strings-and-buffers.

What ZODB needs to do is:

  • find all invocations of PyArg_Parse and related functions that use # formats
  • make sure the type of the length argument is a Py_ssize_t
  • #define PY_SSIZE_T_CLEAN above the #include <Python.h>.

PY_SSIZE_T_CLEAN was introduced in Python 2.5 so there shouldn't be any backwards-compatibility issues.

@mgedmin mgedmin transferred this issue from zopefoundation/ZODB Mar 26, 2019
@mgedmin
Copy link
Member Author

mgedmin commented Mar 26, 2019

The TimeStamp type is actually defined in persistent, not ZODB. Transferring the issue.

mgedmin added a commit that referenced this issue Mar 26, 2019
This API was introduced in Python 2.7 and has been deprecated since
Python 3.8.

Fixes #108.
mgedmin added a commit that referenced this issue Mar 26, 2019
This API was introduced in Python 2.7 and the old one (using ints) has
been deprecated since Python 3.8.

Fixes #108.
mgedmin added a commit that referenced this issue Mar 26, 2019
This API was introduced in Python 2.5 and the old one (using ints) has
been deprecated since Python 3.8.

Fixes #108.
mgedmin added a commit that referenced this issue Mar 26, 2019
This API was introduced in Python 2.5 and the old one (using ints) has
been deprecated since Python 3.8.

See #108.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant