Opened 4 years ago

Closed 4 years ago

#5914 enhancement closed fixed (fixed)

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
(github, coverage, patch, buildbot, log)
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 4 years ago by itamarst

  • Author set to itamarst
  • Branch set to branches/namedAny-python3-5914

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

comment:2 Changed 4 years ago by itamarst

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

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

comment:3 Changed 4 years ago by itamar

  • Author changed from itamarst to itamar
  • Keywords review added
  • Owner changed from itamar to exarkun

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 4 years ago by exarkun

  • Status changed from new to assigned

comment:5 Changed 4 years ago by exarkun

  • Keywords review removed
  • Owner changed from exarkun to itamar
  • Status changed from assigned to new
  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 4 years ago by itamarst

  • Resolution set to fixed
  • Status changed from new to closed

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