Opened 4 years ago

Closed 4 years ago

#6036 enhancement closed fixed (fixed)

Port remaining code in `twisted.python.deprecate` to Python 3

Reported by: Itamar Turner-Trauring Owned by: Itamar Turner-Trauring
Priority: normal Milestone: Python 3.3 Minimal
Component: core Keywords:
Cc: Branch: branches/deprecate-py3-6036-2
branch-diff, diff-cov, branch-cov, buildbot
Author: itamarst

Description

Parts of trial depend on the remaining code in twisted.python.deprecate that hasn't yet been ported to Python 3; all of it should be ported, or that dependency removed.

Change History (11)

comment:1 Changed 4 years ago by itamarst

Author: itamarst
Branch: branches/deprecate-py3-6036

(In [35888]) Branching to 'deprecate-py3-6036'

comment:2 Changed 4 years ago by Itamar Turner-Trauring

Keywords: review added
Owner: set to Jean-Paul Calderone

comment:3 Changed 4 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Itamar Turner-Trauring

Should be split into separate tickets for twisted.python.modules changes and twisted.python.deprecate changes, as discussed on IRC.

comment:4 Changed 4 years ago by itamarst

Branch: branches/deprecate-py3-6036branches/deprecate-py3-6036-2

(In [35903]) Branching to 'deprecate-py3-6036-2'

comment:5 Changed 4 years ago by Itamar Turner-Trauring

Keywords: review added
Owner: changed from Itamar Turner-Trauring to Jean-Paul Calderone

comment:6 Changed 4 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Itamar Turner-Trauring
  1. twisted/python/test/deprecatedattributes.py could use a copyright header and a module docstring
  2. Also in deprecatedattributes.py, the comment above the reflect import is obsolete - there is no longer a circular dependency between those two modules (even disregarding Python 3 porting artifacts).
  3. *Also* reflect isn't actually used once it's imported.
  4. Another unused import, traceback, in twisted/python/reflect.py - not new in this branch though.
  5. in test_deprecate.py, ImportedModuleAttributeTests.pathEntryTree first encodes a path string using UTF-8 and then potentially tries to decode it using ASCII by way of nativeString. This is fine until we encounter a non-ASCII path. Not that I really care about non-ASCII paths, but I think we might have decided to support them (even before FilePath supports them). Not supporting them would be easier, though. :) This came up in twisted.trial.test.test_warnings and apparently the solution was to just explicitly decode using UTF-8 and put the result into sys.path (ie, not try to use nativeString for this case). That's in trunk now, but I have no idea if it actually works.
  6. Oops, ditto that problem for checkOneWarning.
  7. And WarnAboutFunctionTests.setUp.
  8. For deciding whether to call invalidate_caches or not, perhaps a try/except ImportError is better than a _PY3 check. Again, this is what the code in twisted/trial/test/test_warnings.py does.

Nothing major here except perhaps the nativeString issue, the resolution to which I'm curious about, so I'd like to look at that, at least, before this is merged.

comment:7 Changed 4 years ago by itamarst

(In [35921]) Address review comments. Refs #6036

comment:8 Changed 4 years ago by itamarst

(In [35922]) Address review comments, in the correct branch. Refs #6036

comment:9 Changed 4 years ago by Itamar Turner-Trauring

Keywords: review added
Owner: changed from Itamar Turner-Trauring to Jean-Paul Calderone

OK, fixed, in a number of ways depending on nativeString case.

http://buildbot.twistedmatrix.com/boxes-supported?branch=/branches/deprecate-py3-6036-2 is running.

comment:10 Changed 4 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Itamar Turner-Trauring

Okay, great, as long as buildbot is happy (the documentation builder isn't, but I don't think that's actually a new error).

comment:11 Changed 4 years ago by itamarst

Resolution: fixed
Status: newclosed

(In [35927]) Merge deprecate-py3-6036-2.

Author: itamar Review: exarkun Fixes: #6036

twisted.python.deprecate now runs on Python 3.

Note: See TracTickets for help on using tickets.