Ticket #5914 enhancement closed fixed

Opened 20 months ago

Last modified 20 months ago

Port namedAny and friends and filenameToModuleName (from twisted.python.reflect) to Python 3

Reported by: itamar Owned by: itamar
Priority: normal Milestone: Python 3.3 Minimal
Component: core Keywords:
Cc: Branch: branches/namedAny-python3-5914-2
(diff, github, buildbot, log)
Author: itamar Launchpad Bug:


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

Change History


Changed 20 months ago by itamarst

  • branch set to branches/namedAny-python3-5914
  • branch_author set to itamarst

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


Changed 20 months ago by itamarst

  • branch changed from branches/namedAny-python3-5914 to branches/namedAny-python3-5914-2

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


Changed 20 months ago by itamar

  • owner changed from itamar to exarkun
  • keywords review added
  • branch_author changed from itamarst to itamar

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:  http://buildbot.twistedmatrix.com/boxes-supported?branch=/branches/namedAny-python3-5914-2


Changed 20 months ago by exarkun

  • status changed from new to assigned


Changed 20 months ago by exarkun

  • owner changed from exarkun to itamar
  • status changed from assigned to new
  • keywords review removed
  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 test_compat.py after it is used to create the ihooks subclass.

Please merge when those three points are addressed.


Changed 20 months ago by itamarst

  • status changed from new to closed
  • resolution set to fixed

(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.