GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `v3.13.1` test `test_ctypes/test_dlerror.py` fails instead of skipping if `gcc` not in path · Issue #127626 · python/cpython

v3.13.1 test test_ctypes/test_dlerror.py fails instead of skipping if gcc not in path #127626

New issue
Copy link
New issue
Copy link
Closed
Closed
v3.13.1 test test_ctypes/test_dlerror.py fails instead of skipping if gcc not in path#127626
Copy link
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@fuhsnn
fuhsnn
opened on Dec 5, 2024
Issue body actions

Bug report

Bug description:

The test use the follow logic to detect presence of gcc,

cpython/Lib/test/test_ctypes/test_dlerror.py

Lines 64 to 68 in 6cf7794

retcode = subprocess.call(["gcc", "--version"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
if retcode != 0:
self.skipTest("gcc is missing")

which appears to not recover gracefully if gcc is not in path, causing the test_ctypes test failing with the follow message:

1.356 test_signedness (test.test_ctypes.test_wintypes.WinTypesTest.test_signedness) ... ok
1.356 test_variant_bool (test.test_ctypes.test_wintypes.WinTypesTest.test_variant_bool) ... ok
1.356 
1.356 ======================================================================
1.356 ERROR: test_null_dlsym (test.test_ctypes.test_dlerror.TestNullDlsym.test_null_dlsym)
1.356 ----------------------------------------------------------------------
1.356 Traceback (most recent call last):
1.356   File "/build/cpython/Lib/test/test_ctypes/test_dlerror.py", line 64, in test_null_dlsym
1.356     retcode = subprocess.call(["gcc", "--version"],
1.356                               stdout=subprocess.DEVNULL,
1.356                               stderr=subprocess.DEVNULL)
1.356   File "/build/cpython/Lib/subprocess.py", line 395, in call
1.356     with Popen(*popenargs, **kwargs) as p:
1.356          ~~~~~^^^^^^^^^^^^^^^^^^^^^^
1.356   File "/build/cpython/Lib/subprocess.py", line 1036, in __init__
1.356     self._execute_child(args, executable, preexec_fn, close_fds,
1.356     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.356                         pass_fds, cwd, env,
1.356                         ^^^^^^^^^^^^^^^^^^^
1.356     ...<5 lines>...
1.356                         gid, gids, uid, umask,
1.356                         ^^^^^^^^^^^^^^^^^^^^^^
1.356                         start_new_session, process_group)
1.356                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.356   File "/build/cpython/Lib/subprocess.py", line 1966, in _execute_child
1.356     raise child_exception_type(errno_num, err_msg, err_filename)
1.356 FileNotFoundError: [Errno 2] No such file or directory: 'gcc'
1.356 
1.356 ----------------------------------------------------------------------
1.356 Ran 507 tests in 0.717s
1.356 
1.356 FAILED (errors=1, skipped=33)
1.377 test test_ctypes failed
1.377 test_ctypes failed (1 error)
1.377 
1.377 == Tests result: FAILURE ==

To reproduce the above test failure, this is a Linux Dockerfile with only clang installed as $CC but no gcc in path:

FROM debian:12-slim
RUN apt-get update
RUN apt-get install -y --no-install-recommends git ca-certificates
RUN apt-get install -y --no-install-recommends make
RUN apt-get install -y --no-install-recommends clang
RUN apt-get install -y --no-install-recommends libffi-dev

WORKDIR /build/
RUN git clone --depth 1 https://github.com/python/cpython --branch v3.13.1 /build/cpython
WORKDIR /build/cpython/
RUN ./configure && make
RUN ./python -m test -v test_ctypes

Looking around, I found the adjacent test_ctypes/test_find.py used try/except OSError to wrap a similar check, I believe it could be an alternative.

cpython/Lib/test/test_ctypes/test_find.py

Lines 85 to 90 in 6cf7794

try:
p = subprocess.Popen(['gcc', '--version'], stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL)
out, _ = p.communicate()
except OSError:
raise unittest.SkipTest('gcc, needed for test, not available')

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Activity

  1. fuhsnn
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Dec 5, 2024
  2. picnixz
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Jun 14, 2025
  3. picnixz commented on Jun 14, 2025

    @picnixz
    picnixz
    on Jun 14, 2025
    Member
    More actions

    Itm was fixed in #129872 (it was also reported separately):

    cpython/Lib/test/test_ctypes/test_dlerror.py

    Lines 61 to 66 in 2e15a50

    try:
    retcode = subprocess.call(["gcc", "--version"],
    stdout=subprocess.DEVNULL,
    stderr=subprocess.DEVNULL)
    except OSError:
    self.skipTest("gcc is missing")

  4. picnixz
    closed this as completedon Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.