Skip to content

Commit fc27450

Browse files
committed
fix __qualname__ in TypeBuiltins
- fix exception in deque (_collections) since __name__ is not available
1 parent 50dad63 commit fc27450

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/TypeBuiltins.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,8 +943,9 @@ String getName(PythonBuiltinClass cls, @SuppressWarnings("unused") PNone value)
943943
}
944944

945945
@Specialization(guards = {"isNoValue(value)", "!isPythonBuiltinClass(cls)"})
946-
Object getName(PythonClass cls, @SuppressWarnings("unused") PNone value) {
947-
return cls.getQualName();
946+
Object getName(PythonClass cls, @SuppressWarnings("unused") PNone value,
947+
@Cached("create()") ReadAttributeFromObjectNode getName) {
948+
return getName.execute(cls, __QUALNAME__);
948949
}
949950

950951
@Specialization(guards = "!isNoValue(value)")

graalpython/lib-graalpython/_collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def __rmul__(self, times):
243243
return _mul(deque(self, maxlen=self.maxlen), times)
244244

245245
def __hash__(self):
246-
raise TypeError("unhashable type: '%s'" % self.__name__)
246+
raise TypeError("unhashable type: '{}'".format(type(self).__name__))
247247

248248
@synchronized
249249
def extendleft(self, iterable):

0 commit comments

Comments
 (0)