File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,22 +40,18 @@ namespace
4040
4141 // An lvalue conversion function which extracts a char const* from a
4242 // Python String.
43- #if PY_VERSION_HEX < 0x03000000
4443 void * convert_to_cstring (PyObject* obj)
4544 {
45+ #if PY_VERSION_HEX < 0x03000000
4646 return PyString_Check (obj) ? PyString_AsString (obj) : 0 ;
47- }
4847#elif PY_VERSION_HEX < 0x03070000
49- void * convert_to_cstring (PyObject* obj)
50- {
5148 return PyUnicode_Check (obj) ? _PyUnicode_AsString (obj) : 0 ;
52- }
53- #else
54- void * convert_to_cstring (PyObject* obj)
55- {
49+ #elif PY_VERSION_HEX < 0x030E0000
5650 return PyUnicode_Check (obj) ? const_cast <void *>(reinterpret_cast <const void *>(_PyUnicode_AsString (obj))) : 0 ;
57- }
51+ #else
52+ return PyUnicode_Check (obj) ? const_cast <void *>(reinterpret_cast <const void *>(PyUnicode_AsUTF8 (obj))) : 0 ;
5853#endif
54+ }
5955
6056 // Given a target type and a SlotPolicy describing how to perform a
6157 // given conversion, registers from_python converters which use the
You can’t perform that action at this time.
0 commit comments