Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • erp5 erp5
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 142
    • Merge requests 142
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedinexedi
  • erp5erp5
  • Merge requests
  • !853

WIP: Use python3 compatible syntax where it's already possible

  • Review changes

  • Download
  • Patches
  • Plain diff
Closed Jérome Perrin requested to merge jerome/erp5:fix/python3-syntax into master Mar 29, 2019
  • Overview 13
  • Commits 7
  • Pipelines 0
  • Changes 100+

Use https://docs.python.org/2/library/2to3.html to apply already refactorings that produce code that are still compatible with python 2:

  • except

Converts except X, T to except X as T.

  • numliterals

Converts octal literals into the new syntax.

Using a modified version ( https://lab.nexedi.com/nexedi/erp5/snippets/366 ) that keeps longs as longs and does not rewrite 01 as 0o1 but simply as 1 as we actually had a lot, especially for DateTime.

  • raise

Converts raise E, V to raise E(V), and raise E, V, T to raise E(V).with_traceback(T). If E is a tuple, the translation will be incorrect because substituting tuples for exceptions has been removed in Python 3.

using a modified version ( https://lab.nexedi.com/nexedi/erp5/snippets/368 ) that does not translate the later to raise E(V).with_traceback(T) as this is not supported in python2.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix/python3-syntax
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7