@@ -743,7 +743,7 @@ static PyTypeObject *getFunctionType(void)
743
743
" from types import FunctionType as result\n " ;
744
744
return reinterpret_cast <PyTypeObject *>(PepRun_GetResult (prog));
745
745
}
746
- #endif // Py_LIMITED_API || Python 2
746
+ #endif // Py_LIMITED_API
747
747
748
748
/* ****************************************************************************
749
749
*
@@ -920,12 +920,6 @@ PyTypeObject *PepType_Type_tp_new(PyTypeObject *metatype, PyObject *args, PyObje
920
920
*
921
921
*/
922
922
923
- #ifdef Py_LIMITED_API
924
- // We keep these definitions local, because they don't work in Python 2.
925
- # define PyUnicode_GET_LENGTH (op ) PyUnicode_GetLength((PyObject *)(op))
926
- # define PyUnicode_READ_CHAR (u, i ) PyUnicode_ReadChar((PyObject *)(u), (i))
927
- #endif // Py_LIMITED_API
928
-
929
923
PyObject *
930
924
_Pep_PrivateMangle (PyObject *self, PyObject *name)
931
925
{
@@ -934,15 +928,15 @@ _Pep_PrivateMangle(PyObject *self, PyObject *name)
934
928
* This function is modelled after _Py_Mangle, but is optimized
935
929
* a little for our purpose.
936
930
*/
937
- if (PyUnicode_READ_CHAR (name, 0 ) != ' _' ||
938
- PyUnicode_READ_CHAR (name, 1 ) != ' _' ) {
931
+ if (PyUnicode_ReadChar (name, 0 ) != ' _' ||
932
+ PyUnicode_ReadChar (name, 1 ) != ' _' ) {
939
933
Py_INCREF (name);
940
934
return name;
941
935
}
942
- const Py_ssize_t nlen = PyUnicode_GET_LENGTH (name);
936
+ const Py_ssize_t nlen = PyUnicode_GetLength (name);
943
937
/* Don't mangle __id__ or names with dots. */
944
- if ((PyUnicode_READ_CHAR (name, nlen-1 ) == ' _' &&
945
- PyUnicode_READ_CHAR (name, nlen-2 ) == ' _' ) ||
938
+ if ((PyUnicode_ReadChar (name, nlen-1 ) == ' _' &&
939
+ PyUnicode_ReadChar (name, nlen-2 ) == ' _' ) ||
946
940
PyUnicode_FindChar (name, ' .' , 0 , nlen, 1 ) != -1 ) {
947
941
Py_INCREF (name);
948
942
return name;
@@ -953,10 +947,10 @@ _Pep_PrivateMangle(PyObject *self, PyObject *name)
953
947
// PYSIDE-1436: _Py_Mangle is no longer exposed; implement it always.
954
948
// The rest of this function is our own implementation of _Py_Mangle.
955
949
// Please compare the original function in compile.c .
956
- Py_ssize_t plen = PyUnicode_GET_LENGTH (privateobj.object ());
950
+ Py_ssize_t plen = PyUnicode_GetLength (privateobj.object ());
957
951
/* Strip leading underscores from class name */
958
952
Py_ssize_t ipriv = 0 ;
959
- while (PyUnicode_READ_CHAR (privateobj.object (), ipriv) == ' _' )
953
+ while (PyUnicode_ReadChar (privateobj.object (), ipriv) == ' _' )
960
954
ipriv++;
961
955
if (ipriv == plen) {
962
956
Py_INCREF (name);
0 commit comments