Skip to content

Commit ced6726

Browse files
committed
Fix go vet warnings
1 parent 08eff15 commit ced6726

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

py/type.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ func TypeNew(metatype *Type, args Tuple, kwargs StringDict) Object {
11381138
if winner != metatype {
11391139
//if winner.New != TypeNew { // Pass it to the winner
11401140
// FIXME Nasty hack since you can't compare function pointers in Go
1141-
if fmt.Sprintf("%x", winner.New) != fmt.Sprintf("%x", TypeNew) { // Pass it to the winner
1141+
if fmt.Sprintf("%p", winner.New) != fmt.Sprintf("%p", TypeNew) { // Pass it to the winner
11421142
return winner.New(winner, args, kwargs)
11431143
}
11441144
metatype = winner
@@ -1504,7 +1504,7 @@ func excess_args(args Tuple, kwargs StringDict) bool {
15041504
func ObjectInit(self Object, args Tuple, kwargs StringDict) {
15051505
t := self.Type()
15061506
// FIXME bodge to compare function pointers
1507-
if excess_args(args, kwargs) && (fmt.Sprintf("%x", t.New) == fmt.Sprintf("%x", ObjectNew) || fmt.Sprintf("%x", t.Init) != fmt.Sprintf("%x", ObjectInit)) {
1507+
if excess_args(args, kwargs) && (fmt.Sprintf("%p", t.New) == fmt.Sprintf("%p", ObjectNew) || fmt.Sprintf("%p", t.Init) != fmt.Sprintf("%p", ObjectInit)) {
15081508
panic(ExceptionNewf(TypeError, "object.__init__() takes no parameters"))
15091509
}
15101510
// Call the __init__ method if it exists
@@ -1524,7 +1524,7 @@ func ObjectInit(self Object, args Tuple, kwargs StringDict) {
15241524

15251525
func ObjectNew(t *Type, args Tuple, kwargs StringDict) Object {
15261526
// FIXME bodge to compare function pointers
1527-
if excess_args(args, kwargs) && (fmt.Sprintf("%x", t.Init) == fmt.Sprintf("%x", ObjectInit) || fmt.Sprintf("%x", t.New) != fmt.Sprintf("%x", ObjectNew)) {
1527+
if excess_args(args, kwargs) && (fmt.Sprintf("%p", t.Init) == fmt.Sprintf("%p", ObjectInit) || fmt.Sprintf("%p", t.New) != fmt.Sprintf("%p", ObjectNew)) {
15281528
panic(ExceptionNewf(TypeError, "object() takes no parameters"))
15291529
}
15301530

0 commit comments

Comments
 (0)