Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • erp5 erp5
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Merge requests 141
    • Merge requests 141
  • 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
  • nexedi
  • erp5erp5
  • Merge requests
  • !853

Closed
Created Mar 29, 2019 by Jérome Perrin@jeromeOwner
  • Report abuse
Report abuse

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

  • Overview 13
  • Commits 7
  • 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
Reviewer
Request review from
Time tracking
Source branch: fix/python3-syntax
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7