We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentd3e8e47 commit47587d1Copy full SHA for 47587d1
vm/src/builtins/singletons.rs
@@ -1,7 +1,7 @@
1
usesuper::{PyType,PyTypeRef};
2
usecrate::{
3
- class::PyClassImpl, convert::ToPyObject,types::Constructor,Context,Py,PyObjectRef,
4
-PyPayload,PyResult,VirtualMachine,
+ class::PyClassImpl, convert::ToPyObject,protocol::PyNumberMethods, types::AsNumber,
+types::Constructor,Context,Py,PyObjectRef,PyPayload,PyResult,VirtualMachine,
5
};
6
7
#[pyclass(module =false, name ="NoneType")]
@@ -39,7 +39,7 @@ impl Constructor for PyNone {
39
}
40
41
42
-#[pyimpl(with(Constructor))]
+#[pyimpl(with(Constructor,AsNumber))]
43
implPyNone{
44
#[pymethod(magic)]
45
fnrepr(&self) ->String{
@@ -52,6 +52,13 @@ impl PyNone {
52
53
54
55
+implAsNumberforPyNone{
56
+constAS_NUMBER:PyNumberMethods =PyNumberMethods{
57
+boolean:Some(|number, _vm|Ok(false)),
58
+ ..PyNumberMethods::NOT_IMPLEMENTED
59
+};
60
+}
61
+
62
#[pyclass(module =false, name ="NotImplementedType")]
63
#[derive(Debug)]
64
pubstructPyNotImplemented;