File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -1794,18 +1794,26 @@ public int getNumSlots() {
1794
1794
}
1795
1795
1796
1796
@ ExposedMethod (names = "__repr__" , doc = BuiltinDocs .type___repr___doc )
1797
- final String type_toString () {
1798
- String kind ;
1799
- if (!builtin ) {
1800
- kind = "class" ;
1801
- } else {
1802
- kind = "type" ;
1797
+ final String type___repr__ () {
1798
+ PyObject module = getModule ();
1799
+ if (module instanceof PyUnicode && !module .toString ().equals ("builtins" )) {
1800
+ return module .toString () + "." + getName ();
1803
1801
}
1802
+ return getName ();
1803
+ }
1804
+
1805
+ @ Override
1806
+ public PyUnicode __repr__ () {
1807
+ return new PyUnicode (type___repr__ ());
1808
+ }
1809
+
1810
+ @ ExposedMethod (names = "__str__" , doc = BuiltinDocs .type___str___doc )
1811
+ final String type_toString () {
1804
1812
PyObject module = getModule ();
1805
- if (module instanceof PyBytes && !module .toString ().equals ("__builtin__ " )) {
1806
- return String .format ("<%s '%s.%s'>" , kind , module .toString (), getName ());
1813
+ if (module instanceof PyUnicode && !module .toString ().equals ("builtins " )) {
1814
+ return String .format ("<class '%s.%s'>" , module .toString (), getName ());
1807
1815
}
1808
- return String .format ("<%s '%s'>" , kind , getName ());
1816
+ return String .format ("<class '%s'>" , getName ());
1809
1817
}
1810
1818
1811
1819
public String toString () {
You can’t perform that action at this time.
0 commit comments