[docs] [issue14586] TypeError: truncate() takes no keyword arguments
Guy Taylor
report at bugs.python.org
Mon Apr 16 23:56:04 CEST 2012
Guy Taylor <thebigguy.co.uk at gmail.com> added the comment:
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?
----------
keywords: +patch
Added file: http://bugs.python.org/file25246/truncate.ver1.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14586>
_______________________________________
More information about the docs
mailing list