Skip to content

Commit bcd953a

Browse files
committed
missing Fallback on PReferenceType.__new__
1 parent b7e22f7 commit bcd953a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/WeakRefModuleBuiltins.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
import com.oracle.graal.python.builtins.objects.object.PythonObject;
5050
import com.oracle.graal.python.builtins.objects.referencetype.PReferenceType;
5151
import com.oracle.graal.python.nodes.function.PythonBuiltinNode;
52+
import com.oracle.graal.python.runtime.exception.PythonErrorType;
53+
import com.oracle.truffle.api.dsl.Fallback;
5254
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
5355
import com.oracle.truffle.api.dsl.NodeFactory;
5456
import com.oracle.truffle.api.dsl.Specialization;
@@ -75,6 +77,11 @@ public PReferenceType refType(Object cls, PythonObject pythonObject, PNone none)
7577
public PReferenceType refType(Object cls, PythonObject pythonObject, PFunction callback) {
7678
return factory().createReferenceType(pythonObject, callback);
7779
}
80+
81+
@Fallback
82+
public PReferenceType refType(@SuppressWarnings("unused") Object cls, @SuppressWarnings("unused") Object object, @SuppressWarnings("unused") Object callback) {
83+
throw raise(PythonErrorType.TypeError, "cannot create weak reference to '%p' object", object);
84+
}
7885
}
7986

8087
// getweakrefcount(obj)

0 commit comments

Comments
 (0)