python / python/cpython

test_ctypes.test_find seems to pass when it shouldn't

Ouverte
#151,089 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

tests topic-ctypes type-bug
Langage dominant
Python
Étoiles
77.2k
Forks
35.9k
Métriques de merge des PR
Métriques de PR en attente

Description

Bug report

Bug description:

I have a container that has no compiler but does have ld:

$ gcc --version
-sh: gcc: command not found
$ ld --version
GNU ld (GNU Binutils) 2.46

If I run the test_ctypes tests, specifically test_find_library_with_gcc which looks like it will need gcc, it surprisingly passes:

$ python3 -mtest -v test_ctypes.test_find
== CPython 3.14.5 (main, May 10 2026, 10:21:34) [GCC 16.1.0]
== Linux-6.18.33-yocto-standard-aarch64-with-glibc2.43 little-endian
== Python build: release shared
== cwd: /tmp/test_python_worker_332æ
== CPU count: 4
== encodings: locale=ANSI_X3.4-1968 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests

test_find (test.test_ctypes.test_find.FindLibraryAndroid.test_find) ... skipped 'Test only valid for Android'
test_find_nothing_with_wrong_ld_library_path (test.test_ctypes.test_find.FindLibraryEmscripten.test_find_nothing_with_wrong_ld_library_path) ... skipped 'Test only valid for Emscripten'
test_find_nothing_without_ld_library_path (test.test_ctypes.test_find.FindLibraryEmscripten.test_find_nothing_without_ld_library_path) ... skipped 'Test only valid for Emscripten'
test_find_wasm_file_with_so_extension (test.test_ctypes.test_find.FindLibraryEmscripten.test_find_wasm_file_with_so_extension) ... skipped 'Test only valid for Emscripten'
test_find_wasm_file_with_wasm_extension (test.test_ctypes.test_find.FindLibraryEmscripten.test_find_wasm_file_with_wasm_extension) ... skipped 'Test only valid for Emscripten'
test_ignore_non_wasm_file (test.test_ctypes.test_find.FindLibraryEmscripten.test_ignore_non_wasm_file) ... skipped 'Test only valid for Emscripten'
test_find_library_with_gcc (test.test_ctypes.test_find.FindLibraryLinux.test_find_library_with_gcc) ... ok
test_find_library_with_ld (test.test_ctypes.test_find.FindLibraryLinux.test_find_library_with_ld) ... ok
test_find_on_libpath (test.test_ctypes.test_find.FindLibraryLinux.test_find_on_libpath) ... skipped 'gcc, needed for test, not available'
test_gh114257 (test.test_ctypes.test_find.FindLibraryLinux.test_gh114257) ... ok
OpenGL libraries:
	 ('GL', None)
	 ('GLU', None)
	 ('gle', None)
test_gl (test.test_ctypes.test_find.Test_OpenGL_libs.test_gl) ... skipped 'lib_gl not available'
test_gle (test.test_ctypes.test_find.Test_OpenGL_libs.test_gle) ... skipped 'lib_gle not available'
test_glu (test.test_ctypes.test_find.Test_OpenGL_libs.test_glu) ... skipped 'lib_glu not available'
test_shell_injection (test.test_ctypes.test_find.Test_OpenGL_libs.test_shell_injection) ... ok

Specifically:

test_find_library_with_gcc (test.test_ctypes.test_find.FindLibraryLinux.test_find_library_with_gcc) ... ok
CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs
  • gh-151231

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par exécuter python3 -mtest -v test_ctypes.test_find dans l’environnement Linux indiqué et concentrez-vous sur test_ctypes.test_find.FindLibraryLinux.test_find_library_with_gcc. Vérifiez pourquoi ce test signale ok sans gcc, puis vérifiez que son résultat reflète correctement la disponibilité du compilateur et que le test ciblé réussit avec le comportement attendu.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
linux, python
Domaine
operating-systems, testing-qa
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.