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

[tor-bugs] #14075 [Stem]: Unified codebase for Python 2&3



#14075: Unified codebase for Python 2&3
-------------------------+------------------------
 Reporter:  Foxboron     |          Owner:  atagar
     Type:  enhancement  |         Status:  new
 Priority:  normal       |      Milestone:
Component:  Stem         |        Version:
 Keywords:               |  Actual Points:
Parent ID:               |         Points:
-------------------------+------------------------
 https://github.com/Foxboron/stem/commit/7899e3b23d1a44af56bc0fdf05a2fb20f3ec884c

 This basically unifies the codebase and removes the need for a tool like
 2to3.
 The most instrusive change is the need for having a unified understanding
 of long/int/str/bytes/unicode across version.

 Python 2.7 understands bytes to be str, so this will be consistent, but
 unicode is undefined on Python3.

 So _compat.py solves this by defining long to be int, and unicode to be
 str on python3. This so far solves the problem in a nice way. But needs to
 be kept tidy when writing new code that relies on string types. Currently
 you can refer to bytes to be bytes, but have to import from _compat
 unicode if you want to refer to unicode, as references to "str" is unique
 to the python version.
 This can be made easier to refer to a unified variable, but that could be
 further discussed.

 This will most likely break 2.6 support, but i can work on adding that if
 thats actually needed.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/14075>
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