mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 09:25:51 +00:00
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).
This commit is contained in:
parent
c4d8196607
commit
7146d6299c
@ -509,7 +509,7 @@ protected:
|
|||||||
msg += "\nInvoked with: ";
|
msg += "\nInvoked with: ";
|
||||||
auto args_ = reinterpret_borrow<tuple>(args);
|
auto args_ = reinterpret_borrow<tuple>(args);
|
||||||
for (size_t ti = overloads->is_constructor ? 1 : 0; ti < args_.size(); ++ti) {
|
for (size_t ti = overloads->is_constructor ? 1 : 0; ti < args_.size(); ++ti) {
|
||||||
msg += static_cast<std::string>(pybind11::str(args_[ti]));
|
msg += pybind11::repr(args_[ti]);
|
||||||
if ((ti + 1) != args_.size() )
|
if ((ti + 1) != args_.size() )
|
||||||
msg += ", ";
|
msg += ", ";
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ def test_str_issue(msg):
|
|||||||
1. m.issues.StrIssue(arg0: int)
|
1. m.issues.StrIssue(arg0: int)
|
||||||
2. m.issues.StrIssue()
|
2. m.issues.StrIssue()
|
||||||
|
|
||||||
Invoked with: no, such, constructor
|
Invoked with: 'no', 'such', 'constructor'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user