Wed, 14 Jul 2010 22:59:43 -0300 util: improved the check for the existence of the 'buffer' builtin
Renato Cunha <renatoc@gmail.com> [Wed, 14 Jul 2010 22:59:43 -0300] rev 11565
util: improved the check for the existence of the 'buffer' builtin 2to3 is unable to translate '__builtin__' calls to 'builtins' when hasattr is used (as in hasattr(__builtin__, buffer)). Translating the check to the format try: whatever except NameError # define whatever __builtin__.whatever = whatever is a correct way of checking for the name and has the benefit of being translated by 2to3. This patch implements the same idea for the aforementioned example.
(0) -10000 -3000 -1000 -300 -100 -30 -10 -1 +1 +10 +30 +100 +300 +1000 +3000 +10000 +30000 tip