mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Adds __subclasshook__ to type, refs #2794
This commit is contained in:
@@ -151,3 +151,10 @@ assert BaseException.args.__qualname__ == 'BaseException.args'
|
||||
assert Exception.args.__qualname__ == 'BaseException.args'
|
||||
# dynamic with `.new_readonly_getset`
|
||||
assert SyntaxError.msg.__qualname__ == 'SyntaxError.msg'
|
||||
|
||||
|
||||
# Regression to
|
||||
# https://github.com/RustPython/RustPython/issues/2794
|
||||
|
||||
assert type.__subclasshook__.__qualname__ == 'type.__subclasshook__'
|
||||
assert object.__subclasshook__.__qualname__ == 'object.__subclasshook__'
|
||||
|
||||
@@ -290,6 +290,11 @@ impl PyType {
|
||||
subclass.issubclass(&zelf)
|
||||
}
|
||||
|
||||
#[pyclassmethod(magic)]
|
||||
fn subclasshook(_args: FuncArgs, vm: &VirtualMachine) -> PyObjectRef {
|
||||
vm.ctx.not_implemented()
|
||||
}
|
||||
|
||||
#[pyproperty(magic)]
|
||||
fn name(&self) -> String {
|
||||
self.name.clone()
|
||||
|
||||
Reference in New Issue
Block a user