summaryrefslogtreecommitdiff
path: root/sphinx/util/pycompat.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-28 18:43:40 +0200
committerGeorg Brandl <georg@python.org>2010-07-28 18:43:40 +0200
commit695f93d286f8ea23fff15c92b8d675b36aa592db (patch)
tree85432ca89066315dacf89c686e87cb5aa463d94a /sphinx/util/pycompat.py
parent6a24d9f7f17e469fd9f222613ef0353cb54f04b6 (diff)
downloadsphinx-695f93d286f8ea23fff15c92b8d675b36aa592db.tar.gz
Move the "b" function to pycompat.
Diffstat (limited to 'sphinx/util/pycompat.py')
-rw-r--r--sphinx/util/pycompat.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py
index 7bf768fa..8787a144 100644
--- a/sphinx/util/pycompat.py
+++ b/sphinx/util/pycompat.py
@@ -26,6 +26,14 @@ except NameError:
base_exception = Exception
+# the ubiquitous "bytes" helper function
+if sys.version_info > (3, 0):
+ def b(s):
+ return s.encode('utf-8')
+else:
+ b = str
+
+
try:
any = any
all = all