[Python-Dev] file.writelines("foo\n","bar\n")

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Mon, 28 May 2001 09:40:54 +0200


When investigating calling conventions, I took a special look at
METH_OLDARGS occurrences. While most of them look reasonable,
file.writelines caught my attention. It has

	if (args == NULL || !PySequence_Check(args)) {
		PyErr_SetString(PyExc_TypeError,
			   "writelines() argument must be a sequence of strings");
		return NULL;
	}

Because it is a METH_OLDARGS method, you can do

f=open("/tmp/x","w")
f.writelines("foo\n","bar\n")

With my upcoming patches, I'd replace this with METH_O, making this
call illegal. Does anybody see a problem with that change in
semantics?

Regards,
Martin