1. Benjamin Peterson
  2. six
  3. Issues
Issue #21 resolved

Additional object model compatibility methods

Aymeric Augustin
created an issue

http://docs.python.org/3/whatsnew/3.0.html?#operators-and-special-methods says:

func_closure, func_code, func_defaults, func_dict, func_doc, func_globals, func_name were renamed to __closure__, __code__, __defaults__, __dict__, __doc__, __globals__, __name__, respectively.

Currently six only provides compatibility methods for the second and the third of these seven attributes: get_function_code and get_function_defaults.

Apparently, some of the new names already work under CPython 2.x. But they aren't documented and some alternative implementations don't have them. For instance, PyPy 1.9 doesn't have __globals__: https://code.djangoproject.com/ticket/19944

I suggest to add compatibility methods for the five other function attributes; or if there's a good reason I'm not aware of for not providing them, to explain it in the docs :)

I can fix this in the patched version of six shipped with Django (it already adds a few Django-specific compatibility functions), but since that problem isn't specific to Django, I'm filing this ticket here too.

Comments (3)

  1. Log in to comment