From owner-freebsd-python@freebsd.org Thu Nov 19 06:47:27 2015 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 31CCBA325D2 for ; Thu, 19 Nov 2015 06:47:27 +0000 (UTC) (envelope-from raviqqe@gmail.com) Received: from mail-pa0-x22d.google.com (mail-pa0-x22d.google.com [IPv6:2607:f8b0:400e:c03::22d]) (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 F3DF31D26; Thu, 19 Nov 2015 06:47:26 +0000 (UTC) (envelope-from raviqqe@gmail.com) Received: by pabfh17 with SMTP id fh17so73655903pab.0; Wed, 18 Nov 2015 22:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type; bh=m4xpNCEeHYg1zpj7XMyZgz+mvlW9oalWZndid1ipJX4=; b=lD3VExqIg9wy0PeQ3FOjioX+dXKKGIcctMnISy8rCOxBTsuUraCuqdLb2mQ+sLrGdw 68flrl/c8eAyPmnA30H/6H4uUWaYn00lqVKxFgy2eG2wEOWftNyy3fJ4/kveaq/THcIH z4xEKwsubZuW7YDpIdNwH2IFeB2ZKlkv0b8J9wcjUrkmI5avyLloxS3isNusyRaE+MJ6 cGZQCyzurutSLAzxAlpcz61sEV1mhWfOGxvALbmfeA9H3So4m41HAoYJ9UEQDmFEfOQC GN/ydJfW3IkWy5b47LqbvseBJtejh8jYEqrUC5k1YgKggZEP1cCUJsdrbKTjlt+5q2d0 eXQw== X-Received: by 10.68.133.134 with SMTP id pc6mr8245658pbb.35.1447915646587; Wed, 18 Nov 2015 22:47:26 -0800 (PST) Received: from coronoides.lostwoods ([133.21.225.184]) by smtp.googlemail.com with ESMTPSA id ix2sm8195018pac.15.2015.11.18.22.47.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Nov 2015 22:47:26 -0800 (PST) Subject: Re: Python curses module does not print any attributed space character on FreeBSD 11-current To: Craig Rodrigues References: <564D4739.1090504@gmail.com> Cc: freebsd-python@freebsd.org From: raviqqe Message-ID: <564D6F37.7040804@gmail.com> Date: Thu, 19 Nov 2015 06:41:59 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2015 06:47:27 -0000 On 11/19/15 04:58 AM, Craig Rodrigues wrote: > On Wed, Nov 18, 2015 at 7:51 PM, raviqqe > wrote: > > Hello, > > TL;DR > I encountered a bug-like behavior of a Python built-in module. > Could you reproduce it in C? > > While working with Python and its curses module on FreeBSD > 11-current (x86_64), > I found a weird behavior of the module. The code below doesn't > print any character > although it should print a space on the upper-left corner. > > ``` > # test.py > > import curses > > window = curses.initscr() > window.attrset(curses.A_NORMAL) > window.addch(" ") > window.getch() > curses.endwin() > ``` > > The cause is `window.attrset()` and when I removed the line it > works just fine. > And, with the visible characters (such as 'A' and '?' except for ' > ' and '\t'), > it works fine even if window.attrset() is there. > > Hi, > > I have a: > * FreeBSD-CURRENT system: built from Subversion revision r290830 > * python27-2.710_1 (installed with pkg install lang/python ) > * python35-3.5.0 (installed with pkg install lang/python35 ) > > I ran your test case, and did not encounter your problem. > For me, a space is printed in the top left. > > Also, I see: > > > # ldd /usr/local/lib/python2.7/lib-dynload/_curses.so > /usr/local/lib/python2.7/lib-dynload/_curses.so: > libthr.so.3 => /lib/libthr.so.3 (0x801212000) > libncurses.so.8 => /lib/libncurses.so.8 (0x801437000) > libpython2.7.so.1 => /usr/local/lib/libpython2.7.so.1 > (0x80168a000) > libc.so.7 => /lib/libc.so.7 (0x800822000) > libintl.so.8 => /usr/local/lib/libintl.so.8 (0x801a48000) > libutil.so.9 => /lib/libutil.so.9 (0x801c52000) > libm.so.5 => /lib/libm.so.5 (0x801e65000) > # ldd /usr/local/lib/python3.5/lib-dynload/_curses.so > /usr/local/lib/python3.5/lib-dynload/_curses.so: > libthr.so.3 => /lib/libthr.so.3 (0x801214000) > libncurses.so.8 => /lib/libncurses.so.8 (0x801439000) > libpython3.5m.so.1.0 => /usr/local/lib/libpython3.5m.so.1.0 > (0x801800000) > libc.so.7 => /lib/libc.so.7 (0x800822000) > libintl.so.8 => /usr/local/lib/libintl.so.8 (0x801c9b000) > libutil.so.9 => /lib/libutil.so.9 (0x801ea5000) > libm.so.5 => /lib/libm.so.5 (0x8020b8000) > > At least for me, the Python _curses.so is linking against ncurses.so.8. > > -- > Craig I always build and install ports via the ports system using `portmaster` and never use `pkg`. Just now, I rebuilt lang/python27 and lang/python35. But, still on my machine, ``` % ldd /usr/local/lib/python2.7/lib-dynload/_curses.so /usr/local/lib/python2.7/lib-dynload/_curses.so: libthr.so.3 => /lib/libthr.so.3 (0x801212000) libncurses.so.5 => /usr/lib/libncurses.so.5 (0x801437000) libtinfo.so.5 => /usr/local/lib/libtinfo.so.5 (0x80168a000) libpython2.7.so.1 => /usr/local/lib/libpython2.7.so.1 (0x8018c0000) libc.so.7 => /lib/libc.so.7 (0x800822000) libintl.so.8 => /usr/local/lib/libintl.so.8 (0x801c7c000) libutil.so.9 => /lib/libutil.so.9 (0x801e87000) libm.so.5 => /lib/libm.so.5 (0x80209a000) % ldd /usr/local/lib/python3.5/lib-dynload/_curses.so /usr/local/lib/python3.5/lib-dynload/_curses.so: libthr.so.3 => /lib/libthr.so.3 (0x80121c000) libncurses.so.5 => /usr/lib/libncurses.so.5 (0x801441000) libtinfo.so.5 => /usr/local/lib/libtinfo.so.5 (0x801694000) libpython3.5dm.so.1.0 => /usr/local/lib/libpython3.5dm.so.1.0 (0x801a00000) libc.so.7 => /lib/libc.so.7 (0x800822000) libintl.so.8 => /usr/local/lib/libintl.so.8 (0x802057000) libutil.so.9 => /lib/libutil.so.9 (0x802262000) libm.so.5 => /lib/libm.so.5 (0x802475000) ``` And devel/ncurses is explicitly required by them. ``` % pkg info -r ncurses ncurses-5.9.20150214_2: sterm-0.6 python27-2.7.10_1 sqlite3-3.9.2 tmux-2.1 python34-3.4.3_1 python35-3.5.0_1 zsh-5.1.1 % pkg info -d python27 python27-2.7.10_1: openssl-1.0.2_4 readline-6.3.8 libffi-3.2.1 gettext-runtime-0.19.6 ncurses-5.9.20150214_2 % pkg info -d python35 python35-3.5.0_1: openssl-1.0.2_4 readline-6.3.8 libffi-3.2.1 gettext-runtime-0.19.6 ncurses-5.9.20150214_2 ``` What's happening on my machine? My uname is here. ``` % uname -a FreeBSD 11.0-CURRENT FreeBSD 11.0-CURRENT #10 r291009: Wed Nov 18 06:47:11 UTC 2015 root@:/usr/obj/usr/src/sys/GENERIC amd64 ```