Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Python 2.5: Undefine _POSIX_C_SOURCE on Lion to fix 8-byte strings from socket.inet_aton() #80

Merged
merged 1 commit into from

2 participants

@saj
saj commented

socket.inet_aton() in Python 2.5.6 was returning 8-byte strings when built with Pythonbrew on OS X 10.7.3. The 8-byte strings were a result of a broken type cast identified in:

Part of the problem was that autoconf was failing to pick up on C lib's inet_aton(), exposing the broken type cast mentioned in the bug reports above. I found an existing precedence for suppressing _POSIX_C_SOURCE on older Darwins, which, when extended to cover 10.7.3, magically makes this bug go away.

@saj saj Undefine _POSIX_C_SOURCE to fix socket.inet_aton()
socket.inet_aton() in Python 2.5.6 was returning 8-byte strings when
built with Pythonbrew on OS X 10.7.3.  The 8-byte strings were a result
of a broken type cast identified in:

- http://bugs.python.org/issue767150
- http://bugs.python.org/issue1008086

Part of the problem was that autoconf was failing to pick up on C lib's
inet_aton(), exposing the broken type cast mentioned in the bug reports
above.  I found an existing precedence for suppressing _POSIX_C_SOURCE
on older Darwins, which, when extended to cover 10.7.3, magically makes
this bug go away.
2c17fd4
@utahta utahta merged commit 2c17fd4 into utahta:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 8, 2012
  1. @saj

    Undefine _POSIX_C_SOURCE to fix socket.inet_aton()

    saj authored
    socket.inet_aton() in Python 2.5.6 was returning 8-byte strings when
    built with Pythonbrew on OS X 10.7.3.  The 8-byte strings were a result
    of a broken type cast identified in:
    
    - http://bugs.python.org/issue767150
    - http://bugs.python.org/issue1008086
    
    Part of the problem was that autoconf was failing to pick up on C lib's
    inet_aton(), exposing the broken type cast mentioned in the bug reports
    above.  I found an existing precedence for suppressing _POSIX_C_SOURCE
    on older Darwins, which, when extended to cover 10.7.3, magically makes
    this bug go away.
This page is out of date. Refresh to see the latest.
View
1  pythonbrew/installer/pythoninstaller.py
@@ -308,6 +308,7 @@ def patch(self):
'patch-setup.py.diff',
'patch-configure-badcflags.diff',
'patch-configure-arch_only.diff',
+ 'patch-configure-no-posix-c-source.diff',
'patch-64bit.diff',
'patch-pyconfig.h.in.diff',
'patch-gestaltmodule.c.diff',
View
23 pythonbrew/patches/macosx/python25/patch-configure-no-posix-c-source.diff
@@ -0,0 +1,23 @@
+--- configure.in~ 2008-12-14 01:13:52.000000000 +1100
++++ configure.in 2012-05-08 14:32:09.000000000 +1000
+@@ -233,7 +233,7 @@
+ # disables platform specific features beyond repair.
+ # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
+ # has no effect, don't bother defining them
+- FreeBSD/4.* | Darwin/@<:@6789@:>@.*)
++ FreeBSD/4.* | Darwin/@<:@6789@:>@.* | Darwin/1@<:@01@:>@.*)
+ define_xopen_source=no;;
+ # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
+ # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
+
+--- configure~ 2008-12-14 01:13:52.000000000 +1000
++++ configure 2012-05-08 14:34:29.000000000 +1000
+@@ -2039,7 +2039,7 @@
+ # disables platform specific features beyond repair.
+ # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
+ # has no effect, don't bother defining them
+- FreeBSD/4.* | Darwin/[6789].*)
++ FreeBSD/4.* | Darwin/[6789].* | Darwin/1[01].*)
+ define_xopen_source=no;;
+ # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
+ # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
Something went wrong with that request. Please try again.