Éric Araujo <mer...@netwok.org> added the comment:

I’ve updated my patch to handle modules and functions too, but there is a 
decision to make.  The functions of built-in modules are implemented by 
methodobject.c, not functionobject.c (that’s for Python functions), so if we 
want str(sys.exc_info) to be equal to 'exc_info', then we’ll have 
str(dict.update) == 'update'.  Is this okay?

The patch needs a review.

- I tried using PyUnicode_FromString(name) instead of 
PyUnicode_FromFormat("%U", name), just like in Python I would use str(x) 
instead of '%s' % x, but this caused segfaults.  Is there a simpler function to 
use?

- I’ve used copy-paste-tweak and checked the results; I’m still learning C and 
know very little about Python’s types and refcounting internals, so review 
mercilessly!  I forgot to run the tests in findleaks mode, so I’m doing it 
right now.

----------
Added file: http://bugs.python.org/file23591/change-some-__str__.diff

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

Reply via email to