Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't reject tuple arguments on the client side #370

Merged
merged 2 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion edgedb/protocol/codecs/array.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ cdef class BaseArrayCodec(BaseCodec):
Py_ssize_t objlen
Py_ssize_t i

if not isinstance(self.sub_codec, (ScalarCodec, TupleCodec, RangeCodec)):
if not isinstance(
self.sub_codec,
(ScalarCodec, TupleCodec, NamedTupleCodec, RangeCodec)
):
raise TypeError(
'only arrays of scalars are supported (got type {!r})'.format(
type(self.sub_codec).__name__
Expand Down
5 changes: 3 additions & 2 deletions edgedb/protocol/codecs/base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,16 @@ cdef class BaseRecordCodec(BaseCodec):
for codec in self.fields_codecs:
if not isinstance(
codec,
(ScalarCodec, ArrayCodec, EnumCodec, RangeCodec),
(ScalarCodec, ArrayCodec, TupleCodec, NamedTupleCodec,
EnumCodec, RangeCodec),
):
self.encoder_flags |= RECORD_ENCODER_INVALID
break
self.encoder_flags |= RECORD_ENCODER_CHECKED

if self.encoder_flags & RECORD_ENCODER_INVALID:
raise TypeError(
'argument tuples only support scalars and arrays of scalars')
'argument tuples do not support objects')

cdef encode(self, WriteBuffer buf, object obj):
cdef:
Expand Down