From 50a212bf5a09c070bbb851a0d5941c9a2317df90 Mon Sep 17 00:00:00 2001 From: nanoric Date: Wed, 3 Jul 2019 16:49:08 +0800 Subject: [PATCH] [Mod] use autocxxpy 0.4.1 --- vnpy/api/oes/generate_oes.sh | 12 ++---------- .../oes/vnoes/include/autocxxpy/callback_wrapper.hpp | 12 +++++++++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/vnpy/api/oes/generate_oes.sh b/vnpy/api/oes/generate_oes.sh index 4c43d92f..4231146c 100644 --- a/vnpy/api/oes/generate_oes.sh +++ b/vnpy/api/oes/generate_oes.sh @@ -1,14 +1,5 @@ #!/usr/bin/env bash -script_autocxxpy_version="autocxxpy 0.4.0" -autocxxpy_version=`python -m autocxxpy version` -if [[ $autocxxpy_version != $script_autocxxpy_version ]]; then - echo "autocxxpy version not match!" - echo "current: " $autocxxpy_version - echo "script: " $script_autocxxpy_version - echo "to continue, change version of autocxxpy or modify this script." - exit 1 -fi python -m autocxxpy generate \ vnoes \ oes_api/oes_api.h \ @@ -19,7 +10,8 @@ python -m autocxxpy generate \ --copy-autocxxpy-includes vnoes/include \ --pyi-output-dir .\ --no-clear-pyi-output-dir \ - --no-callback-pattern ".*" + --no-callback-pattern ".*" \ + --enforce-version 0.4.1 ##################################### # of unsupported functions: 5 diff --git a/vnpy/api/oes/vnoes/include/autocxxpy/callback_wrapper.hpp b/vnpy/api/oes/vnoes/include/autocxxpy/callback_wrapper.hpp index 685b2156..1ac97966 100644 --- a/vnpy/api/oes/vnoes/include/autocxxpy/callback_wrapper.hpp +++ b/vnpy/api/oes/vnoes/include/autocxxpy/callback_wrapper.hpp @@ -82,17 +82,23 @@ namespace autocxxpy struct async_dispatch_exception : public std::exception { async_dispatch_exception(const char *what, const pybind11::object &instance, std::string function_name) - : std::exception(what), instance(instance), function_name(function_name) + : _what(what), instance(instance), function_name(function_name) {} + std::string _what; pybind11::object instance; std::string function_name; // mutable version of what() for pybind11 to make it happy inline const char* what_mutable() noexcept { - return std::exception::what(); + return what(); } - }; + + virtual char const* what() const override + { + return _what.c_str(); + } + }; struct async_callback_exception_handler {