@@ -1515,9 +1515,16 @@ func excess_args(args Tuple, kwargs StringDict) bool{
15151515func ObjectInit (self Object , args Tuple , kwargs StringDict ){
15161516t := self .Type ()
15171517// FIXME bodge to compare function pointers
1518- if excess_args (args , kwargs ) && (fmt .Sprintf ("%p" , t .New ) == fmt .Sprintf ("%p" , ObjectNew ) || fmt .Sprintf ("%p" , t .Init ) != fmt .Sprintf ("%p" , ObjectInit )){
1518+ // if excess_args(args, kwargs) && (fmt.Sprintf("%p", t.New) == fmt.Sprintf("%p", ObjectNew) || fmt.Sprintf("%p", t.Init) != fmt.Sprintf("%p", ObjectInit)){
1519+ // panic(ExceptionNewf(TypeError, "object.__init__() takes no parameters"))
1520+ // }
1521+
1522+ // FIXME this isn't correct probably
1523+ // Check args for object()
1524+ if t == ObjectType && excess_args (args , kwargs ){
15191525panic (ExceptionNewf (TypeError , "object.__init__() takes no parameters" ))
15201526 }
1527+
15211528// Call the __init__ method if it exists
15221529// FIXME this isn't the way cpython does it - it adjusts the function pointers
15231530// Only do this for non built in types
@@ -1535,7 +1542,13 @@ func ObjectInit(self Object, args Tuple, kwargs StringDict){
15351542
15361543func ObjectNew (t * Type , args Tuple , kwargs StringDict ) Object {
15371544// FIXME bodge to compare function pointers
1538- if excess_args (args , kwargs ) && (fmt .Sprintf ("%p" , t .Init ) == fmt .Sprintf ("%p" , ObjectInit ) || fmt .Sprintf ("%p" , t .New ) != fmt .Sprintf ("%p" , ObjectNew )){
1545+ // if excess_args(args, kwargs) && (fmt.Sprintf("%p", t.Init) == fmt.Sprintf("%p", ObjectInit) || fmt.Sprintf("%p", t.New) != fmt.Sprintf("%p", ObjectNew)){
1546+ // panic(ExceptionNewf(TypeError, "object() takes no parameters"))
1547+ // }
1548+
1549+ // FIXME this isn't correct probably
1550+ // Check arguments to new only for object
1551+ if t == ObjectType && excess_args (args , kwargs ){
15391552panic (ExceptionNewf (TypeError , "object() takes no parameters" ))
15401553 }
15411554
0 commit comments