python / python/cpython

test_ctypes.test_find seems to pass when it shouldn't

オープン
#151,089 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

tests topic-ctypes type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

報告された Linux 環境でまず python3 -mtest -v test_ctypes.test_find を実行し、test_ctypes.test_find.FindLibraryLinux.test_find_library_with_gcc に焦点を当ててください。このテストが gcc なしで ok を報告する理由を確認し、その結果がコンパイラーの可用性を正しく反映していること、および対象のテストが意図した動作で成功することを検証してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
linux, python
領域
operating-systems, testing-qa
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。