bpo-31877: Add _Py_LegacyLocaleDetected and _PyCoerceLegacyLocale to pylifecycle.h (GH-4134)
Only declaring these as interns inside the CLI's main C module
caused build problems on some platforms (notably Cygwin), so
this switches them to a regular underscore prefixed "private" C
API declaration.
diff --git a/Programs/python.c b/Programs/python.c
index 03f8295..4f6b919 100644
--- a/Programs/python.c
+++ b/Programs/python.c
@@ -15,20 +15,6 @@
}
#else
-/* Access private pylifecycle helper API to better handle the legacy C locale
- *
- * The legacy C locale assumes ASCII as the default text encoding, which
- * causes problems not only for the CPython runtime, but also other
- * components like GNU readline.
- *
- * Accordingly, when the CLI detects it, it attempts to coerce it to a
- * more capable UTF-8 based alternative.
- *
- * See the documentation of the PYTHONCOERCECLOCALE setting for more details.
- *
- */
-extern int _Py_LegacyLocaleDetected(void);
-extern void _Py_CoerceLegacyLocale(void);
int
main(int argc, char **argv)
@@ -78,6 +64,16 @@
setlocale(LC_ALL, "");
#endif
+ /* The legacy C locale assumes ASCII as the default text encoding, which
+ * causes problems not only for the CPython runtime, but also other
+ * components like GNU readline.
+ *
+ * Accordingly, when the CLI detects it, it attempts to coerce it to a
+ * more capable UTF-8 based alternative.
+ *
+ * See the documentation of the PYTHONCOERCECLOCALE setting for more
+ * details.
+ */
if (_Py_LegacyLocaleDetected()) {
_Py_CoerceLegacyLocale();
}