From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008052912 Firefox/3.0 Description of problem: I found a tutorial about using Newt in Python. The first example under Forms and Grids segfaults. If I change their use of Widget to any of the classes based on Widget it seems to work fine. I realize that this may just mean that you should never use Widget directly, but it should handle it without a segfault, IMHO. Version-Release number of selected component (if applicable): newt-python-0.52.9-1.fc9 How reproducible: Always Steps to Reproduce: 1. Run this script (built my stripping down the example code at listed URL): #!/usr/bin/env python from snack import * s = SnackScreen() g = Grid(1,1) w = Widget() g.setField(w,0,0) s.gridWrappedWindow(g, "title") s.popWindow() s.finish() Actual Results: Segmentation Fault Expected Results: Nothing special if anything, but at the very least an exception being raised based on invalid object. Additional info: I've tried this on the following rpms: newt-python-0.52.7-4.fc8.i386 newt-python-0.52.9-1.fc9.i386
I'm not sure the example has ever worked. Widget just provides the setCallback function and isn't supposed to be used as a real widget. Any suggestions where the exception should be raised? Checking in all functions if w == None wouldn't be very nice.
Okay.. I'll concede that checking that in every function is not nice. After your response and having browsed through the source would these 2 assumptions be true: 1: You shouldn't be using Widget directly, ever? 2: Whenever inheriting Widget you should override the __init__ method If so You could always do this: class Widget: """Base class for NEWT toolkit - Do not use directly methods: - Widget(self) - setCallback(self, obj, data = None) : The callback for when object activated. data is passed to obj. """ def setCallback(self, obj, data = None): if data: self.w.setCallback(obj, data) else: self.w.setCallback(obj) def __init__(self): raise NotImplementedError This was per the definition located at Python's Module Exception page[1], which states: "exception NotImplementedError This exception is derived from RuntimeError. In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method. New in version 1.5.2. " Of course if the above 2 assumptions are not true, I'm going to have to think about it a bit more. [1]http://docs.python.org/lib/module-exceptions.html
triaged
Ok, I've put the fix in upstream git. Will be in the next release. Thanks.
awesome. thanks.
Fixed in newt-0.52.10-1.fc10.
newt-0.52.10-1.fc9 has been submitted as an update for Fedora 9
newt-0.52.10-1.fc9 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.