Guy Taylor <thebigguy.co...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue14586>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to