[Python-checkins] peps: Fix Python 3 compatibility.

brett.cannon python-checkins at python.org
Fri Oct 16 13:43:56 EDT 2015


https://hg.python.org/peps/rev/e84b60d6d81f
changeset:   6115:e84b60d6d81f
parent:      6047:2434111428f4
user:        Brett Cannon <brett at python.org>
date:        Fri Sep 11 10:39:21 2015 -0700
summary:
  Fix Python 3 compatibility.

files:
  pep0/pep.py |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/pep0/pep.py b/pep0/pep.py
--- a/pep0/pep.py
+++ b/pep0/pep.py
@@ -2,6 +2,7 @@
 """Code for handling object representation of a PEP."""
 from __future__ import absolute_import
 import re
+import sys
 import textwrap
 import unicodedata
 
@@ -234,7 +235,7 @@
         if len(authors_and_emails) < 1:
             raise PEPError("no authors found", pep_file.name,
                            self.number)
-        self.authors = map(Author, authors_and_emails)
+        self.authors = list(map(Author, authors_and_emails))
 
     def _parse_author(self, data):
         """Return a list of author names and emails."""
@@ -300,3 +301,6 @@
                 'title': self.title_abbr, 'status': self.status_abbr,
                 'authors': self.author_abbr}
         return constants.column_format % pep_info
+
+    if sys.version_info[0] > 2:
+        __str__ = __unicode__

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list