Yury Selivanov added the comment:

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.

----------
assignee:  -> larry
keywords: +patch
nosy: +larry
priority: normal -> release blocker
stage:  -> patch review
Added file: http://bugs.python.org/file40146/inspect.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24824>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to