Skip to content

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

Jérome Perrin requested to merge jerome/erp5:fix/python3-syntax into master

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

Converts except X, T to except X as T.

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.

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.

Merge request reports