Skip to content

Commit

Permalink
Implement operator repr for raw File objects
Browse files Browse the repository at this point in the history
  • Loading branch information
GrieferAtWork committed Nov 10, 2023
1 parent c65e56b commit c62b43c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/deemon/objects/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3360,6 +3360,15 @@ file_shr(DeeObject *self, DeeObject *some_object) {
return NULL;
}

PRIVATE WUNUSED NONNULL((1)) DREF DeeStringObject *DCALL
file_repr(DeeObject *__restrict self) {
if (Dee_TYPE(self) == (DeeTypeObject *)&DeeFile_Type)
return (DREF DeeStringObject *)DeeString_New("File()");
err_unimplemented_operator(Dee_TYPE(self), OPERATOR_REPR);
return NULL;
}


PRIVATE struct type_math file_math = {
/* .tp_int32 = */ NULL,
/* .tp_int64 = */ NULL,
Expand Down Expand Up @@ -3518,7 +3527,7 @@ PUBLIC DeeFileTypeObject DeeFile_Type = {
},
/* .tp_cast = */ {
/* .tp_str = */ NULL,
/* .tp_repr = */ NULL,
/* .tp_repr = */ (DREF DeeObject *(DCALL *)(DeeObject *__restrict))&file_repr,
/* .tp_bool = */ NULL
},
/* .tp_call = */ NULL,
Expand Down

0 comments on commit c62b43c

Please sign in to comment.