static bool isCanonicalException(const std::ios_base::failure& ex) { std::string strExplanatoryString("non-canonical ReadCompactSize()"); return strExplanatoryString == ex.what() || // OSX Apple LLVM version 5.0 (OSX 10.9) strExplanatoryString + ": unspecified iostream_category error" == ex.what(); }
static bool isCanonicalException(const std::ios_base::failure &ex) { std::ios_base::failure expectedException("non-canonical ReadCompactSize()"); // The string returned by what() can be different for different platforms. // Instead of directly comparing the ex.what() with an expected string, // create an instance of exception to see if ex.what() matches the expected // explanatory string returned by the exception instance. return strcmp(expectedException.what(), ex.what()) == 0; }
void ios_base_failure_translator(const std::ios_base::failure &exc) { PyErr_SetString(PyExc_IOError, exc.what()); }
static bool isCanonicalException(const std::ios_base::failure& ex) { return std::string("non-canonical ReadCompactSize()") == ex.what(); }