Message158507
Looking through cpython and trying to form a patch I found several differing interpretations of truncate:
Lib/_pyio.py
def truncate(self, pos=None):
Modules/_io/fileio.c
PyDoc_STRVAR(truncate_doc, "truncate([size: int]) ...");
A first semi-working patch is attached. This will allow:
truncate()
truncate(x)
truncate(size=x)
and fail on:
truncate(x, size=x)
truncate(x, size=y)
Thoughts?
ps.
fileio_truncate is defined as
(PyCFunctionWithKeywords)fileio_truncate, METH_VARARGS | METH_KEYWORDS
but fails with "takes no keyword arguments". How do I fix this? |
|
| Date |
User |
Action |
Args |
| 2012-04-16 21:56:04 | TheBiggerGuy | set | recipients:
+ TheBiggerGuy, pitrou, r.david.murray, docs@python |
| 2012-04-16 21:56:04 | TheBiggerGuy | set | messageid: <[email protected]> |
| 2012-04-16 21:56:04 | TheBiggerGuy | link | issue14586 messages |
| 2012-04-16 21:56:04 | TheBiggerGuy | create | |
|