Opened 7 years ago

Closed 7 years ago

#5914 enhancement closed fixed (fixed)

Port namedAny and friends and filenameToModuleName (from twisted.python.reflect) 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/namedAny-python3-5914-2
branch-diff, diff-cov, branch-cov, buildbot
Author: itamar


namedAny and filenameToModuleName are used by trial, and so it would be good to port them to Python 3.

Change History (6)

comment:1 Changed 7 years ago by itamarst

Author: itamarst
Branch: branches/namedAny-python3-5914

(In [35382]) Branching to 'namedAny-python3-5914'

comment:2 Changed 7 years ago by itamarst

Branch: branches/namedAny-python3-5914branches/namedAny-python3-5914-2

(In [35413]) Branching to 'namedAny-python3-5914-2'

comment:3 Changed 7 years ago by Itamar Turner-Trauring

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

OK, ready for review.

  1. Tests are unmodified, except they refer to different modules/objects.
  2. Code is unmodified, except for switch to reraise().
  3. Added reraise() to twisted.python.compat, with tests.
  4. I ported a few extra named* just because they were in same test suite and it's just a matter of copy/paste; if there's issues, namedAny is the only important one and we can drop them with a little more work.
  5. filenameToModule supports Unicode filenames on Python 3. The implementation may break non-ASCII module names, but that was supposed to be a Python 3.3 feature and I don't see it in changelog so maybe that never happened. And in any case no one will have written those yet.
  6. Tests for ihooks started failing after changes in item 1 above. I get the impression ihooks changed in 2.6, our support was broken, but our tests never triggered it. Certainly the implementation didn't change. So, I just skipped the tests (they can be todo instead if you care).
  7. Buildbot run started here:

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

Status: newassigned

comment:5 Changed 7 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Itamar Turner-Trauring
Status: assignednew
  1. There are some new pyflakes warnings that should be fixed
  2. There's no test coverage for the __traceback__ check in reraise. More generally, I'm not sure reraise needs to handle the case where a traceback isn't passed in? The only use of it is the two argument form with a non-None traceback.
  3. I think LookupsTestCase needs to be deleted from the global namespace in after it is used to create the ihooks subclass.

Please merge when those three points are addressed.

comment:6 Changed 7 years ago by itamarst

Resolution: fixed
Status: newclosed

(In [35441]) Merge namedAny-python3-5914-2

Author: itamar Review: exarkun Fixes: #5914

More functionality from twisted.python.reflect works on Python 3. Also, added a reraise() functions for re-raising exceptions across both Python 2 and Python 3.

Note: See TracTickets for help on using tickets.