mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 04:20:07 +01:00
Merge pull request #1709 from jeremyd2019/wxpybuffer-python2
Try both old and new buffer protocols on python2.7
This commit is contained in:
@@ -31,8 +31,9 @@ public:
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
// Old buffer protocol
|
||||
int rv = PyObject_AsReadBuffer(obj, (const void**)&m_ptr, &m_len);
|
||||
return rv != -1;
|
||||
#else
|
||||
if (rv != -1)
|
||||
return true;
|
||||
#endif
|
||||
// New buffer protocol
|
||||
Py_buffer view;
|
||||
if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) != 0)
|
||||
@@ -41,7 +42,6 @@ public:
|
||||
m_len = view.len;
|
||||
PyBuffer_Release(&view);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ def __init_resources():
|
||||
"""
|
||||
|
||||
ADD_FILE_TO_MEMFS = """\
|
||||
wx.MemoryFSHandler.AddFile('XRC/%(memoryPath)s/%(filename)s', bytearray(%(filename)s))
|
||||
wx.MemoryFSHandler.AddFile('XRC/%(memoryPath)s/%(filename)s', memoryview(%(filename)s))
|
||||
"""
|
||||
|
||||
LOAD_RES_MEMFS = """\
|
||||
|
||||
Reference in New Issue
Block a user