[RFC] split PyErr::new() into multiple methods
Intended to start a discussion, about APIs, but also names :)
Similar to call(), introduces new0(), new1() and new_args(), and the same on Exception types as new_err0(), new_err1() and new_err_args().
After the deprecation cycle, new1() could be renamed back to new(), since it is the one used in the vast majority of cases.
I kept PyErrArguments, but it's now only implemented for tuples, not for all Python-convertible types.
Related: I have been wondering for a while about a new call syntax and you have prompted me to actually write that up: #4414
Maybe we could have py_call!{ PyValueError(a, b, c) } ? 🤔
I think new1 here as suggested is "call this with one positional argument"? We should be careful as our .call1 for object calls is "call this object with a tuple of arguments".
Good point... I'm not fond of the names anyway, especially the new1 would probably be new in a green field, and could be after the deprecation cycle.
Could new0 be empty? IMO doesn't work too well for exceptions...
Changed the names to new_empty, new_arg, and new_args, with the expectation to rename new_arg back to new after two versions.
new_empty could also be done away with completely, since it's seldom used, and replaced by new_args(()).