Skip to content

[FW] 16.0 py311 moc#112440

Closed
fw-bot wants to merge 4 commits intoodoo:saas-16.1from
odoo-dev:saas-16.1-16.0-py311-moc-s6CM-fw
Closed

[FW] 16.0 py311 moc#112440
fw-bot wants to merge 4 commits intoodoo:saas-16.1from
odoo-dev:saas-16.1-16.0-py311-moc-s6CM-fw

Conversation

@fw-bot
Copy link
Copy Markdown
Contributor

@fw-bot fw-bot commented Feb 10, 2023

Since the next imminent release of Debian Bookworm will come with Python 3.11 as some other distros (like Fedora 37) this PR adapts Odoo 16.0 to work with Python 3.11.

Note:
This is an excerpt from this testing branch that was made to test against the Jammy and Bookworm distributions.

Forward-Port-Of: #112317

pimodoo and others added 4 commits February 10, 2023 16:45
When python expression is evaluated in odoo form an action or qweb, we
are checking the opcodes generated by the evaluation of this code. We do
such a verification, because the code from actions and templates can be
written by someone having not access to the server and we don't want to
let them perform actions out of the scope of their database.

In python 3.11, some opcodes from previous versions of Python have been
renamed, grouped or sepcified. There are also new ones that have been
introduce.

In this PR, we are whitelisting the new ones that are needed by odoo to
properly work in this version of Python.

X-original-commit: 65dd86b
As getdefaultlocale is deprecated in 3.11 in favor of getlocale which is
available since at least 3.0.

X-original-commit: 5d90802
Since python/cpython#18544, unittest mock is not able to properly find
the "odoo.tools.config".

When trying to patch the `options` dictionnary, it leads to
`AttributeError: module 'odoo.tools.config' has no attribute 'options'`

In order to have the tests
working in python <= 3.11, we have to import the config module and patch
the options in place.

X-original-commit: 482cb08
Since Python 3.11, sampling from a set deprecated, the population must
be a sequence.

This commit applies the suggested fix.

Also, the filtering of the deprecation warning about sampling from set
can be disabled when the python version is not 3.9. This warning was
wrongly triggered since 3.9 because recordsets are bot a sequence and a
set.
This was fixed in python 3.10, see https://bugs.python.org/issue42470

X-original-commit: 67c7cea
@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented Feb 10, 2023

Pull request status dashboard

@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Feb 10, 2023

This PR targets saas-16.1 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Feb 10, 2023
@C3POdoo C3POdoo added the RD research & development, internal work label Feb 10, 2023
@fw-bot
Copy link
Copy Markdown
Contributor Author

fw-bot commented Feb 10, 2023

@d-fence @xmo-odoo the next pull request (#112450) is in conflict. You can merge the chain up to here by saying

@fw-bot r+

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@d-fence
Copy link
Copy Markdown
Contributor

d-fence commented Feb 13, 2023

@fw-bot r+

robodoo pushed a commit that referenced this pull request Feb 13, 2023
When python expression is evaluated in odoo form an action or qweb, we
are checking the opcodes generated by the evaluation of this code. We do
such a verification, because the code from actions and templates can be
written by someone having not access to the server and we don't want to
let them perform actions out of the scope of their database.

In python 3.11, some opcodes from previous versions of Python have been
renamed, grouped or sepcified. There are also new ones that have been
introduce.

In this PR, we are whitelisting the new ones that are needed by odoo to
properly work in this version of Python.

X-original-commit: 65dd86b
Part-of: #112440
robodoo pushed a commit that referenced this pull request Feb 13, 2023
As getdefaultlocale is deprecated in 3.11 in favor of getlocale which is
available since at least 3.0.

X-original-commit: 5d90802
Part-of: #112440
robodoo pushed a commit that referenced this pull request Feb 13, 2023
Since python/cpython#18544, unittest mock is not able to properly find
the "odoo.tools.config".

When trying to patch the `options` dictionnary, it leads to
`AttributeError: module 'odoo.tools.config' has no attribute 'options'`

In order to have the tests
working in python <= 3.11, we have to import the config module and patch
the options in place.

X-original-commit: 482cb08
Part-of: #112440
robodoo pushed a commit that referenced this pull request Feb 13, 2023
Since Python 3.11, sampling from a set deprecated, the population must
be a sequence.

This commit applies the suggested fix.

Also, the filtering of the deprecation warning about sampling from set
can be disabled when the python version is not 3.9. This warning was
wrongly triggered since 3.9 because recordsets are bot a sequence and a
set.
This was fixed in python 3.10, see https://bugs.python.org/issue42470

closes #112440

X-original-commit: 67c7cea
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
@robodoo robodoo temporarily deployed to merge February 13, 2023 09:39 Inactive
@robodoo robodoo closed this Feb 13, 2023
@d-fence d-fence deleted the saas-16.1-16.0-py311-moc-s6CM-fw branch February 13, 2023 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

forwardport This PR was created by @fw-bot RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants