Message6088
I've now added 14 more patches (patches 41 through 54).
41. Python 3 preparation: use string.ascii_letters instead of
string.letters.
42. Python 3 preparation: unicode.
This patch introduces roundup/anypy/strings.py, which has a comment
explaining the string representations generally used and common
functions to handle the required conversions. Places in the code that
explicitly reference the "unicode" type / built-in function are
generally changed to use the new functions (or, in a few places where
those new functions don't seem to fit well, other approaches such as
references to type(u'') or use of the codecs module). This patch does
not generally attempt to address text conversions in any places not
currently referencing the "unicode" type (although scripts/import_sf.py
is made to use binary I/O in places as fixing the "unicode" reference
didn't seem coherent otherwise).
43. Python 3 preparation: unichr.
44. Python 3 preparation: StringIO.
This generally arranges for StringIO and cStringIO references to use
io.StringIO for Python 3 but io.BytesIO for Python 2, consistent with
the string representations generally used in Roundup. A special
FasterStringIO in the TAL code, which referenced internals of the old
Python 2 StringIO module, is cut down so it doesn't actually do anything
beyond the StringIO class it inherits from (it would also be reasonable
to remove FasterStringIO completely). One place in roundup_server.py
clearly needing binary I/O is made to use io.BytesIO unconditionally.
45. Python 3 preparation: update ugettext, ungettext uses.
Python 3 does not have ugettext, ungettext methods as distinct from
gettext and ngettext, so uses in Roundup need adjusting to allow for that.
46. Python 3 preparation: avoid string.lower.
47. Python 3 preparation: avoid obsolete types.*Type names.
There are references to types.ListType (not actually used),
types.TupleType (for which tuple is a sufficient replacement) and
types.InstanceType (also removed from the types module in Python 3, it
was the type of instances of old-style classes only). Where
InstanceType is used it's testing whether an exception is a class or
not; support for non-class exceptions was removed in Python 3 and patch
3 in this series removed the sole instance of one in Roundup, so making
the code in question unconditional seems reasonable.
48. Python 3 preparation: remove obsolete email module monkey patch.
This monkey patch has a comment saying it's obsolete with a minimum
Python version of 2.7. Furthermore, it does not work with Python 3,
both because the email.Header name has gone away (only email.header
remains) and because the __dict__ object is a mappingproxy in Python 3
which can't be modified in the way used there. So the monkey patch is
removed in this patch.
49. Python 3 preparation: update email module names.
Various email.* modules were renamed in Python 2.5, and backwards
compatibility for the old names was removed in Python 3.
50. Python 3 preparation: avoid string.find.
51. Python 3 preparation: avoid logging._levelNames.
logging._levelNames is an internal name, not a public interface, and is
not available in current Python 3. Fortunately, logger.setLevel accepts
strings for log levels, not just numeric levels, in 2.7 (although that
change is not mentioned in the 2.7 documentation).
52. Python 3 preparation: update __import__ call for relative import.
53. Python 3 preparation: use byte-string argument to
base64.decodestring for favicon.
54. Python 3 preparation: use byte strings and binary I/O in
roundup/install_util.py.
This code is hashing files it copies and inserting comments with the
hash value. The hash interfaces require bytes objects in Python 3 and
it seems reasonable to use such objects throughout this file. |
|
Date |
User |
Action |
Args |
2018-06-18 01:13:20 | joseph_myers | set | messageid: <1529284400.35.0.56676864532.issue2550960@psf.upfronthosting.co.za> |
2018-06-18 01:13:20 | joseph_myers | set | recipients:
+ joseph_myers, ber, rouilj |
2018-06-18 01:13:20 | joseph_myers | link | issue2550960 messages |
2018-06-18 01:13:19 | joseph_myers | create | |
|