[Python-checkins] cpython: #15965: Explicitly cast AT_FDCWD as (int).
trent.nelson
python-checkins at python.org
Wed Sep 19 03:50:28 CEST 2012
http://hg.python.org/cpython/rev/974a4cae6094
changeset: 79047:974a4cae6094
user: Trent Nelson <trent at trent.me>
date: Tue Sep 18 21:50:06 2012 -0400
summary:
#15965: Explicitly cast AT_FDCWD as (int).
Required on Solaris 10 (which defines AT_FDCWD as 0xffd19553),
harmless on other platforms.
files:
Misc/NEWS | 3 +++
Modules/posixmodule.c | 9 ++++++++-
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
Core and Builtins
-----------------
+- Issue #15965: Explicitly cast AT_FDCWD as (int). Required on Solaris 10
+ (which defines AT_FDCWD as 0xffd19553), harmless on other platforms.
+
- Issue #15926: Fix crash after multiple reinitializations of the interpreter.
- Issue #15895: Fix FILE pointer leak in one error branch of
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -414,7 +414,14 @@
#ifdef AT_FDCWD
-#define DEFAULT_DIR_FD AT_FDCWD
+/*
+ * Why the (int) cast? Solaris 10 defines AT_FDCWD as 0xffd19553 (-3041965);
+ * without the int cast, the value gets interpreted as uint (4291925331),
+ * which doesn't play nicely with all the initializer lines in this file that
+ * look like this:
+ * int dir_fd = DEFAULT_DIR_FD;
+ */
+#define DEFAULT_DIR_FD (int)AT_FDCWD
#else
#define DEFAULT_DIR_FD (-100)
#endif
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list