------------------------------------------------------------------------------ Methods for getting file system paths
| 415 | //------------------------------------------------------------------------------ |
| 416 | // Methods for getting file system paths |
| 417 | inline bool vtkPythonGetFilePath(PyObject* o, const char*& a) |
| 418 | { |
| 419 | const char* exctext = "string, None, or pathlike object required"; |
| 420 | a = nullptr; |
| 421 | |
| 422 | if (o == Py_None) |
| 423 | { |
| 424 | // accept Py_None as equivalent to nullptr |
| 425 | return true; |
| 426 | } |
| 427 | |
| 428 | #if PY_VERSION_HEX >= 0x03060000 |
| 429 | bool rval = false; |
| 430 | PyObject* s = PyOS_FSPath(o); |
| 431 | if (s != nullptr) |
| 432 | { |
| 433 | rval = vtkPythonGetStringValue(s, a, exctext); |
| 434 | Py_DECREF(s); |
| 435 | } |
| 436 | return rval; |
| 437 | #else |
| 438 | return vtkPythonGetStringValue(o, a, exctext); |
| 439 | #endif |
| 440 | } |
| 441 | |
| 442 | inline bool vtkPythonGetFilePath(PyObject* o, std::string& a) |
| 443 | { |
nothing calls this directly
no test coverage detected