This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: METH_OLDARGS allows bogus keywords
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, loewis
Priority: low Keywords:

Created on 2001-04-23 23:02 by barry, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (2)
msg4507 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2001-04-23 23:02
fileobj.close() is a method that's implemented using
PyArg_NoArgs() and METH_OLDARGS.  It allows bogus
keyword arguments, which are ignored, e.g.:

>>> fp = open('/tmp/foo', 'w')
>>> fp.close(bogus=1)

Also,

>>> fp = open('/tmp/foo', 'w')
>>> fp.write('hello', bogus=1)
TypeError: argument must be string or read-only
character buffer, not int
>>> fp.write('hello', bogus='world')
>>> ^D
% cat /tmp/foo
hello

The fix is to convert these to use METH_VARARGS.  I'm
submitting this bug report so it doesn't get forgotten. 
msg4508 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2001-06-05 05:11
Logged In: YES 
user_id=21627

Fixed with 2.245 of ceval.c.
History
Date User Action Args
2022-04-10 16:04:00adminsetgithub: 34405
2001-04-23 23:02:29barrycreate