From 7146d6299c57be4bda02b0c7fc0e3c0eaab1702a Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Tue, 22 Nov 2016 05:28:40 -0500 Subject: [PATCH] Changed "Invoked with" output to use repr() instead of str() (#518) This gives more informative output, often including the type (or at least some hint about the type). --- include/pybind11/pybind11.h | 2 +- tests/test_issues.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 840da043..b7d75d98 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -509,7 +509,7 @@ protected: msg += "\nInvoked with: "; auto args_ = reinterpret_borrow(args); for (size_t ti = overloads->is_constructor ? 1 : 0; ti < args_.size(); ++ti) { - msg += static_cast(pybind11::str(args_[ti])); + msg += pybind11::repr(args_[ti]); if ((ti + 1) != args_.size() ) msg += ", "; } diff --git a/tests/test_issues.py b/tests/test_issues.py index 5ed7d092..2098ff8a 100644 --- a/tests/test_issues.py +++ b/tests/test_issues.py @@ -96,7 +96,7 @@ def test_str_issue(msg): 1. m.issues.StrIssue(arg0: int) 2. m.issues.StrIssue() - Invoked with: no, such, constructor + Invoked with: 'no', 'such', 'constructor' """