MCPcopy Create free account
hub / github.com/OSGeo/gdal / GetIntRes

Function GetIntRes

gcore/gdalpythondriverloader.cpp:177–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175/************************************************************************/
176
177static int GetIntRes(PyObject *poObj, const char *pszFunctionName)
178{
179 PyObject *poMethod = PyObject_GetAttrString(poObj, pszFunctionName);
180 if (poMethod == nullptr || PyErr_Occurred())
181 {
182 CPLError(CE_Failure, CPLE_AppDefined, "%s",
183 GetPyExceptionString().c_str());
184 return 0;
185 }
186
187 PyObject *poMethodRes = CallPython(poMethod);
188 if (ErrOccurredEmitCPLError())
189 {
190 Py_DecRef(poMethod);
191 return 0;
192 }
193 Py_DecRef(poMethod);
194
195 int nRes = static_cast<int>(PyLong_AsLong(poMethodRes));
196 if (ErrOccurredEmitCPLError())
197 {
198 Py_DecRef(poMethodRes);
199 return 0;
200 }
201
202 Py_DecRef(poMethodRes);
203 return nRes;
204}
205
206/************************************************************************/
207/* GetDict() */

Callers 1

GetLayerCountMethod · 0.85

Calls 5

CPLErrorFunction · 0.85
GetPyExceptionStringFunction · 0.85
CallPythonFunction · 0.85
ErrOccurredEmitCPLErrorFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected