From owner-freebsd-python@freebsd.org Tue Jun 20 03:11:18 2017 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BAB6D8C074 for ; Tue, 20 Jun 2017 03:11:18 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 22AD46F93D for ; Tue, 20 Jun 2017 03:11:18 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 21F39D8C072; Tue, 20 Jun 2017 03:11:18 +0000 (UTC) Delivered-To: python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FEBCD8C071; Tue, 20 Jun 2017 03:11:18 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE3556F93B; Tue, 20 Jun 2017 03:11:17 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pg0-x241.google.com with SMTP id e187so10387165pgc.3; Mon, 19 Jun 2017 20:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ecHvhPYfkOHdsmRk6EKg8kDhNcSPBCn/28XADSUgF90=; b=Gj1rBVepdvExyyuZKHxX19YJ8SKANyeOcqriMG2xQYIhGcKn0liMkQYGnpBrBKPJx1 lJ0LrAS7VxPJbailk/rqYUTuMj70JdElwlFxus/P5Q4S8qz4gzaUIVpq+6X3JdHNBEt2 ZhnlCl1/pqWFdT5DKLR0IZPMleaIug2lwXEMz+xVGaAUtCUG5S8K+D48z+HZXME8/tNV burAnabCilpeGdVKFYZqgpSxUCoB1azGwG9CgGt0vyqIvNaIOPXWBwbO1qpU6NTgNSeP GNzfM0d9Qa9H98+k3dTy1m58KHpfP8JegWy4gpW4ZOXQ7sHNqS5xcEzUp0jYXjuSpFl1 ykFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ecHvhPYfkOHdsmRk6EKg8kDhNcSPBCn/28XADSUgF90=; b=nF37knLYvPALxqq2ImPPNW+Ppmf31T11f4mV+DD3CqEs9WhMS5ncn9qgRn8zOuSd4m BQgs1PzRiGXfKP6KdZLRypAWCkGgQcyprhlZzghTc+gKl08Zg5BpVPcHBRT8Z0xU3/vg X7/sn63wTQky/gM9cYdqfVcObnC7DpbOrOdvJpqWP4pR2TXVzWDOyDqJV5pgrkdWKWal I2xwCdjp7p4PCGjGJ4SY468wjmVJdWc/a1mefDKzlLeG7dspYS5tyXg7TF8eLrOD9TNR ZNZtv61vJfYdmLsplfk+Hnu0qYrnh7bDp6HSnEjSB7XpXiawtByTRzKwVulljkV2C1VB 14eA== X-Gm-Message-State: AKS2vOyHwwgqHGM18yT+wv1TzWurun22sh2BpNXS2AzIWEUd0ZV//uMa 2eQhJw3N+VA39OYHcAw= X-Received: by 10.99.147.91 with SMTP id w27mr27740359pgm.24.1497928277189; Mon, 19 Jun 2017 20:11:17 -0700 (PDT) Received: from ?IPv6:2001:44b8:31ae:7b01:2042:3e8:d7ce:9b9c? (2001-44b8-31ae-7b01-2042-03e8-d7ce-9b9c.static.ipv6.internode.on.net. [2001:44b8:31ae:7b01:2042:3e8:d7ce:9b9c]) by smtp.gmail.com with ESMTPSA id v6sm11808081pfl.2.2017.06.19.20.11.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jun 2017 20:11:16 -0700 (PDT) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: [PATCH] lang/python27 -- Fix namespace collision To: sgk@troutmask.apl.washington.edu, freebsd-ports@freebsd.org, python@FreeBSD.org References: <20170618182905.GA67867@troutmask.apl.washington.edu> <20170618183112.GA67920@troutmask.apl.washington.edu> From: Kubilay Kocak Message-ID: <9090f327-3266-35b3-8bf3-f83b7c741fe2@FreeBSD.org> Date: Tue, 20 Jun 2017 13:06:28 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Thunderbird/54.0a2 MIME-Version: 1.0 In-Reply-To: <20170618183112.GA67920@troutmask.apl.washington.edu> Content-Type: text/plain; charset=utf-8 Content-Language: en-AU Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jun 2017 03:11:18 -0000 On 6/19/17 4:31 AM, Steve Kargl wrote: > On Sun, Jun 18, 2017 at 11:29:05AM -0700, Steve Kargl wrote: >> Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle >> trignometric functions cospi, sinpi, and tanpi. When libm (aka >> math.h) grows support for sinpi(x), lang/python27 has a namespace >> collision. The attached patch fixes the problem. >> Hi Steve, Is this issue relevant only for particular (and/or future) FreeBSD versions ('where libm grows supports for x, y') or independent of base entirely? Also, could you open an upstream issue regarding this please, as a long-term target for all local (Python port) patches is that they are included upstream. This also ensures we can document all patches with their relevant upstream issue/commit references for our future selves and others. ./koobs > Well, that's inconvenient. Seems attachments are stripped. > > --- Modules/mathmodule.c.orig 2017-06-18 11:09:05.938222000 -0700 > +++ Modules/mathmodule.c 2017-06-18 11:09:56.248307000 -0700 > @@ -71,7 +71,7 @@ > static const double sqrtpi = 1.772453850905516027298167483341145182798; > > static double > -sinpi(double x) > +my_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/my_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 / my_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(my_sinpi(absx))) - log(absx) - > (log(lanczos_sum(absx)) - lanczos_g + > (absx-0.5)*(log(absx+lanczos_g-0.5)-1)); > } >