summaryrefslogtreecommitdiff
path: root/Programs
diff options
context:
space:
mode:
authorErik Bray <erik.m.bray@gmail.com>2017-10-27 11:46:03 +0200
committerNick Coghlan <ncoghlan@gmail.com>2017-10-27 19:46:03 +1000
commit031c4bfadb69feeda82ce886d6b0cadc638d2e1e (patch)
treebf96902f4e6b6de17f916c3763c2dcf8ce0391c0 /Programs
parent2f3d6993d7ca4a4d218e0d63b126c94bc00a03b8 (diff)
downloadcpython-git-031c4bfadb69feeda82ce886d6b0cadc638d2e1e.tar.gz
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.
Diffstat (limited to 'Programs')
-rw-r--r--Programs/python.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/Programs/python.c b/Programs/python.c
index 03f8295045..4f6b9198c8 100644
--- a/Programs/python.c
+++ b/Programs/python.c
@@ -15,20 +15,6 @@ wmain(int argc, wchar_t **argv)
}
#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 @@ main(int argc, char **argv)
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();
}