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

gh-119180: Use equality when comparing against annotationlib.Format #131755

Merged
merged 3 commits into from
Mar 28, 2025

Conversation

Viicos
Copy link
Contributor

@Viicos Viicos commented Mar 26, 2025

As per #119180 (comment).

We can probably skip news on this one.

@@ -2315,7 +2315,7 @@ def get_type_hints(obj, globalns=None, localns=None, include_extras=False,
hints = {}
for base in reversed(obj.__mro__):
ann = annotationlib.get_annotations(base, format=format)
if format is annotationlib.Format.STRING:
if format == annotationlib.Format.STRING:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add at least one test case affected by this? Would require passing Format.STRING.value to get_type_hints().

@JelleZijlstra
Copy link
Member

Your tests are failing

@JelleZijlstra JelleZijlstra merged commit af2afd7 into python:main Mar 28, 2025
38 checks passed
@Viicos Viicos deleted the 119180-equality branch March 28, 2025 06:17
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 Fedora Stable Refleaks 3.x (tier-2) has failed when building commit af2afd7.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/123/builds/863) and take a look at the build logs.
  4. Check if the failure is related to this commit (af2afd7) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/123/builds/863

Failed tests:

  • test_perf_profiler

Failed subtests:

  • test_python_calls_appear_in_the_stack_if_perf_activated - test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_appear_in_the_stack_if_perf_activated

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/Lib/test/test_perf_profiler.py", line 364, in test_python_calls_appear_in_the_stack_if_perf_activated
    self.assertIn(f"py::foo:{script}", stdout)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'py::foo:/tmp/test_python_sidxim9z/tmp_2sm18tt/perftest.py' not found in 'python 2686750 298395.703443:          1 cycles:Pu: \n\t    ffff981d7ac0 _start+0x0 (/usr/lib/ld-linux-aarch64.so.1)\n\npython 2686750 298395.703482:          1 cycles:Pu: \n\tffffaa282d37fc78 [unknown] ([unknown])\n\tffffaa282d38049c [unknown] ([unknown])\n\tffffaa282bf215e4 [unknown] ([unknown])\n\t    ffff981d7ac0 _start+0x0 (/usr/lib/ld-linux-aarch64.so.1)\n\npython 2686750 298395.704131:          1 cycles:Pu: \n\tffffaa282d37ff10 [unknown] ([unknown])\n\tffffaa282d3804cc [unknown] ([unknown])\n\tffffaa282bf215e4 [unknown] ([unknown])\n\t    ffff981d9628 __mmap64+0x28 (inlined)\n\t    ffff981d9628 mmap64+0x28 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff981c3abb _dl_map_segment+0xddb (inlined)\n\t    ffff981c3abb _dl_map_segments+0xddb (inlined)\n\t    ffff981c3abb _dl_map_object_from_fd+0xddb (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff981c4133 _dl_map_object+0x1e7 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff981bf5bf openaux+0x3f (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff981be303 _dl_catch_exception+0x63 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff981bfb33 _dl_map_object_deps+0x553 (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff981d519f dl_main+0x139f (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff981d25ff _dl_sysdep_start+0x1df (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff981d3b17 _dl_start_final+0x5ab (inlined)\n\t    ffff981d3b17 _dl_start+0x5ab (/usr/lib/ld-linux-aarch64.so.1)\n\t    ffff981d7ad3 _start+0x13 (/usr/lib/ld-linux-aarch64.so.1)\n\npython 2686750 298395.704210:        287 cycles:Pu: \n\tffffaa282d37ff
 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t    ffff98101e97 __new_exitfn_called+0x7 (/usr/lib64/libc.so.6)\n\t    ffff98101e97 __new_exitfn_called+0x7 (/usr/lib64/libc.so.6)\n\npython 2686750 298395.706253:      27137 cycles:Pu: \n\t    ffff97fe924c __memcpy_generic+0x10c (/usr/lib64/libc.so.6)\n\t          6446f7 init_builtin_modules_table+0x57 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          64886f _PyImport_Init+0x5b (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          66773b pycore_init_runtime+0xe3 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          66830b pyinit_config+0x2b (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          66fc4b pyinit_core+0xdb (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          66fd23 Py_InitializeFromConfig+0x97 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a0f03 pymain_init+0xff (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a0fd3 pymain_main+0xf (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a1067 Py_BytesMain+0x27 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          41f1b7 main+0xb (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t    ffff97f6625b __libc_start_call_main+0x7b (/usr/lib64/libc.so.6)\n\t    ffff97f6633b __libc_start_main@@GLIBC_2.34+0x9b (/usr/lib64/libc.so.6)\n\t          41f0af _start+0x2f (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\npython 2686750 298395.707023:     818168 cycles:Pu: \n\t    ffff97fdd548 malloc+0x1a8 (/usr/lib64/libc.so.6)\n\t          50729b _PyMem_RawMalloc+0x17 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          50696f _PyMem_DebugRawAlloc+0xbf (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          5069bf _PyMem_DebugRawMalloc+0x17 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          51d0bf PyMem_RawMalloc+0x23 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          64104f _Py_hashtable_set+0x33 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          55a30b intern_static+0x83 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          574257 _PyUnicode_InternStatic+0x27 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          57d76f _PyUnicode_InitStaticStrings+0x94bb (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          58ca9f init_global_interned_strings+0x77 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          58ccd7 _PyUnicode_InitGlobalObjects+0x5b (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          667b2b pycore_init_global_objects+0x23 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6680b3 pycore_interp_init+0x2b (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          66838f pyinit_config+0xaf (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          66fc4b pyinit_core+0xdb (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          66fd23 Py_InitializeFromConfig+0x97 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a0f03 pymain_init+0xff (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a0fd3 pymain_main+0xf (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-a


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/Lib/test/test_perf_profiler.py", line 366, in test_python_calls_appear_in_the_stack_if_perf_activated
    self.assertIn(f"py::baz:{script}", stdout)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'py::baz:/tmp/test_python_o393cvdf/tmppc60_iub/perftest.py' not found in 'python 2631589 297706.582196:          1 cycles:Pu: \n\t    ffff98e39ac0 _start+0x0 (/usr/lib/ld-linux-aarch64.so.1)\n\npython 2631589 297706.582225:          1 cycles:Pu: \n\tffffaa282d37fc78 [unknown] ([unknown])\n\tffffaa282d38049c [unknown] ([unknown])\n\tffffaa282bf215e4 [unknown] ([unknown])\n\t    ffff98e39ac0 _start+0x0 (/usr/lib/ld-linux-aarch64.so.1)\n\npython 2631589 297706.583101:          1 cycles:Pu: \n\tffffaa282d37f654 [unknown] ([unknown])\n\tffffaa282d380484 [unknown] ([unknown])\n\tffffaa282bf215e4 [unknown] ([unknown])\n\t    ffff98bd1848 _nl_load_locale_from_archive+0x3a8 (/usr/lib64/libc.so.6)\n\t    ffff98bd0c7f _nl_find_locale+0xff (/usr/lib64/libc.so.6)\n\t    ffff98bd344f setlocale+0x3cf (/usr/lib64/libc.so.6)\n\t          66f6f3 _Py_SetLocaleFromEnv+0x17 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6669df _PyPreConfig_Read+0x15f (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          66f97b _Py_PreInitializeFromPyArgv+0x103 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a0e5b pymain_init+0x57 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a0fd3 pymain_main+0xf (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a1067 Py_BytesMain+0x27 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          41f1b7 main+0xb (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t    ffff98bc625b __libc_start_call_main+0x7b (/usr/lib64/libc.so.6)\n\t    ffff98bc633b __libc_start_main@@GLIBC_2.34+0x9b (/usr/lib64/libc.so.6)\n\t          41f0af _start+0x2f (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\npython 2631589 297706.583131:        317 cycles:Pu: \n\t    ffff98bd184c _nl_load_locale_from_archive+0x3ac (/usr/lib64/libc.so.6)\n\t    ffff98bd0c7f _nl_find_locale+0xff (/usr/lib64/libc.so.6)\n\t    ffff98bd344f setlocale+0x3cf (/usr/lib64/libc.so.6)\n\t          66f6f3 _Py_SetLocaleFromEnv+0x17 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6669df _PyPreConfig_Read+0x15f (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          66f97b _Py_PreInitializeFromPyArgv+0x103 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a0e5b pymain_init+0x57 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a0fd3 pymain_main+0xf (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          6a1067 Py_BytesMain+0x27 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          41f1b7 main+0xb (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t    ffff98bc625b __libc_start_call_main+0x7b (/usr/lib64/libc.so.6)\n\t    ffff98bc633b __libc_start_main@@GLIBC_2.34+0x9b (/usr/lib64/libc.so.6)\n\t          41f0af _start+0x2f (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\npython 2631589 297706.584084:        734 cycles:Pu: \n\t          5586d8 _PyUnicode_CheckConsistency+0x0 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          55a2ab intern_static+0x23 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          574257 _PyUnicode_InternStatic+0x27 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          57f443 _PyUnicode_InitStaticStrings+0xb18f (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          58ca9f init_global_interned_strings+0x77 (/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/python)\n\t          58ccd7 _Py

diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants