mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Adds __qualname__ to PyBuiltinFunction
This commit is contained in:
@@ -109,3 +109,17 @@ assert MyTypeWithMethod().N.s.__qualname__ == 'MyTypeWithMethod.N.s'
|
||||
assert repr(str.replace) == "<method 'replace' of 'str' objects>"
|
||||
assert repr(str.replace) == str(str.replace)
|
||||
assert repr(int.to_bytes) == "<method 'to_bytes' of 'int' objects>"
|
||||
|
||||
|
||||
# Regression to
|
||||
# https://github.com/RustPython/RustPython/issues/2788
|
||||
|
||||
assert iter.__qualname__ == iter.__name__ == 'iter'
|
||||
assert max.__qualname__ == max.__name__ == 'max'
|
||||
assert min.__qualname__ == min.__name__ == 'min'
|
||||
|
||||
|
||||
def custom_func():
|
||||
pass
|
||||
|
||||
assert custom_func.__qualname__ == 'custom_func'
|
||||
|
||||
@@ -118,6 +118,10 @@ impl PyBuiltinFunction {
|
||||
self.value.name.clone()
|
||||
}
|
||||
#[pyproperty(magic)]
|
||||
fn qualname(&self) -> PyStrRef {
|
||||
self.name()
|
||||
}
|
||||
#[pyproperty(magic)]
|
||||
fn doc(&self) -> Option<PyStrRef> {
|
||||
self.value.doc.clone()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user