Skip to content

Simultaneous support for Python 2 and Python 3#46

Open
teeks99 wants to merge 21 commits intoboostorg:developfrom
teeks99:py2-3
Open

Simultaneous support for Python 2 and Python 3#46
teeks99 wants to merge 21 commits intoboostorg:developfrom
teeks99:py2-3

Conversation

@teeks99
Copy link
Copy Markdown
Contributor

@teeks99 teeks99 commented Oct 27, 2018

I've made the changes to follow the program through in both version of python. This Fixes #43.

Please don't merge yet, there are two known defects.

Different results

The windows version shows slightly different results on windows. Looking at the develop results the teeks99-test-py23-p2-w and teeks99-test-py23-p3-w they are the same except for the buildresults which are missing for the python 3 version.

Different output

On linux (running python 3.5), I get an exception running through the log for regex. Running with Python 3 the file results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/test_log.xml contains:

<test-log library="regex" revision="38afec" test-name="icu_example" test-type="run" test-program="libs/regex/example/snippets/icu_example.cpp" target-directory="boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden" toolset="gcc-8~c++2a" show-run-output="false">
<compile result="succeed" timestamp="2018-10-27 08:59:04 UTC">
"g++-8"   -fvisibility-inlines-hidden -std=c++2a -fPIC -m64 -pthread -O0 -fno-inline -Wall -pedantic -g -fvisibility=hidden -Wextra -DBOOST_ALL_NO_LIB=1 -DBOOST_HAS_ICU=1 -DBOOST_REGEX_DYN_LINK=1 -DU_USING_ICU_NAMESPACE=0  -I".." -c -o "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/snippets/icu_example.o" "../libs/regex/example/snippets/icu_example.cpp"

</compile>
<link result="succeed" timestamp="2018-10-27 08:59:04 UTC">
"g++-8"  -Wl,-rpath -Wl,"/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden" -Wl,-rpath-link -Wl,"/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden" -o "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/icu_example" -Wl,--start-group "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/snippets/icu_example.o" "/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden/libboost_regex.so.1.69.0"  -Wl,-Bstatic  -Wl,-Bdynamic -lrt -licudata -licui18n -licuuc -Wl,--end-group -fPIC -m64 -pthread -g -fvisibility=hidden -fvisibility-inlines-hidden 

</link>
<run result="succeed" timestamp="2018-10-27 08:59:04 UTC">
$100.23
£198.12
$
£

EXIT STATUS: 0
</run>
</test-log>

whereas the python 2 version contains:

<test-log library="regex" revision="38afec" test-name="icu_example" test-type="run" test-program="libs/regex/example/snippets/icu_example.cpp" target-directory="boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden" toolset="gcc-8~c++2a" show-run-output="false">
<compile result="succeed" timestamp="2018-10-27 09:03:39 UTC">
"g++-8"   -fvisibility-inlines-hidden -std=c++2a -fPIC -m64 -pthread -O0 -fno-inline -Wall -pedantic -g -fvisibility=hidden -Wextra -DBOOST_ALL_NO_LIB=1 -DBOOST_HAS_ICU=1 -DBOOST_REGEX_DYN_LINK=1 -DU_USING_ICU_NAMESPACE=0  -I".." -c -o "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/snippets/icu_example.o" "../libs/regex/example/snippets/icu_example.cpp"

</compile>
<link result="succeed" timestamp="2018-10-27 09:03:39 UTC">
"g++-8"  -Wl,-rpath -Wl,"/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden" -Wl,-rpath-link -Wl,"/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden" -o "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/icu_example" -Wl,--start-group "/var/boost/run/results/boost/bin.v2/libs/regex/example/icu_example.test/gcc-8~c++2a/debug/threading-multi/visibility-hidden/snippets/icu_example.o" "/var/boost/run/results/boost/bin.v2/libs/regex/build/gcc-8~c++2a/debug/threading-multi/visibility-hidden/libboost_regex.so.1.69.0"  -Wl,-Bstatic  -Wl,-Bdynamic -lrt -licudata -licui18n -licuuc -Wl,--end-group -fPIC -m64 -pthread -g -fvisibility=hidden -fvisibility-inlines-hidden 

</link>
<run result="succeed" timestamp="2018-10-27 09:03:39 UTC">
$100.23
<C2><A3>198.12
$
<C2><A3>

EXIT STATUS: 0
</run>
</test-log>

The difference on the £198.12 vs. <C2><A3>198.12 causes a UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1803: ordinal not in range(128). Any ideas what could be causing the differences in the xml files? Something about the environment that runs the tests?

@jimmbelll
Copy link
Copy Markdown

Please don't merge yet, there are two known defects.

The difference on the £198.12 vs. <C2><A3>198.12 causes a UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1803: ordinal not in range(128). Any ideas what could be causing the differences in the xml files? Something about the environment that runs the tests?

Were you able to make any more progress with this? Are you running your regressions under python 3?

I see in collect_and_upload_logs.py row 182 they're dealing with it as a text file. Opening that file as binary, then read().decode('utf8') (and it should really be in a with statement to close the file) may do it.

Similarly in process_xml_file() row 103.

Neither will get as far as the .translate(...), since it will hit the UnicodeDecodeError first in the read().

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Jul 27, 2023

I haven't looked at this in a very long time, but I believe that issue is still there. I'm still using python 2 for the regression runs.

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 17, 2026

Asking AI about this, and so far here are issues it noticed:

  1. collect_and_upload_logs.py:
- os.path.walk( input_dir, _publish_test_log_files_, None )
+ for name, dirs, files in os.path.walk( input_dir ):
+     _publish_test_log_files_( None, name, files)

should be:

for name, dirs, files in os.walk(input_dir):
    _publish_test_log_files_(None, name, files)

This was changed in one location already correctly, but in another place it should still be fixed.

  1. collect_and_upload_logs.py

There is an instance of this code:

map( lambda x: options.__setitem__( x[0], x[1] ), option_pairs )

It recommends:

list(map(lambda x: options.__setitem__(x[0], x[1]), option_pairs))

Again the same footnote applies: this was fixed in one place correctly, it should be added in another location.

It would be great to complete this pull request. There are multiple options.

  1. if you'd like, I could add the above changes directly into this same PR. And then ask AI to more thoroughly analyze everything.

  2. or via a separate different PR, leaving this one as-is.

  3. or you might have a series of conversations with claude.ai yourself, and continue working on this. Debugging can go much faster in 2026.

Let me know what you think. If I should work on it, then it would be helpful to know the steps to replicate the bugs you saw before. A step by step explanation so I could reproduce the errors locally.

@jimmbelll
Copy link
Copy Markdown

@sdarwin Thanks for looking into this. Both your changes seem legit, but as you see from my comment above, there are also unicode/byte issues I've encountered when trying to actually run the regression tests myself, that static code analyses (like yours) won't catch.

Take a look at the boost regression matrices. You'll see that @teeks99 is still faithfully running them (thank you!), but that he's the only one.

There's a problem on the server side: when I ran the regressions (under Python 3), I got as far as the results uploading, which should put them on that matrix, but the matrix never updated. So whichever script that resides in that server, that transforms uploaded regression results to the matrix, fails for my uploads (and anyone else who's tried it, though maybe it's only me), but clearly continues to works for his. We need to troubleshoot that, and only an admin like yourself has permission to watch it (or see its logs).

Once we're seeing results reliably, then I can fork from this pull request, work through remaining runtime issues, and ultimately do a pull request with higher confidence that it will work end to end.

You'll notice too that the master branch matrix is completely neglected. So running master tests to both verify its operation and put something there would also be good.

See also: Test Matrix Docs.
(With python 2.x being EOL for some time now, this is really support for Python 3 from here on.)

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 17, 2026

Hi Jim,

I got as far as the results uploading, which should put them on that matrix, but the matrix never updated.

In terms of uploads, the previous configuration was that uploads go to "results.boost.org" and then were displayed on the earlier "www.boost.org".

Now... I have rebuilt the ftp server, and using the same URL "results.boost.org" and the same method, results actually go to a directory on "regression.boost.org", which hosts the matrix.

We can attempt to debug this. If you are able to upload results, tell me the filenames (and dates and sizes, although not really required) and I will run locate on the server to see if they are present.

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Apr 18, 2026

You'll notice too that the master branch matrix is completely neglected. So running master tests to both verify its operation and put something there would also be good.

This is a bit of a tangent for this thread, but the master tests are running, they are all just failing due to an issue in the codebase. This has been ongoing for many months.

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 18, 2026

This thread claims that the issue would be resolved if graph_parallel develop is merged to master. But it has been merged.

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 18, 2026

I just tried the graph_parallel tests on the current master, and they (mostly) work for me. (I get two compile errors caused by missing /bigobj and two link errors caused by who knows what.)

@jimmbelll
Copy link
Copy Markdown

jimmbelll commented Apr 19, 2026

We can attempt to debug this. If you are able to upload results, tell me the filenames (and dates and sizes, although not really required) and I will run locate on the server to see if they are present.

Great to hear. I have a regression result that uploaded early afternoon, file name jcbell-msys2-mingw-w64.zip ; I see that the master matrix has updated since but has not picked up my result. Hopefully that gives you enough to go on. (Update: it's just testing two libraries for a faster run: asio & accumulators.)

I did have to work through the master branch jamfile failure that @teeks99 mentions above. I'll do pull req on that after this is resolved. Very small change.

@sdarwin
Copy link
Copy Markdown
Collaborator

sdarwin commented Apr 19, 2026 via email

@jimmbelll
Copy link
Copy Markdown

@teeks99 How difficult is it for you to switch all your regressions to python 3? Which 3.x version would you run?

As you may know, python has lots of evolution (and deprecation) throughout 3.x. Not sure how much it affects this code, but also not sure how much effort should go into staying compatible with 2.x, especially pre-2.7, and even pre 3.9. (Does boost have a policy here?)

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Apr 19, 2026

I'd love to switch to python 3, hence why I started this incomplete MR. It would take a small amount of time to switch over and would save me a ton of time not having to build python2 from source for inclusion in my runner images.

I would like support for a fairly old version of python 3. I have ubuntu trusty images that still run tests on gcc-6, and that comes with python 3.4 has support for python 3.5, so no f-strings :-(

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 19, 2026

There's no need to use Trusty for anything anymore, much less GCC 6.

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Apr 20, 2026

I'm sure I could find a different way such as building gcc6 from scratch, but I have it working with trusty now, and would kind of like to leave it alone.

@pdimov
Copy link
Copy Markdown
Member

pdimov commented Apr 20, 2026

GCC 6 is available on Ubuntu 18.04 via apt-get from the built-in repos.

@teeks99
Copy link
Copy Markdown
Contributor Author

teeks99 commented Apr 20, 2026

I've confirmed that I can update my images to 18.04 and keep the existing gcc runs. That gives us python 3.8.

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

Successfully merging this pull request may close these issues.

Support python 3

4 participants