- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
➜
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | larry |
|---|---|
| Recipients | larry, serhiy.storchaka |
| Date | 2014-01-06.16:11:17 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1389024677.31.0.209128878163.issue20144@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
|---|
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. |
| History | |||
|---|---|---|---|
| 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 |
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements
