Skip to content

Remove obsolete and unused configure macros - #159513

Merged
methane merged 5 commits into
python:mainfrom
methane:codex/remove-deadcode
Oct 25, 2026
Merged

methane merged 5 commits into
python:mainfrom
methane:codex/remove-deadcode

Conversation

@methane

@methane methane commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Remove obsolete platform workarounds and configuration checks whose results are no longer used:

  • Remaining IRIX workarounds: Remove IRIX-specific declarations, header handling, and macros from socket, select, termios, curses, posix, and integer-conversion code. IRIX support was removed in Python 3.7.
  • Checks left behind by removed modules: Remove checks for shadow.h, getspent(), getspnam(), linux/soundcard.h, sys/soundcard.h, and sys/audioio.h. Their consumers were the removed spwd, ossaudiodev, and sunaudiodev modules.
  • Checks left behind by bundled libmpdec: Remove the glibc _FORTIFY_SOURCE/memmove bug check, GCC ipa-pure-const bug check, and x64 inline-assembler check. Their consumers were removed with bundled libmpdec in 9eb3b14. Also remove the -O2 availability check used only by the glibc bug check.
  • Unused function checks: Remove checks for ftime(), getwd(), tempnam(), tmpnam(), tmpnam_r(), sigrelse(), fseek64(), and ftell64(). Neither their configuration macros nor their cached results have remaining consumers.
  • Pre-ANSI compiler checks: Remove checks for working const, signed char, and function prototypes, along with their compatibility macros. These features are guaranteed by CPython’s C11 requirement.
  • Obsolete MSVC version conditions: Remove conditions for compiler versions older than the supported minimum, retaining the current implementations and non-MSVC alternatives. This covers Windows configuration, socket headers, secure CRT handling, and invalid-parameter handlers.
  • Legacy BSD workarounds: Remove _XOPEN_SOURCE exceptions for OpenBSD 2.x–4.6 and NetBSD 1.5–1.6-era releases, and the pre-December-1997 NetBSD dynamic-loader workaround.
  • Regenerate configure and pyconfig.h.in with Autoconf 2.72, and update the C API macro allowlist and platform headers accordingly.

@methane methane changed the title Remove obsolete IRIX workarounds and unused configure checks Remove obsolete and unused configure macros Oct 16, 2026
@methane
methane requested a balanced review from Copilot October 24, 2026 11:49
@methane methane added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 24, 2026
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @methane for commit 87fd74b 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F159513%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The removed checks have no remaining active consumers, and the compatibility cleanup preserves supported compiler and platform behavior.

No open issues 🎉

What changed in this PR

This PR simplifies CPython’s build configuration and portability code by removing unused feature checks and workarounds for unsupported platforms and compilers.

Changes:

  • Remove configuration checks left behind by deleted modules, bundled libmpdec, and pre-ANSI compilers.
  • Remove obsolete IRIX and BSD workarounds and simplify MSVC conditions while preserving supported paths.
  • Synchronize generated configuration files, platform headers, and the C API macro allowlist.
File Description
Tools/​build/​check_capi_macros_ignored.txt Remove obsolete macros from the allowlist.
Python/​pylifecycle.c Simplify the secure CRT signal-handling condition.
Python/​mystrtoul.c Remove an IRIX-specific macro definition.
Python/​dynload_shlib.c Remove the legacy NetBSD loader workaround.
pyconfig.h.in Remove templates for deleted configuration checks.
PC/​pyconfig.h Remove unused macros and obsolete MSVC branches.
PC/​invalid_parameter_handler.c Remove the old MSVC guard and correct the header reference in a comment.
Modules/​timemodule.c Simplify secure CRT conditions and clarify a comment.
Modules/​termios.c Remove the IRIX control-character workaround.
Modules/​socketmodule.c Remove IRIX workarounds and simplify MSVC header handling.
Modules/​selectmodule.c Remove the IRIX-specific bzero declaration.
Modules/​posixmodule.c Remove the IRIX-specific ctermid_r declaration.
Modules/​_cursesmodule.c Remove IRIX-specific header and compatibility handling.
Include/​pyport.h Remove an IRIX-specific macro definition.
Include/​pymacconfig.h Remove the unused x64 assembler configuration macro.
Include/​internal/​pycore_fileutils.h Simplify the MSVC invalid-parameter suppression condition.
configure.ac Remove obsolete platform exceptions and unused checks.
configure Reflect the configuration-check removals in generated output.

Review effort: Balanced

Comment thread Modules/socketmodule.c Outdated
Comment thread Python/dynload_shlib.c
Comment on lines -14 to -22
#if defined(__NetBSD__)
#include <sys/param.h>
#if (NetBSD < 199712)
#include <nlist.h>
#include <link.h>
#define dlerror() "error in dynamic linking"
#endif
#endif /* NetBSD */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can probably leave this in? I presume people are still using Python on NetBSD and it is actively getting releases.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The NetBSD < 199712 workaround targets ancient NetBSD versions and is no longer needed. <sys/param.h> is included only for the NetBSD macro, so the whole block can be removed.

@emmatyping emmatyping left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR, I love to see negative diffs! I had two tweaks to the changes but the rest LGTM.

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Comment thread Modules/socketmodule.c Outdated
@methane
methane enabled auto-merge (squash) October 25, 2026 05:09
@methane
methane merged commit b26fc41 into python:main Oct 25, 2026
54 checks passed
@methane
methane deleted the codex/remove-deadcode branch October 25, 2026 05:18
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