Mercurial > pygame
changeset 3186:b8dcf30ca28a
fix Python3.3 compatibility issue with makeref.py
| author | Lenard Lindstrom <len-l@telus.net> |
|---|---|
| date | Thu, 07 Feb 2013 16:46:26 -0800 |
| parents | f52af9cc89ad |
| children | ac4492beae7c |
| files | docs/reST/ext/utils.py |
| diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/reST/ext/utils.py Thu Jan 31 20:51:03 2013 -0600 +++ b/docs/reST/ext/utils.py Thu Feb 07 16:46:26 2013 -0800 @@ -1,6 +1,8 @@ import docutils.nodes import sphinx.addnodes +import sys + class GetError(LookupError): pass @@ -93,8 +95,7 @@ # as_unicode: Allow a Python "r" string to represent a unicode string. # e.g.: as_unicode(r"Bo\u00F6tes") == u"Bo\u00F6tes" # Python 2.x # as_unicode(r"Bo\u00F6tes") == "Bo\u00F6tes" # Python 3.x -try: - eval("u'a'") +if sys.version_info < (3,): def as_bytes(string): """ '<binary literal>' => '<binary literal>' """ return string @@ -103,7 +104,7 @@ """ r'<Unicode literal>' => u'<Unicode literal>' """ return rstring.decode('unicode_escape', 'strict') -except SyntaxError: +else: def as_bytes(string): """ '<binary literal>' => b'<binary literal>' """ return string.encode('latin-1', 'strict')
