Thank you for good example, Victor. See issue6083 for early discussion.
As for options:
- I afraid we can't raise an error if the second parameter is not a tuple right now. Rather we should first emit deprecation warning, and raise an error only several releases later.
- We can't turn borrowed references into non-borrowed references, because it will cause reference leaks in existing code.
So what we should to do:
* Convert all codes in the stdlib to not use "(...)" in PyArg_ParseTuple(). This was mainly done in issue6083. Perhaps resource.prlimit() was added after this.
* Deprecate this dangerous feature. Early is better. And emit a warning to all core developers.