[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #8755 [Stem]: Python 3 Compatibility



#8755: Python 3 Compatibility
---------------------+------------------------------------------------------
 Reporter:  aj00200  |          Owner:  atagar
     Type:  defect   |         Status:  new   
 Priority:  normal   |      Milestone:        
Component:  Stem     |        Version:        
 Keywords:           |         Parent:        
   Points:           |   Actualpoints:        
---------------------+------------------------------------------------------

Comment(by atagar):

 Hi aj00200. Sorry about the delay and thanks for the patch! Everything
 looks great, except that the last bit (which swaps the decode() call to
 long_to_bytes()) evidently breaks our integ tests for python 2.

 The trouble seems to be that long_to_bytes() strips off leading zeros
 which causes the comparison to fail...

 {{{
 # digest() value of the descriptor in our integ tests
 >>> digest = "00BB5385C0DF28DC6765AC465D0CC7BC6A41AD33"

 # old version (encoding as hex to make it printable)
 >>> digest.decode('hex').encode('hex')
 '00bb5385c0df28dc6765ac465d0cc7bc6a41ad33'

 # new version
 >>> long_to_bytes(int(digest, 16)).encode('hex')
 'bb5385c0df28dc6765ac465d0cc7bc6a41ad33'
 }}}

 This could be fixed by either encoding digest/local_digest and doing a
 zfill, or by keeping the old version. Was the long_to_bytes() change
 necessary to make this work with python 3 or was it a refactoring
 improvement?

 Cheers! -Damian

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/8755#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs