Date: Wed, 20 Sep 2017 17:10:30 -0700 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: freebsd-ports@freebsd.org, freebsd-python@freebsd.org Subject: namespace pollution with entities in math.h Message-ID: <20170921001030.GA7423@troutmask.apl.washington.edu>
next in thread | raw e-mail | index | archive | help
It seems that I accidentally stumped onto namespace pollution in lang/python36, which is identical to the same issue I came across with lang/python27 and reported several weeks ago. The following diff fixes both ports. Index: lang/python27/files/patch-Modules__mathmodule.c =================================================================== --- lang/python27/files/patch-Modules__mathmodule.c (nonexistent) +++ lang/python27/files/patch-Modules__mathmodule.c (working copy) @@ -0,0 +1,38 @@ +--- Modules/mathmodule.c.orig 2017-09-15 11:14:58.388892000 -0700 ++++ Modules/mathmodule.c 2017-09-15 11:15:38.636909000 -0700 +@@ -71,7 +71,7 @@ + static const double sqrtpi = 1.772453850905516027298167483341145182798; + + static double +-sinpi(double x) ++_sinpi(double x) + { + double y, r; + int n; +@@ -270,7 +270,7 @@ + integer. */ + if (absx > 200.0) { + if (x < 0.0) { +- return 0.0/sinpi(x); ++ return 0.0/_sinpi(x); + } + else { + errno = ERANGE; +@@ -294,7 +294,7 @@ + } + z = z * lanczos_g / y; + if (x < 0.0) { +- r = -pi / sinpi(absx) / absx * exp(y) / lanczos_sum(absx); ++ r = -pi / _sinpi(absx) / absx * exp(y) / lanczos_sum(absx); + r -= z * r; + if (absx < 140.0) { + r /= pow(y, absx - 0.5); +@@ -366,7 +366,7 @@ + (x-0.5)*(log(x+lanczos_g-0.5)-1); + } + else { +- r = log(pi) - log(fabs(sinpi(absx))) - log(absx) - ++ r = log(pi) - log(fabs(_sinpi(absx))) - log(absx) - + (log(lanczos_sum(absx)) - lanczos_g + + (absx-0.5)*(log(absx+lanczos_g-0.5)-1)); + } Property changes on: lang/python27/files/patch-Modules__mathmodule.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: lang/python36/files/patch-Modules__mathmodule.c =================================================================== --- lang/python36/files/patch-Modules__mathmodule.c (nonexistent) +++ lang/python36/files/patch-Modules__mathmodule.c (working copy) @@ -0,0 +1,38 @@ +--- Modules/mathmodule.c.orig 2017-09-15 13:33:29.735199000 -0700 ++++ Modules/mathmodule.c 2017-09-15 13:33:48.030737000 -0700 +@@ -67,7 +67,7 @@ + static const double logpi = 1.144729885849400174143427351353058711647; + + static double +-sinpi(double x) ++_sinpi(double x) + { + double y, r; + int n; +@@ -296,7 +296,7 @@ + integer. */ + if (absx > 200.0) { + if (x < 0.0) { +- return 0.0/sinpi(x); ++ return 0.0/_sinpi(x); + } + else { + errno = ERANGE; +@@ -320,7 +320,7 @@ + } + z = z * lanczos_g / y; + if (x < 0.0) { +- r = -pi / sinpi(absx) / absx * exp(y) / lanczos_sum(absx); ++ r = -pi / _sinpi(absx) / absx * exp(y) / lanczos_sum(absx); + r -= z * r; + if (absx < 140.0) { + r /= pow(y, absx - 0.5); +@@ -390,7 +390,7 @@ + r += (absx - 0.5) * (log(absx + lanczos_g - 0.5) - 1); + if (x < 0.0) + /* Use reflection formula to get value for negative x. */ +- r = logpi - log(fabs(sinpi(absx))) - log(absx) - r; ++ r = logpi - log(fabs(_sinpi(absx))) - log(absx) - r; + if (Py_IS_INFINITY(r)) + errno = ERANGE; + return r; Property changes on: lang/python36/files/patch-Modules__mathmodule.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property -- Steve 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4 20161221 https://www.youtube.com/watch?v=IbCHE-hONow
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170921001030.GA7423>