diff options
author | François Andriot <[email protected]> | 2024-09-25 21:01:39 +0200 |
---|---|---|
committer | François Andriot <[email protected]> | 2024-09-26 09:25:58 +0200 |
commit | d0ab12dc39963aa28698943bf4ad88d3fd3d4c51 (patch) | |
tree | 7fd51ee6311314fbb8adbd6f41d10e62d72678d4 | |
parent | df4895c1e1043eefe87377f4cd085abaecca2e86 (diff) | |
download | pytqt-d0ab12dc39963aa28698943bf4ad88d3fd3d4c51.tar.gz pytqt-d0ab12dc39963aa28698943bf4ad88d3fd3d4c51.zip |
Fix FTBFS with Python 3.13.
This solves issue #32.
Signed-off-by: François Andriot <[email protected]>
-rw-r--r-- | sip/tqt/tqstring.sip | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sip/tqt/tqstring.sip b/sip/tqt/tqstring.sip index 8ef101f..6e09d0f 100644 --- a/sip/tqt/tqstring.sip +++ b/sip/tqt/tqstring.sip @@ -890,9 +890,16 @@ const char *PyTQt_tqt_encode(PyObject **s, TQApplication::Encoding encoding) es = PyBytes_AS_STRING(obj); Py_INCREF(obj); } - else if (PyObject_AsCharBuffer(obj, &es, &sz) >= 0) + else { - Py_INCREF(obj); + Py_buffer view; + + if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) == 0) { + es = (const char*)view.buf; + sz = view.len; + PyBuffer_Release(&view); + Py_INCREF(obj); + } } if (es) |