[IronPython] __init__ ignored in favor of base class constructor? - blocker
Dino Viehland
dinov at microsoft.com
Mon Dec 1 21:35:42 CET 2008
It looks like protected ctor's are completely broken:
import clr
clr.AddReference('test')
from Xyz import Foo
class x(Foo):
def __new__(cls):
return Foo.__new__(cls, object())
x()
TypeError: default __new__ does not take parameters
test.cs:
using System;
namespace Xyz {
public class Foo {
protected Foo(object x) { }
}
}
-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff
Sent: Monday, December 01, 2008 12:22 PM
To: Discussion of IronPython
Subject: Re: [IronPython] __init__ ignored in favor of base class constructor? - blocker
On Mon, Dec 1, 2008 at 2:43 PM, Dino Viehland <dinov at microsoft.com> wrote:
> Ok, I think the problem here is two-fold. First there's no public default constructor - only a private one. So you need to pick between the Stream overload or the StreamResourceInfo, Uri overload. You're apparently trying to choose the Stream overload.
>
> Which brings me to the 2nd problem. Quite surprisingly GetResourceStream doesn't seem to return a stream - it returns a StreamResourceInfo. So ultimately there are no applicable methods for us to call.
That's the second time that method has got me. They should have named
it GetResourceStreamInfo
But the problem still remains:
TypeError: default __new__ does not take parameters
Line 7: class MyTheme(Theme):
Line 8: def __new__(cls):
Line 9: return Theme.__new__(cls,
wpf.Application.GetResourceStream(wpf.Uri('theme.xaml',
wpf.UriKind.Relative)).Stream)
Line 10:
Line 11: def demo():
TypeError
at __new__ in app.py, line 9
at demo in app.py, line 12
at app.py in app.py, line 21
Thanks,
-Dan
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
More information about the Ironpython-users
mailing list