On 8/20/25 11:15 AM, Burnin Ivan wrote:
> Greetings,
> I apologize for the mistake in your first name.

No worries.

> 
>  
> 
> I've done some experiments and it seems that the problem is only with
> Python 3.6 and this new test that was introduced in 3.3.5. When using
> Python from 3.7 to 3.12 - the test does not fail.
> 
> While searching for the cause of the problem, we found that forced use
> of UTF-8 appeared in Python 3.7.
> 
> PEP 538 legacy C locale coercion 
> https://docs.python.org/3/whatsnew/3.7.html#whatsnew37-pep538
> 
> PEP 540 forced UTF-8 runtime mode 
> https://docs.python.org/3/whatsnew/3.7.html#whatsnew37-pep540

As per these PEP pages, the locale coercion is not supported by all
platforms and is restricted to the POSIX locale.  And PEP 540 enables
UTF8 mode only for C and POSIX locales as well.  So, e.g. on Windows
we'll still likley get some non-UTF8 locale by default and the test
will likely fail.

PEP 686 will turn all UTF8 mode on all platforms by default, but it
will only happen in python 3.15.

> Should I send a patch to the 3.3 branch or to main? It seems that this
> concerns 3.3 specifically.

Given the explanation above, the patch should go to main, because
UTF8 mode is not enabled for all platforms today.

Best regards, Ilya Maximets.

> 
> Best regards
> 
> Ivan Burnin
> 
>  
> 
> *От**: *Ilya Maximets <i.maxim...@ovn.org>
> *Дата**: *понедельник, 18 августа2025 г. в20:55
> *Кому**: *Burnin Ivan <IBurnin@k2.cloud>, d...@openvswitch.org 
> <d...@openvswitch.org>
> *Копия**: *i.maxim...@ovn.org <i.maxim...@ovn.org>, Rukomoinikova Aleksandra 
> <ARukomoinikova@k2.cloud>
> *Тема**: *Re: [ovs-dev] FW: [PATCH] checkpath.py: Set explict encoding in 
> method do_authors_exist.
> 
> On 8/16/25 2:27 PM, Burnin Ivan wrote:
>> Greetings, Ilia!
> 
> That's a terrible transliteration.
> 
>> I am currently using ovs version 3.3.1, but I want to upgrade to 3.3.5.
>> Unfortunately, I am forced to use Python 3.6. Only one test fails, which 
>> reads the AUTHORS.rst file
>> and it seems that it appeared in openvswitch version 3.3.5.
>> I also cannot upgrade to 3.5, since it does not support my version of Python.
> 
> Hrm, I see that the author check was backported down to 3.3 for some reason.
> So, yes we should fix that at least on 3.4 and 3.3 that supposed to support
> older versions of python.  At the same time, I did some research and it seems
> like UTF-8 is default on most platforms, but not all of them, e.g. Windows is
> a notable example.  And the UTF-8 mode will not be enabled by default until
> PEP 686 (https://peps.python.org/pep-0686/ 
> <https://peps.python.org/pep-0686/>) in Python 3.15.
> So, we should fix that even on the main branch.  Please, update your commit
> message with that information, as that would be the primary reason for a
> change on main.  We do not care about python versions below 3.7 there.
> 
>> Sorry for my multiple attempts to submit a patch, this is my first time.
> 
> No worries, but please make sure that you can build OVS with your changes
> without warnings, 'make flake8-check' fails right now (there is a line length
> warning).
> 
> And even in your last submission you have a difference between the 'From:'
> and the 'Signed-off-by' tag.  You need to re-configure your mail client or
> your git.  But I strongly recommend you just switch to 'git send-email'
> for sending patches as in the worst case it will add an extra 'From:' that
> matches the git author configuration before sending the patch.  Some of
> your colleagues are using 'git send-email', AFAICT, so you may ask them how
> to configure it for your mail server.
> 
> Best regards, Ilya Maximets.
> 
>> Best regards, Ivan Burnin
>> 
>> 16.08.2025, 04:12 пользователь "Ilya Maximets" <i.maxim...@ovn.org 
>> <mailto:i.maxim...@ovn.org <mailto:i.maxim...@ovn.org>>> написал:
>> 
>> 
>> On 8/15/25 8:56 PM, Burnin Ivan wrote:
>>> Python versions below 3.7 do not correctly read the AUTHORS.rst file unless
>>> the LC_CTYPE environment variable is set to UTF-8. This causes unit test
>>> number 24:checkpatch - AUTHORS.rst existence to fail with
>>> UnicodeDecodeError
>> 
>> 
>> Hi, Ivan. Thanks for the patch!
>> 
>> 
>> Python 3.7 is a minimal supported version since OVS 3.5, and this
>> test only exists in 3.5+. You should have more tests failures if
>> you're using 3.6 or older, in fact, you should not be able to build
>> OVS with this version of Python.
>> 
>> 
>> See the following commit:
>> 3131588e1e1d ("python: Require Python 3.7 for ssl.TLSVersion.")
>> 
>> 
>> Or does it fail with Python 3.7?
>> 
>> 
>> Best regards, Ilya Maximets.
>> 
>> 
>>>
>>> Signed-off-by: Ivan Burnin <ibur...@k2.clou <mailto:ibur...@k2.clou>d 
>>> <mailto:ibur...@k2.clou%3ed>>
>>> ---
>>> utilities/checkpatch.py | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>>
>>> diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
>>> index 28d0977eb..52bb8196b 100755
>>> --- a/utilities/checkpatch.py
>>> +++ b/utilities/checkpatch.py
>>> @@ -841,7 +841,7 @@ def do_authors_exist(authors):
>>> missing_authors = []
>>>
>>>
>>> try:
>>> - with open(get_top_directory() + "/AUTHORS.rst", "r") as file:
>>> + with open(get_top_directory() + "/AUTHORS.rst", "r", encoding="utf-8") as 
>>> file:
>>> file_content = file.read()
>>> for author in authors:
>>> m = re.search(r'<(.*?)>', author)
>> 
>> 
>> 
>> 
>> 
> 

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to