Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.9 compatibility master issue #59980

Closed
23 of 26 tasks
xmo-odoo opened this issue Oct 14, 2020 · 3 comments
Closed
23 of 26 tasks

Python 3.9 compatibility master issue #59980

xmo-odoo opened this issue Oct 14, 2020 · 3 comments
Assignees

Comments

@xmo-odoo
Copy link
Collaborator

xmo-odoo commented Oct 14, 2020

  • ????
    • seems to block on socket during tours?
  • dependencies
    • lxml 4.3.2 doesn't compile (most recent version works)
    • greenlet 0.4.15 doesn't compile (most recent version works)
    • reportlab 3.5.13 doesn't work (most recent version works)
    • Pillow 5.4.1 triggers warnings (most recent version works) #146718
    • freezegun 0.3.11 calls time.clock() which was removed in Python 3.8 (cf Conditionally patch time.clock spulec/freezegun#296), 1.0 works
    • xlrd 1.1: (unclear, test_xls_success fails with Unable to load "xls" file: requires Python module "xlrd" despite xlrd being installed, seems to work in a shell, maybe MAINT: time.clock->time.perf_counter closes #294 python-excel/xlrd#300 which is also a Python 3.8 / time.clock issue)
    • xlrd 1.2: defusedxml doesn't quite expose the right classes / methods, which makes xlrd fall into the path of using ElementTree.getiterator() instead of ElememtTree.iter()... and the former has been removed in 3.9
      issue is known but extant in defusedxml (defusedxml lacks an Element class tiran/defusedxml#48), xlrd has gone readonly (so odds of fix are low), best options seem to be
      • swap ensure_elementtree_imported to directly import lxml and / or bypass it (set the three globals it updates directly)
      • migrate xlsx support to openpyxl which is actively maintained
  • APIs
    • threading.Thread.isAlive had been undocumented for multiple versions and was removed entirely in 3.9 (bpo-35283)
  • opcodes
    • CONTAINS_OP (in / not in)

    • IS_OP (is / is not)

    • LIST_EXTEND (non-empty const list literals)

      In Python 3.8, a non-empty list literal compiles to

      0 LOAD_CONST               1 (1)
      2 LOAD_CONST               2 (2)
      4 LOAD_CONST               3 (3)
      6 BUILD_LIST               3
      

      in Python 3.9, the same compiles to

      0 BUILD_LIST               0
      2 LOAD_CONST               1 ((1, 2, 3))
      4 LIST_EXTEND              1
      
    • SET_UPDATE (non-empty const set literals, see above)

    • LIST_TO_TUPLE (BPO 39320, also source of the above and below so "unpacking of starred values in arguments and the right hand side of assignments", do we want to allow that in safe_eval?)

      foo(*a, *b, **c, **d)
      

      in 3.8:

       0 LOAD_GLOBAL              0 (foo)
       2 LOAD_FAST                0 (a)
       4 LOAD_FAST                1 (b)
       6 BUILD_TUPLE_UNPACK_WITH_CALL     2
       8 LOAD_FAST                2 (c)
      10 LOAD_FAST                3 (d)
      12 BUILD_MAP_UNPACK_WITH_CALL     2
      14 CALL_FUNCTION_EX         1
      

      in 3.9:

       0 LOAD_GLOBAL              0 (fo
       2 BUILD_LIST               0
       4 LOAD_FAST                0 (a)
       6 LIST_EXTEND              1
       8 LOAD_FAST                1 (b)
      10 LIST_EXTEND              1
      12 LIST_TO_TUPLE
      14 BUILD_MAP                0
      16 LOAD_FAST                2 (c)
      18 DICT_MERGE               1
      20 LOAD_FAST                3 (d)
      22 DICT_MERGE               1
      24 CALL_FUNCTION_EX         1
      
    • DICT_UPDATE

    • DICT_MERGE
      used for foo(**bar), which turns out we have at least one of

    • RERAISE, JUMP_IF_NOT_EXC_MATCH (exception handlers)

  • deprecation warnings (moar)
    • Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working [res_bank.py:119] 8885ddf
    • DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working [sandbox.py:82]
      Issue fixed in Import abstract base classes from collections.abc pallets/jinja#867 but no release since (the tracking issue Release a version containing #867 pallets/jinja#973 was closed)
      Note: apparently now fixed (since original comment), requires updating Jinja, see Need to update jinja2 fix ABC import #61103
    • DeprecationWarning: Sampling from a set deprecated
      since Python 3.9 and will be removed in a subsequent version. [survey_survey.py:440] [exhibitor.py:86]
      in 5810ea2 BaseModel was registered against Set and Sequence specifically to work with random.sample, we could remove the Set registration (hopefully that doesn't work anything) leaving the Sequence one, but I'll open a bpo to ask to improve the check in case that works
    • babel/util.py:70: DeprecationWarning: The parser module is deprecated and will be removed in future versions of Python
      fixed in Replace usage of parser.suite with ast.parse python-babel/babel#684 but not release yet
@xmo-odoo
Copy link
Collaborator Author

ping @amigrave @julienlegros freezegun & xlrd issues apply to 3.8 so @d-fence sez you might be interested
notsure

@MjAbuz
Copy link
Contributor

MjAbuz commented Oct 31, 2020

Same here on ubuntu 20.04,

2020-10-30 23:55:27,813 45662 WARNING server py.warnings: /usr/lib/python3/dist-packages/jinja2/sandbox.py:19: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
from collections import Mapping

The fix is done @xmo-odoo

MjAbuz referenced this issue in MjAbuz/Odoo-Bangla Oct 31, 2020
Fix for Using or importing the ABCs from collections instead of from collections.abc is deprecated since Python 3.3, and in 3.10 it will stop working and py.warnings: /usr/lib/python3/dist-packages/jinja2/sandbox.py:19: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working, its a bug see the fix here pallets/jinja@a7ba0b6"
xmo-odoo added a commit to odoo-dev/odoo that referenced this issue Nov 27, 2020
Only updates outdated requirements which actively cause issues:

* freezegun broken in 3.8 (removal of time.clock)
* xlrd broken in 3.8 (removal of time.clock)
* also monkeypatches xlrd.xlsx for 3.9 (removal of
  Element.getiterator, breaks because of defusedxml)
* jinja triggers DeprecationWarning in 3.8
* pillow triggers warning in 3.9
* lxml, greenlet don't compile in 3.9
* reportlab doesn't work in 3.9

New versions try to match those of Debian Bullseye.

Also adds a script to more easily compare dependency versions between
the requirements files and what's in various distributions (currently
supports checking against debian and ubuntu).

Furthermore updates warnings filtering:

* removes xlrd (mischeck was monkeypatched as noted above)
* removes setuptools (was for older versions, one would hope this
  isn't an issue anymore)
* adds babel: python-babel/babel#684 fixes the deprecation warning but
  is not part of any release yet
* ignores error related to `random.sample` on a set, this is a
  diagnostics bug because recordsets implement both Sequence and Set,
  and the stdlib checks for Set first (bpo-42470)

See odoo#59980
Closes odoo#61103
xmo-odoo added a commit to odoo-dev/odoo that referenced this issue Nov 27, 2020
Python 3.9 has 10 new bytecode instructions, for now this commit adds 8

* CONTAINS_OP / IS_OP: moved out of COMPARE_OP which is now only used
  for *rich* comparisons (bpo-39156)
* JUMP_IF_NOT_EXC_MATCH: also moved out of COMPARE_OP for the sole
  purpose of testing exception types
* RERAISE and WITH_EXCEPT_START (bpo-32949) used to simplify the
  context manager bytecode, but RERAISE was then used for
  try/except/finally, we don't support context managers in safe_eval
  so we don't care about the latter
* LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE, DICT_MERGE and
  DICT_UPDATE (bpo-39320) updates to unpacking (* and **) in various
  contexts
  * LIST_TO_TUPLE we're skipping as it's only used when calling a
    function with two `*arg` parameters (aka `foo(*a, *b)`)
  * SET_UPDATE is used for set literals of 3 or more items or
    unpacking ({*a})
  * LIST_EXTEND is used in the same cases as well as function calls
    with unpacking
  * DICT_MERGE is used for function calls with `**kwargs`
  * DICT_UPDATE is used when unpacking in a dict literal (`{**kw}`)

See odoo#59980
robodoo pushed a commit that referenced this issue Nov 27, 2020
Only updates outdated requirements which actively cause issues:

* freezegun broken in 3.8 (removal of time.clock)
* xlrd broken in 3.8 (removal of time.clock)
* also monkeypatches xlrd.xlsx for 3.9 (removal of
  Element.getiterator, breaks because of defusedxml)
* jinja triggers DeprecationWarning in 3.8
* pillow triggers warning in 3.9
* lxml, greenlet don't compile in 3.9
* reportlab doesn't work in 3.9

New versions try to match those of Debian Bullseye.

Also adds a script to more easily compare dependency versions between
the requirements files and what's in various distributions (currently
supports checking against debian and ubuntu).

Furthermore updates warnings filtering:

* removes xlrd (mischeck was monkeypatched as noted above)
* removes setuptools (was for older versions, one would hope this
  isn't an issue anymore)
* adds babel: python-babel/babel#684 fixes the deprecation warning but
  is not part of any release yet
* ignores error related to `random.sample` on a set, this is a
  diagnostics bug because recordsets implement both Sequence and Set,
  and the stdlib checks for Set first (bpo-42470)

See #59980
Closes #61103

closes #62380

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this issue Nov 27, 2020
Only updates outdated requirements which actively cause issues:

* freezegun broken in 3.8 (removal of time.clock)
* xlrd broken in 3.8 (removal of time.clock)
* also monkeypatches xlrd.xlsx for 3.9 (removal of
  Element.getiterator, breaks because of defusedxml)
* jinja triggers DeprecationWarning in 3.8
* pillow triggers warning in 3.9
* lxml, greenlet don't compile in 3.9
* reportlab doesn't work in 3.9

New versions try to match those of Debian Bullseye.

Also adds a script to more easily compare dependency versions between
the requirements files and what's in various distributions (currently
supports checking against debian and ubuntu).

Furthermore updates warnings filtering:

* removes xlrd (mischeck was monkeypatched as noted above)
* removes setuptools (was for older versions, one would hope this
  isn't an issue anymore)
* adds babel: python-babel/babel#684 fixes the deprecation warning but
  is not part of any release yet
* ignores error related to `random.sample` on a set, this is a
  diagnostics bug because recordsets implement both Sequence and Set,
  and the stdlib checks for Set first (bpo-42470)

See odoo#59980
Closes odoo#61103

X-original-commit: 648635d
robodoo pushed a commit that referenced this issue Nov 27, 2020
Only updates outdated requirements which actively cause issues:

* freezegun broken in 3.8 (removal of time.clock)
* xlrd broken in 3.8 (removal of time.clock)
* also monkeypatches xlrd.xlsx for 3.9 (removal of
  Element.getiterator, breaks because of defusedxml)
* jinja triggers DeprecationWarning in 3.8
* pillow triggers warning in 3.9
* lxml, greenlet don't compile in 3.9
* reportlab doesn't work in 3.9

New versions try to match those of Debian Bullseye.

Also adds a script to more easily compare dependency versions between
the requirements files and what's in various distributions (currently
supports checking against debian and ubuntu).

Furthermore updates warnings filtering:

* removes xlrd (mischeck was monkeypatched as noted above)
* removes setuptools (was for older versions, one would hope this
  isn't an issue anymore)
* adds babel: python-babel/babel#684 fixes the deprecation warning but
  is not part of any release yet
* ignores error related to `random.sample` on a set, this is a
  diagnostics bug because recordsets implement both Sequence and Set,
  and the stdlib checks for Set first (bpo-42470)

See #59980
Closes #61103

closes #62510

X-original-commit: 648635d
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this issue Dec 8, 2020
Python 3.9 has 10 new bytecode instructions, for now this commit adds 8

* CONTAINS_OP / IS_OP: moved out of COMPARE_OP which is now only used
  for *rich* comparisons (bpo-39156)
* JUMP_IF_NOT_EXC_MATCH: also moved out of COMPARE_OP for the sole
  purpose of testing exception types
* RERAISE and WITH_EXCEPT_START (bpo-32949) used to simplify the
  context manager bytecode, but RERAISE was then used for
  try/except/finally, we don't support context managers in safe_eval
  so we don't care about the latter
* LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE, DICT_MERGE and
  DICT_UPDATE (bpo-39320) updates to unpacking (* and **) in various
  contexts
  * LIST_TO_TUPLE we're skipping as it's only used when calling a
    function with two `*arg` parameters (aka `foo(*a, *b)`)
  * SET_UPDATE is used for set literals of 3 or more items or
    unpacking ({*a})
  * LIST_EXTEND is used in the same cases as well as function calls
    with unpacking
  * DICT_MERGE is used for function calls with `**kwargs`
  * DICT_UPDATE is used when unpacking in a dict literal (`{**kw}`)

See #59980

closes #62498

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this issue Dec 8, 2020
Python 3.9 has 10 new bytecode instructions, for now this commit adds 8

* CONTAINS_OP / IS_OP: moved out of COMPARE_OP which is now only used
  for *rich* comparisons (bpo-39156)
* JUMP_IF_NOT_EXC_MATCH: also moved out of COMPARE_OP for the sole
  purpose of testing exception types
* RERAISE and WITH_EXCEPT_START (bpo-32949) used to simplify the
  context manager bytecode, but RERAISE was then used for
  try/except/finally, we don't support context managers in safe_eval
  so we don't care about the latter
* LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE, DICT_MERGE and
  DICT_UPDATE (bpo-39320) updates to unpacking (* and **) in various
  contexts
  * LIST_TO_TUPLE we're skipping as it's only used when calling a
    function with two `*arg` parameters (aka `foo(*a, *b)`)
  * SET_UPDATE is used for set literals of 3 or more items or
    unpacking ({*a})
  * LIST_EXTEND is used in the same cases as well as function calls
    with unpacking
  * DICT_MERGE is used for function calls with `**kwargs`
  * DICT_UPDATE is used when unpacking in a dict literal (`{**kw}`)

See odoo#59980

X-original-commit: 3d1c723
@xmo-odoo
Copy link
Collaborator Author

xmo-odoo commented Dec 8, 2020

Closing this as #62498 has been merged.

New issues should be reported separately. We'll probably find a bunch if @d-fence manages to get tox working.

@xmo-odoo xmo-odoo closed this as completed Dec 8, 2020
robodoo pushed a commit that referenced this issue Dec 8, 2020
Python 3.9 has 10 new bytecode instructions, for now this commit adds 8

* CONTAINS_OP / IS_OP: moved out of COMPARE_OP which is now only used
  for *rich* comparisons (bpo-39156)
* JUMP_IF_NOT_EXC_MATCH: also moved out of COMPARE_OP for the sole
  purpose of testing exception types
* RERAISE and WITH_EXCEPT_START (bpo-32949) used to simplify the
  context manager bytecode, but RERAISE was then used for
  try/except/finally, we don't support context managers in safe_eval
  so we don't care about the latter
* LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE, DICT_MERGE and
  DICT_UPDATE (bpo-39320) updates to unpacking (* and **) in various
  contexts
  * LIST_TO_TUPLE we're skipping as it's only used when calling a
    function with two `*arg` parameters (aka `foo(*a, *b)`)
  * SET_UPDATE is used for set literals of 3 or more items or
    unpacking ({*a})
  * LIST_EXTEND is used in the same cases as well as function calls
    with unpacking
  * DICT_MERGE is used for function calls with `**kwargs`
  * DICT_UPDATE is used when unpacking in a dict literal (`{**kw}`)

See #59980

closes #62989

X-original-commit: 3d1c723
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
fmdl pushed a commit to fmdl/odoo that referenced this issue Apr 29, 2021
Only updates outdated requirements which actively cause issues:

* freezegun broken in 3.8 (removal of time.clock)
* xlrd broken in 3.8 (removal of time.clock)
* also monkeypatches xlrd.xlsx for 3.9 (removal of
  Element.getiterator, breaks because of defusedxml)
* jinja triggers DeprecationWarning in 3.8
* pillow triggers warning in 3.9
* lxml, greenlet don't compile in 3.9
* reportlab doesn't work in 3.9

New versions try to match those of Debian Bullseye.

Also adds a script to more easily compare dependency versions between
the requirements files and what's in various distributions (currently
supports checking against debian and ubuntu).

Furthermore updates warnings filtering:

* removes xlrd (mischeck was monkeypatched as noted above)
* removes setuptools (was for older versions, one would hope this
  isn't an issue anymore)
* adds babel: python-babel/babel#684 fixes the deprecation warning but
  is not part of any release yet
* ignores error related to `random.sample` on a set, this is a
  diagnostics bug because recordsets implement both Sequence and Set,
  and the stdlib checks for Set first (bpo-42470)

See odoo#59980
Closes odoo#61103

closes odoo#62380

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
fmdl pushed a commit to fmdl/odoo that referenced this issue Apr 29, 2021
Python 3.9 has 10 new bytecode instructions, for now this commit adds 8

* CONTAINS_OP / IS_OP: moved out of COMPARE_OP which is now only used
  for *rich* comparisons (bpo-39156)
* JUMP_IF_NOT_EXC_MATCH: also moved out of COMPARE_OP for the sole
  purpose of testing exception types
* RERAISE and WITH_EXCEPT_START (bpo-32949) used to simplify the
  context manager bytecode, but RERAISE was then used for
  try/except/finally, we don't support context managers in safe_eval
  so we don't care about the latter
* LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE, DICT_MERGE and
  DICT_UPDATE (bpo-39320) updates to unpacking (* and **) in various
  contexts
  * LIST_TO_TUPLE we're skipping as it's only used when calling a
    function with two `*arg` parameters (aka `foo(*a, *b)`)
  * SET_UPDATE is used for set literals of 3 or more items or
    unpacking ({*a})
  * LIST_EXTEND is used in the same cases as well as function calls
    with unpacking
  * DICT_MERGE is used for function calls with `**kwargs`
  * DICT_UPDATE is used when unpacking in a dict literal (`{**kw}`)

See odoo#59980

closes odoo#62498

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
ThomasBinsfeld pushed a commit to acsone/odoo that referenced this issue Jan 10, 2023
Python 3.9 has 10 new bytecode instructions, for now this commit adds 8

* CONTAINS_OP / IS_OP: moved out of COMPARE_OP which is now only used
  for *rich* comparisons (bpo-39156)
* JUMP_IF_NOT_EXC_MATCH: also moved out of COMPARE_OP for the sole
  purpose of testing exception types
* RERAISE and WITH_EXCEPT_START (bpo-32949) used to simplify the
  context manager bytecode, but RERAISE was then used for
  try/except/finally, we don't support context managers in safe_eval
  so we don't care about the latter
* LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE, DICT_MERGE and
  DICT_UPDATE (bpo-39320) updates to unpacking (* and **) in various
  contexts
  * LIST_TO_TUPLE we're skipping as it's only used when calling a
    function with two `*arg` parameters (aka `foo(*a, *b)`)
  * SET_UPDATE is used for set literals of 3 or more items or
    unpacking ({*a})
  * LIST_EXTEND is used in the same cases as well as function calls
    with unpacking
  * DICT_MERGE is used for function calls with `**kwargs`
  * DICT_UPDATE is used when unpacking in a dict literal (`{**kw}`)

See odoo#59980

closes odoo#62498

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
IT-Ideas pushed a commit to acsone/odoo that referenced this issue Jan 30, 2024
Python 3.9 has 10 new bytecode instructions, for now this commit adds 8

* CONTAINS_OP / IS_OP: moved out of COMPARE_OP which is now only used
  for *rich* comparisons (bpo-39156)
* JUMP_IF_NOT_EXC_MATCH: also moved out of COMPARE_OP for the sole
  purpose of testing exception types
* RERAISE and WITH_EXCEPT_START (bpo-32949) used to simplify the
  context manager bytecode, but RERAISE was then used for
  try/except/finally, we don't support context managers in safe_eval
  so we don't care about the latter
* LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE, DICT_MERGE and
  DICT_UPDATE (bpo-39320) updates to unpacking (* and **) in various
  contexts
  * LIST_TO_TUPLE we're skipping as it's only used when calling a
    function with two `*arg` parameters (aka `foo(*a, *b)`)
  * SET_UPDATE is used for set literals of 3 or more items or
    unpacking ({*a})
  * LIST_EXTEND is used in the same cases as well as function calls
    with unpacking
  * DICT_MERGE is used for function calls with `**kwargs`
  * DICT_UPDATE is used when unpacking in a dict literal (`{**kw}`)

See odoo#59980

closes odoo#62498

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants