Message207449
As an example, consider pattern_match() in _sre.c. This implements the match method on a pattern object; in other words, re.compile().match(). The third parameter, endpos, defaults to PY_SSIZE_T_MAX in C. What should inspect.Signature() report as the default value for endpos? We can't look up the proper value for PY_SSIZE_T_MAX, because the default value inspect.Signature() uses was written out as text when Argument Clinic processed the function.
As a hint, the documentation for match() dodges this problem by outright lying. It claims that the prototype for the function is:
match(string[, pos[, endpos]])
which is a lie. pattern_match() parses its arguments by calling PyArg_ParseTupleAndKeywords() with a format string of "O|nn". which means, for example, you could call:
match("abc", endpos=5)
The documentation claims this is invalid but it works fine.
In other words, it's a sticky problem, and the people who had it before us didn't try to solve it properly. |
|
Date |
User |
Action |
Args |
2014-01-06 16:11:17 | larry | set | recipients:
+ larry, serhiy.storchaka |
2014-01-06 16:11:17 | larry | set | messageid: <1389024677.31.0.209128878163.issue20144@psf.upfronthosting.co.za> |
2014-01-06 16:11:17 | larry | link | issue20144 messages |
2014-01-06 16:11:17 | larry | create | |
|