@@ -1515,9 +1515,16 @@ func excess_args(args Tuple, kwargs StringDict) bool {
1515
1515
func ObjectInit (self Object , args Tuple , kwargs StringDict ) {
1516
1516
t := self .Type ()
1517
1517
// 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 ) {
1519
1525
panic (ExceptionNewf (TypeError , "object.__init__() takes no parameters" ))
1520
1526
}
1527
+
1521
1528
// Call the __init__ method if it exists
1522
1529
// FIXME this isn't the way cpython does it - it adjusts the function pointers
1523
1530
// Only do this for non built in types
@@ -1535,7 +1542,13 @@ func ObjectInit(self Object, args Tuple, kwargs StringDict) {
1535
1542
1536
1543
func ObjectNew (t * Type , args Tuple , kwargs StringDict ) Object {
1537
1544
// 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 ) {
1539
1552
panic (ExceptionNewf (TypeError , "object() takes no parameters" ))
1540
1553
}
1541
1554
0 commit comments