mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-12 01:10:34 +00:00
Fix #283: don't print first arg of constructor
This changes the exception error message of a bad-arguments error to suppress the constructor argument when the failure is a constructor. This changes both the "Invoked with: " output to omit the object instances, and rewrites the constructor signature to make it look like a constructor (changing the first argument to the object name, and removing the ' -> NoneType' return type.
This commit is contained in:
@@ -10,6 +10,7 @@ from example.issues import iterator_passthrough
|
||||
from example.issues import ElementList, ElementA, print_element
|
||||
from example.issues import expect_float, expect_int
|
||||
from example.issues import A, call_f
|
||||
from example.issues import StrIssue
|
||||
import gc
|
||||
|
||||
print_cchar("const char *")
|
||||
@@ -72,3 +73,8 @@ print("Python version")
|
||||
b = B()
|
||||
call_f(b)
|
||||
|
||||
print(StrIssue(3))
|
||||
try:
|
||||
print(StrIssue("no", "such", "constructor"))
|
||||
except TypeError as e:
|
||||
print("Failed as expected: " + str(e))
|
||||
|
||||
Reference in New Issue
Block a user