Skip to content

Commit b45127c

Browse files
committed
just raise when someone has messed with the datetime classes
1 parent 69c0657 commit b45127c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,15 +784,14 @@ public final boolean isContextManager(@Exclusive @Cached HasInheritedAttributeNo
784784
private static final String DATETIME_TYPE = "datetime";
785785
private static final String TIME_TYPE = "time";
786786
private static final String STRUCT_TIME_TYPE = "struct_time";
787-
private static final PythonBuiltinClass fallbackClass = new PythonBuiltinClass(null, null);
788787

789788
private static LazyPythonClass readType(ReadAttributeFromObjectNode readTypeNode, Object module, String typename) {
790789
Object type = readTypeNode.execute(module, typename);
791790
if (type instanceof LazyPythonClass) {
792791
return (LazyPythonClass) type;
793792
} else {
794-
// this means someone messed with the builtin modules, we don't know anything and nothing will match this type
795-
return fallbackClass;
793+
CompilerDirectives.transferToInterpreter();
794+
throw PRaiseNode.getUncached().raise(PythonBuiltinClassType.TypeError, "patched datetime class: %r", type);
796795
}
797796
}
798797

0 commit comments

Comments
 (0)