New GitHub issue #118846 from hroncok:<br>

<hr>

<pre>
# Bug report

### Bug description:

When we build Python 3.13.0b1 in Fedora with `--disable-gil`, the PGO task fails. I was able to reproduce this from the 3.13 branch by:

```
$ ./configure --config-cache --without-ensurepip --disable-gil --enable-optimizations
$ make
...
# Next, run the profile task to generate the profile information.
./python -m test --pgo --timeout=
Using random seed: 754312824
0:00:00 load avg: 8.58 Run 44 tests sequentially
0:00:00 load avg: 8.58 [ 1/44] test_array
0:00:01 load avg: 8.58 [ 2/44] test_base64
0:00:01 load avg: 8.58 [ 3/44] test_binascii
0:00:01 load avg: 8.58 [ 4/44] test_binop
0:00:01 load avg: 8.58 [ 5/44] test_bisect
0:00:01 load avg: 8.58 [ 6/44] test_bytes
0:00:07 load avg: 8.13 [ 7/44] test_bz2
0:00:08 load avg: 7.88 [ 8/44] test_cmath
0:00:08 load avg: 7.88 [ 9/44] test_codecs
0:00:10 load avg: 7.88 [10/44] test_collections
0:00:12 load avg: 7.88 [11/44] test_complex
0:00:12 load avg: 7.88 [12/44] test_dataclasses
0:00:13 load avg: 7.57 [13/44] test_datetime
0:00:19 load avg: 7.04 [14/44] test_decimal
0:00:24 load avg: 6.56 [15/44] test_difflib
0:00:25 load avg: 6.56 [16/44] test_embed
0:00:31 load avg: 6.11 [17/44] test_float
0:00:31 load avg: 6.11 [18/44] test_fstring
0:00:33 load avg: 6.10 [19/44] test_functools
0:00:35 load avg: 6.10 [20/44] test_generators
0:00:37 load avg: 6.10 [21/44] test_hashlib
0:00:38 load avg: 6.10 [22/44] test_heapq
0:00:39 load avg: 5.77 [23/44] test_int
0:00:40 load avg: 5.77 [24/44] test_itertools
0:00:48 load avg: 5.04 [25/44] test_json
0:00:54 load avg: 4.80 [26/44] test_long
0:00:59 load avg: 4.65 [27/44] test_lzma
0:01:00 load avg: 4.65 [28/44] test_math
0:01:06 load avg: 4.84 [29/44] test_memoryview
0:01:08 load avg: 4.77 [30/44] test_operator
0:01:08 load avg: 4.77 [31/44] test_ordered_dict
test test_ordered_dict failed
0:01:12 load avg: 4.77 [32/44] test_patma -- test_ordered_dict failed (4 failures)
0:01:12 load avg: 4.77 [33/44] test_pickle
0:01:21 load avg: 4.50 [34/44] test_pprint
0:01:22 load avg: 4.50 [35/44] test_re
0:01:23 load avg: 4.38 [36/44] test_set
0:01:33 load avg: 3.94 [37/44] test_sqlite3
0:01:34 load avg: 3.94 [38/44] test_statistics -- test_sqlite3 skipped
0:01:48 load avg: 3.58 [39/44] test_str
0:01:57 load avg: 3.53 [40/44] test_struct
test test_struct failed
0:02:01 load avg: 3.57 [41/44] test_tabnanny -- test_struct failed (1 failure)
0:02:05 load avg: 3.36 [42/44] test_time
0:02:09 load avg: 3.33 [43/44] test_xml_etree
0:02:20 load avg: 3.21 [44/44] test_xml_etree_c

Total duration: 2 min 29 sec
Total tests: run=8,756 failures=5 skipped=187
Total test files: run=44/44 failed=2 skipped=1
Result: FAILURE
```

Interestingly, the tests pass when run individually:

```
$ ./python -m test --pgo test_ordered_dict
Using random seed: 1047184953
0:00:00 load avg: 2.98 Run 1 test sequentially
0:00:00 load avg: 2.98 [1/1] test_ordered_dict

Total duration: 769 ms
Total tests: run=283
Total test files: run=1/1
Result: SUCCESS

$ ./python -m test --pgo test_struct
Using random seed: 2588757208
0:00:00 load avg: 2.98 Run 1 test sequentially
0:00:00 load avg: 2.98 [1/1] test_struct

Total duration: 567 ms
Total tests: run=39
Total test files: run=1/1
Result: SUCCESS
```

But not when all of them run:

```
$ ./python -m test --pgo 
Using random seed: 3047572841
0:00:00 load avg: 2.98 Run 44 tests sequentially
0:00:00 load avg: 2.98 [ 1/44] test_array
0:00:00 load avg: 2.98 [ 2/44] test_base64
0:00:01 load avg: 2.98 [ 3/44] test_binascii
0:00:01 load avg: 2.98 [ 4/44] test_binop
0:00:01 load avg: 2.98 [ 5/44] test_bisect
0:00:01 load avg: 2.98 [ 6/44] test_bytes
0:00:05 load avg: 2.98 [ 7/44] test_bz2
0:00:06 load avg: 2.98 [ 8/44] test_cmath
0:00:06 load avg: 2.98 [ 9/44] test_codecs
0:00:08 load avg: 2.82 [10/44] test_collections
0:00:10 load avg: 2.82 [11/44] test_complex
0:00:10 load avg: 2.82 [12/44] test_dataclasses
0:00:11 load avg: 2.82 [13/44] test_datetime
0:00:16 load avg: 3.16 [14/44] test_decimal
0:00:21 load avg: 3.14 [15/44] test_difflib
0:00:22 load avg: 3.14 [16/44] test_embed
0:00:33 load avg: 3.19 [17/44] test_float
0:00:34 load avg: 3.19 [18/44] test_fstring
0:00:36 load avg: 3.19 [19/44] test_functools
0:00:38 load avg: 3.18 [20/44] test_generators
0:00:39 load avg: 3.18 [21/44] test_hashlib
0:00:40 load avg: 3.18 [22/44] test_heapq
0:00:42 load avg: 3.18 [23/44] test_int
0:00:44 load avg: 3.24 [24/44] test_itertools
0:00:54 load avg: 3.28 [25/44] test_json
0:00:59 load avg: 3.34 [26/44] test_long
0:01:03 load avg: 3.39 [27/44] test_lzma
0:01:03 load avg: 3.39 [28/44] test_math
0:01:07 load avg: 3.39 [29/44] test_memoryview
0:01:08 load avg: 3.36 [30/44] test_operator
0:01:09 load avg: 3.36 [31/44] test_ordered_dict
test test_ordered_dict failed
0:01:12 load avg: 3.25 [32/44] test_patma -- test_ordered_dict failed (4 failures)
0:01:13 load avg: 3.25 [33/44] test_pickle
0:01:21 load avg: 3.23 [34/44] test_pprint
0:01:21 load avg: 3.23 [35/44] test_re
0:01:23 load avg: 3.45 [36/44] test_set
0:01:33 load avg: 3.15 [37/44] test_sqlite3
0:01:35 load avg: 3.15 [38/44] test_statistics -- test_sqlite3 skipped
0:02:00 load avg: 4.33 [39/44] test_str
0:02:07 load avg: 4.30 [40/44] test_struct
test test_struct failed
0:02:10 load avg: 4.28 [41/44] test_tabnanny -- test_struct failed (1 failure)
0:02:12 load avg: 4.10 [42/44] test_time
0:02:16 load avg: 4.10 [43/44] test_xml_etree
0:02:23 load avg: 3.93 [44/44] test_xml_etree_c

Total duration: 2 min 33 sec
Total tests: run=8,756 failures=5 skipped=187
Total test files: run=44/44 failed=2 skipped=1
Result: FAILURE
```

I don't know what the failure is, as using `-v` is not possible:

```
$ ./python -m test --pgo -v
usage: python -m test [options] [test_name1 [test_name2 ...]]
python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
regrtest.py: error: --pgo/-v don't go together!
Pass -h or --help for complete help.
```

I can however run the pgo tests manually like this:

```
$ ./python -m test -W test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_patma test_pickle test_pprint test_re test_set test_sqlite3 test_statistics test_str test_struct test_tabnanny test_time test_xml_etree test_xml_etree_c 
Using random seed: 2816723097
0:00:00 load avg: 2.57 Run 44 tests sequentially
0:00:00 load avg: 2.57 [ 1/44] test_array
0:00:02 load avg: 2.57 [ 2/44] test_base64
0:00:02 load avg: 2.57 [ 3/44] test_binascii
0:00:02 load avg: 2.57 [ 4/44] test_binop
0:00:02 load avg: 2.57 [ 5/44] test_bisect
0:00:02 load avg: 2.57 [ 6/44] test_bytes
0:00:07 load avg: 2.44 [ 7/44] test_bz2
0:00:08 load avg: 2.41 [ 8/44] test_cmath
0:00:08 load avg: 2.41 [ 9/44] test_codecs
0:00:10 load avg: 2.41 [10/44] test_collections
0:00:12 load avg: 2.41 [11/44] test_complex
0:00:12 load avg: 2.41 [12/44] test_dataclasses
0:00:13 load avg: 2.93 [13/44] test_datetime
0:00:19 load avg: 3.18 [14/44] test_decimal
0:00:24 load avg: 3.25 [15/44] test_difflib
0:00:26 load avg: 3.25 [16/44] test_embed
0:00:33 load avg: 3.37 [17/44] test_float
0:00:33 load avg: 3.37 [18/44] test_fstring
0:00:34 load avg: 3.37 [19/44] test_functools
0:00:36 load avg: 3.37 [20/44] test_generators
0:00:36 load avg: 3.37 [21/44] test_hashlib
0:00:37 load avg: 3.37 [22/44] test_heapq
0:00:38 load avg: 3.26 [23/44] test_int
0:00:39 load avg: 3.26 [24/44] test_itertools
0:00:49 load avg: 3.54 [25/44] test_json
0:00:58 load avg: 3.68 [26/44] test_long
0:01:05 load avg: 3.78 [27/44] test_lzma
0:01:06 load avg: 3.78 [28/44] test_math
0:01:14 load avg: 3.97 [29/44] test_memoryview
0:01:16 load avg: 3.97 [30/44] test_operator
0:01:17 load avg: 3.97 [31/44] test_ordered_dict
test_abc (test.test_ordered_dict.CPytho
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/118846">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>