| 684 | // PyObject_GetOptionalAttrString() to Python 3.13.0a1 |
| 685 | #if PY_VERSION_HEX < 0x030D00A1 |
| 686 | static inline int |
| 687 | PyObject_GetOptionalAttr(PyObject *obj, PyObject *attr_name, PyObject **result) |
| 688 | { |
| 689 | // bpo-32571 added _PyObject_LookupAttr() to Python 3.7.0b1 |
| 690 | #if PY_VERSION_HEX >= 0x030700B1 && !defined(PYPY_VERSION) |
| 691 | return _PyObject_LookupAttr(obj, attr_name, result); |
| 692 | #else |
| 693 | *result = PyObject_GetAttr(obj, attr_name); |
| 694 | if (*result != NULL) { |
| 695 | return 1; |
| 696 | } |
| 697 | if (!PyErr_Occurred()) { |
| 698 | return 0; |
| 699 | } |
| 700 | if (PyErr_ExceptionMatches(PyExc_AttributeError)) { |
| 701 | PyErr_Clear(); |
| 702 | return 0; |
| 703 | } |
| 704 | return -1; |
| 705 | #endif |
| 706 | } |
| 707 | |
| 708 | static inline int |
| 709 | PyObject_GetOptionalAttrString(PyObject *obj, const char *attr_name, PyObject **result) |
no outgoing calls
no test coverage detected