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.

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 <1438963812.46.0.00329601955727.issue24824@psf.upfronthosting.co.za>
In-reply-to
Content
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:

  _codecs.encode
      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 docs.python.org 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.
History
Date User Action Args
2015-08-07 16:10:12yselivanovsetrecipients: + yselivanov, lemburg, doerwalter, larry, serhiy.storchaka
2015-08-07 16:10:12yselivanovsetmessageid: <1438963812.46.0.00329601955727.issue24824@psf.upfronthosting.co.za>
2015-08-07 16:10:12yselivanovlinkissue24824 messages
2015-08-07 16:10:11yselivanovcreate