Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #14075
Closed
Open
Issue created Jan 01, 2015 by Trac@tracbot

Unified codebase for Python 2&3

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.

Trac:
Username: Foxboron

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking