https://github.com/python/cpython/commit/315ed1669a200c0d6f74c78b65cc2a7d21cede0d
commit: 315ed1669a200c0d6f74c78b65cc2a7d21cede0d
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-09-22T07:28:48+02:00
summary:

gh-157695: Rename HAVE_ICONV to _Py_HAVE_ICONV (#157821)

Update check_capi_macros_ignored.txt.

files:
M Include/internal/pycore_unicodeobject.h
M Modules/_codecsmodule.c
M Modules/clinic/_codecsmodule.c.h
M Objects/unicodeobject.c
M Tools/build/check_capi_macros_ignored.txt
M configure
M configure.ac
M pyconfig.h.in

diff --git a/Include/internal/pycore_unicodeobject.h 
b/Include/internal/pycore_unicodeobject.h
index ff3fda8583133e..c091aa94371a75 100644
--- a/Include/internal/pycore_unicodeobject.h
+++ b/Include/internal/pycore_unicodeobject.h
@@ -244,7 +244,7 @@ extern int _PyUnicodeWriter_FormatV(
 
 /* --- iconv Codec -------------------------------------------------------- */
 
-#ifdef HAVE_ICONV
+#ifdef _Py_HAVE_ICONV
 extern PyObject* _PyUnicode_DecodeIconv(
     const char *encoding,       /* iconv encoding name */
     const char *string,         /* encoded string */
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index 7cba234fc80b59..dd0ace58cf42fd 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -642,7 +642,7 @@ _codecs_code_page_decode_impl(PyObject *module, int 
codepage,
 
 #endif /* MS_WINDOWS */
 
-#ifdef HAVE_ICONV
+#ifdef _Py_HAVE_ICONV
 
 /*[clinic input]
 _codecs.iconv_decode
@@ -665,7 +665,7 @@ _codecs_iconv_decode_impl(PyObject *module, const char 
*encoding,
     return codec_tuple(decoded, consumed);
 }
 
-#endif /* HAVE_ICONV */
+#endif /* _Py_HAVE_ICONV */
 
 /* --- Encoder ------------------------------------------------------------ */
 
@@ -977,7 +977,7 @@ _codecs_code_page_encode_impl(PyObject *module, int 
code_page, PyObject *str,
 
 #endif /* MS_WINDOWS */
 
-#ifdef HAVE_ICONV
+#ifdef _Py_HAVE_ICONV
 
 /*[clinic input]
 _codecs.iconv_encode
@@ -996,7 +996,7 @@ _codecs_iconv_encode_impl(PyObject *module, const char 
*encoding,
                        PyUnicode_GET_LENGTH(str));
 }
 
-#endif /* HAVE_ICONV */
+#endif /* _Py_HAVE_ICONV */
 
 /* --- Error handler registry --------------------------------------------- */
 
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
index 788b9b706c8fbb..5ca9614f7f3216 100644
--- a/Modules/clinic/_codecsmodule.c.h
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -1629,7 +1629,7 @@ _codecs_code_page_decode(PyObject *module, PyObject 
*const *args, Py_ssize_t nar
 
 #endif /* defined(MS_WINDOWS) */
 
-#if defined(HAVE_ICONV)
+#if defined(_Py_HAVE_ICONV)
 
 PyDoc_STRVAR(_codecs_iconv_decode__doc__,
 "iconv_decode($module, encoding, data, errors=None, final=False, /)\n"
@@ -1711,7 +1711,7 @@ _codecs_iconv_decode(PyObject *module, PyObject *const 
*args, Py_ssize_t nargs)
     return return_value;
 }
 
-#endif /* defined(HAVE_ICONV) */
+#endif /* defined(_Py_HAVE_ICONV) */
 
 PyDoc_STRVAR(_codecs_readbuffer_encode__doc__,
 "readbuffer_encode($module, data, errors=None, /)\n"
@@ -2727,7 +2727,7 @@ _codecs_code_page_encode(PyObject *module, PyObject 
*const *args, Py_ssize_t nar
 
 #endif /* defined(MS_WINDOWS) */
 
-#if defined(HAVE_ICONV)
+#if defined(_Py_HAVE_ICONV)
 
 PyDoc_STRVAR(_codecs_iconv_encode__doc__,
 "iconv_encode($module, encoding, str, errors=None, /)\n"
@@ -2798,7 +2798,7 @@ _codecs_iconv_encode(PyObject *module, PyObject *const 
*args, Py_ssize_t nargs)
     return return_value;
 }
 
-#endif /* defined(HAVE_ICONV) */
+#endif /* defined(_Py_HAVE_ICONV) */
 
 PyDoc_STRVAR(_codecs_register_error__doc__,
 "register_error($module, errors, handler, /)\n"
@@ -3033,4 +3033,4 @@ _codecs__normalize_encoding(PyObject *module, PyObject 
*const *args, Py_ssize_t
 #ifndef _CODECS_ICONV_ENCODE_METHODDEF
     #define _CODECS_ICONV_ENCODE_METHODDEF
 #endif /* !defined(_CODECS_ICONV_ENCODE_METHODDEF) */
-/*[clinic end generated code: output=912e04020d6a6144 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d6e155d435335482 input=a9049054013a1b77]*/
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index da9f8dcc223fc0..77de3f735cc42a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -67,7 +67,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 
SOFTWARE.
 #include <windows.h>
 #endif
 
-#ifdef HAVE_ICONV
+#ifdef _Py_HAVE_ICONV
 #include <iconv.h>                 // iconv_open()
 #endif
 
@@ -8220,7 +8220,7 @@ PyUnicode_AsMBCSString(PyObject *unicode)
 
 /* --- iconv Codec -------------------------------------------------------- */
 
-#ifdef HAVE_ICONV
+#ifdef _Py_HAVE_ICONV
 
 /* iconv pivot: native-endian UTF-32, a raw array of Py_UCS4.  One input unit 
is
    one code point, so error handlers get the exact position.  A platform whose
@@ -8602,7 +8602,7 @@ _PyUnicode_EncodeIconv(const char *encoding, PyObject 
*unicode,
     return result;
 }
 
-#endif /* HAVE_ICONV */
+#endif /* _Py_HAVE_ICONV */
 
 /* --- Character Mapping Codec -------------------------------------------- */
 
diff --git a/Tools/build/check_capi_macros_ignored.txt 
b/Tools/build/check_capi_macros_ignored.txt
index 406535e54664e8..fde90882d7dcf4 100644
--- a/Tools/build/check_capi_macros_ignored.txt
+++ b/Tools/build/check_capi_macros_ignored.txt
@@ -298,7 +298,6 @@ HAVE_GRANTPT
 HAVE_GRP_H
 HAVE_HSTRERROR
 HAVE_HTOLE64
-HAVE_ICONV
 HAVE_ICONV_H
 HAVE_IF_INDEXTONAME
 HAVE_IF_NAMEINDEX
diff --git a/configure b/configure
index 809885af1cd20d..503afe8c2d6779 100755
--- a/configure
+++ b/configure
@@ -14913,7 +14913,7 @@ fi
 printf "%s\n" "$ac_cv_have_iconv" >&6; }
   if test "$ac_cv_have_iconv" != no; then
 
-printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h
+printf "%s\n" "#define _Py_HAVE_ICONV 1" >>confdefs.h
 
     if test "$ac_cv_have_iconv" = -liconv; then
       LIBS="-liconv $LIBS"
diff --git a/configure.ac b/configure.ac
index 8e5377a8f0ac75..abf867c152f1a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3986,7 +3986,7 @@ if test "$py_have_iconv" = yes; then
     ])
   ])
   if test "$ac_cv_have_iconv" != no; then
-    AC_DEFINE([HAVE_ICONV], [1],
+    AC_DEFINE([_Py_HAVE_ICONV], [1],
               [Define if you have a working iconv() function.])
     if test "$ac_cv_have_iconv" = -liconv; then
       LIBS="-liconv $LIBS"
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 2bf45a290a4ed1..b85932b5848586 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -742,9 +742,6 @@
 /* Define this if you have le64toh() */
 #undef HAVE_HTOLE64
 
-/* Define if you have a working iconv() function. */
-#undef HAVE_ICONV
-
 /* Define to 1 if you have the <iconv.h> header file. */
 #undef HAVE_ICONV_H
 
@@ -2210,6 +2207,9 @@
 /* Defined if _Float16 C type is supported */
 #undef _Py_HAVE_FLOAT16
 
+/* Define if you have a working iconv() function. */
+#undef _Py_HAVE_ICONV
+
 /* Define to 1 if libgcc __register_frame and __deregister_frame are linkable.
    */
 #undef _Py_HAVE_LIBGCC_EH_FRAME_REGISTRATION

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to