Author TheBiggerGuy
Recipients TheBiggerGuy, docs@python, pitrou, r.david.murray
Date 2012-04-16.21:56:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1334613364.86.0.938020977252.issue14586@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2012-04-16 21:56:04TheBiggerGuysetrecipients: + TheBiggerGuy, pitrou, r.david.murray, docs@python
2012-04-16 21:56:04TheBiggerGuysetmessageid: <1334613364.86.0.938020977252.issue14586@psf.upfronthosting.co.za>
2012-04-16 21:56:04TheBiggerGuylinkissue14586 messages
2012-04-16 21:56:04TheBiggerGuycreate