[ python-Bugs-1659171 ] Calling tparm from extension lib fails in Python 2.5

SourceForge.net noreply at sourceforge.net
Wed Feb 14 22:24:45 CET 2007


Bugs item #1659171, was opened at 2007-02-13 18:27
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1659171&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Richard B. Kreckel (richyk)
Assigned to: Nobody/Anonymous (nobody)
Summary: Calling tparm from extension lib fails in Python 2.5

Initial Comment:
Attached is a little C++ module that fetches the terminal capability string for turning off all attributes and runs it through tparm(). (All this is done in a static Ctor of a class without init function, but never mind.)

Compile with:
g++ -c testlib.cc
g++ testlib.o -o testlib.so -shared -Wl,-soname,testlib.so -lncurses

On SuSE Linux 10.1 (and older), I get the expected behavior:

Python 2.4.2 (#1, Oct 13 2006, 17:11:24) 
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import testlib
Terminal is "xterm"
Dump of sgr0: 1b 5b 30 6d
Dump of instance: 1b 5b 30 6d
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: dynamic module does not define init function (inittestlib)
>>> 

However, on SuSE Linux 10.2, tparm creates a NULL pointer:
Python 2.5 (r25:51908, Jan  9 2007, 16:59:32) 
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import testlib
Terminal is "xterm"
Dump of sgr0: 1b 5b 30 6d
Rats! tparm made a NULL pointer!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (inittestlib)
>>> 

Why, oh why?


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2007-02-14 22:24

Message:
Logged In: YES 
user_id=21627
Originator: NO

I fail to see the bug. The exception precisely describes the error in your
code

ImportError: dynamic module does not define init function (inittestlib)

Why do you expect any meaningful behavior in the presence of this error?
Your shared library isn't an extension module.

If you think it is related to #1548092, please try out the subversion
trunk, which has fixed this bug.

----------------------------------------------------------------------

Comment By: Richard B. Kreckel (richyk)
Date: 2007-02-14 09:52

Message:
Logged In: YES 
user_id=1718463
Originator: YES

I suspect that this is a duplicate of Bug [1548092].
Note that, there it is asserted that tparm returns NULL on certain invalid
strings.
That does not seem to be true. It returns NULL for valid trivial strings,
too.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1659171&group_id=5470


More information about the Python-bugs-list mailing list