Author yselivanov
Recipients doerwalter, larry, lemburg, serhiy.storchaka, yselivanov
Date 2015-08-07.16:10:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This is related to Arguments Clinic and Larry's implementation of signature parsing for built-in functions.

This particular bug is caused by 'codecs.encode' & 'codecs.decode' functions with the AC signatures defined as follows:

      obj: object
      encoding: str(c_default="NULL") = sys.getdefaultencoding()
      errors: str(c_default="NULL") = "strict"

"encoding" argument's default is a method call, and _signature_fromstr fails to recognize method calls appropriately.

The attached patch fixes the problem by rendering such default values as "<method_name()>".  I don't think we should evaluate the method call anyways, because it can cause strange side effects and can be just plain wrong -- like in this issue -- we shouldn't render 'encoding="utf-8"' just because that's how server is configured.

Anyways, the patch isn't pretty, but does fix the problem with minimal code.  Another option would be to fix codecs.encode and codecs.decode signatures to "encoding: None" and edit documentation accordingly.

Assigning this issue to Larry for his review.
Date User Action Args
2015-08-07 16:10:12yselivanovsetrecipients: + yselivanov, lemburg, doerwalter, larry, serhiy.storchaka
2015-08-07 16:10:12yselivanovsetmessageid: <>
2015-08-07 16:10:12yselivanovlinkissue24824 messages
2015-08-07 16:10:11yselivanovcreate