[tor-bugs] #33825 [Core Tor/Chutney]: Make Environ handle "in" and "get()" like a dict

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Apr 6 02:05:18 UTC 2020


#33825: Make Environ handle "in" and "get()" like a dict
-------------------------+-------------------------------------------------
     Reporter:  teor     |      Owner:  (none)
         Type:  defect   |     Status:  new
     Priority:  Medium   |  Milestone:
    Component:  Core     |    Version:
  Tor/Chutney            |   Keywords:  ipv6, outreachy-ipv6, technical-
     Severity:  Normal   |  debt
Actual Points:           |  Parent ID:  #33050
       Points:  1        |   Reviewer:
      Sponsor:           |
  Sponsor55-can          |
-------------------------+-------------------------------------------------
 Some standard Python dict code doesn't work on chutney's Environ class:
 {{{
 is_in_env = 'foo' in self._env
 value_or_none = self._env.get('foo')
 }}}

 "in" should return a boolean, and "get()" should return the value (or
 None).

 But instead, when the key is missing, sometimes they throw a KeyError. (It
 seems to happen in certain contexts, but not others.)

 We should work out if Environ is missing some of the required dict
 implementation functions. Or if there is some issue with Environ's lookup
 code.

 Then we should implement unit tests, to make sure we don't break Environ
 in future.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33825>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list