mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
python: Remove usage of private _PyUnicode C API calls
This commit is contained in:
parent
e3f73f37f6
commit
596ff9ddb8
@ -784,9 +784,7 @@ bool Dtool_ExtractArg(PyObject **result, PyObject *args, PyObject *kwds,
|
|||||||
if (kwds != nullptr && PyDict_GET_SIZE(kwds) == 1 &&
|
if (kwds != nullptr && PyDict_GET_SIZE(kwds) == 1 &&
|
||||||
PyDict_Next(kwds, &ppos, &key, result)) {
|
PyDict_Next(kwds, &ppos, &key, result)) {
|
||||||
// We got the item, we just need to make sure that it had the right key.
|
// We got the item, we just need to make sure that it had the right key.
|
||||||
#if PY_VERSION_HEX >= 0x03060000
|
#if PY_MAJOR_VERSION >= 3
|
||||||
return PyUnicode_CheckExact(key) && _PyUnicode_EqualToASCIIString(key, keyword);
|
|
||||||
#elif PY_MAJOR_VERSION >= 3
|
|
||||||
return PyUnicode_CheckExact(key) && PyUnicode_CompareWithASCIIString(key, keyword) == 0;
|
return PyUnicode_CheckExact(key) && PyUnicode_CompareWithASCIIString(key, keyword) == 0;
|
||||||
#else
|
#else
|
||||||
return PyString_CheckExact(key) && strcmp(PyString_AS_STRING(key), keyword) == 0;
|
return PyString_CheckExact(key) && strcmp(PyString_AS_STRING(key), keyword) == 0;
|
||||||
|
@ -39,7 +39,7 @@ make(PyObject *args, PyObject *kwds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We got the item, we just need to make sure that it had the right key.
|
// We got the item, we just need to make sure that it had the right key.
|
||||||
if (!PyUnicode_CheckExact(key) || !_PyUnicode_EqualToASCIIString(key, "override")) {
|
if (!PyUnicode_CheckExact(key) || PyUnicode_CompareWithASCIIString(key, "override") != 0) {
|
||||||
Dtool_Raise_TypeError("RenderState.make() received an unexpected keyword argument");
|
Dtool_Raise_TypeError("RenderState.make() received an unexpected keyword argument");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user