Commit 9ecc5dfd authored by Stefan Behnel's avatar Stefan Behnel

Py2.[45] fix

parent 1e5476fb
...@@ -11,6 +11,7 @@ cython.declare(os=object, re=object, operator=object, ...@@ -11,6 +11,7 @@ cython.declare(os=object, re=object, operator=object,
import os import os
import re import re
import sys
import operator import operator
import Naming import Naming
...@@ -26,6 +27,8 @@ try: ...@@ -26,6 +27,8 @@ try:
except ImportError: except ImportError:
from builtins import str as basestring from builtins import str as basestring
KEYWORDS_MUST_BE_BYTES = sys.version_info < (2,6)
non_portable_builtins_map = { non_portable_builtins_map = {
# builtins that have different names in different Python versions # builtins that have different names in different Python versions
...@@ -86,6 +89,8 @@ class UtilityCodeBase(object): ...@@ -86,6 +89,8 @@ class UtilityCodeBase(object):
if tags: if tags:
all_tags = utility[2] all_tags = utility[2]
for name, values in tags.iteritems(): for name, values in tags.iteritems():
if KEYWORDS_MUST_BE_BYTES:
name = name.encode('ASCII')
all_tags.setdefault(name, set()).update(values) all_tags.setdefault(name, set()).update(values)
@classmethod @classmethod
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment