Skip to content

Fix method calls on custom Record subclasses #678

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

Merged
merged 1 commit into from
Dec 20, 2020
Merged

Conversation

elprans
Copy link
Member

@elprans elprans commented Dec 20, 2020

The current implementation has a bunch of CheckExact calls in front of
most Record methods, effectively making them unusable in subclasses.
Relax the check to include the subclasses.

While at it, add a check that __init__ and __new__ are not redefined
on the provided Record subclass. Doing so is pointless, because
Record instance initialization effectively bypasses both, so raise an
InterfaceError to avoid needless confusion.

Fixes: #676

The current implementation has a bunch of `CheckExact` calls in front of
most `Record` methods, effectively making them unusable in subclasses.
Relax the check to include the subclasses.

While at it, add a check that `__init__` and `__new__` are not redefined
on the provided Record subclass.  Doing so is pointless, because
`Record` instance initialization effectively bypasses both, so raise an
`InterfaceError` to avoid needless confusion.

Fixes: #676
@elprans elprans merged commit c162909 into master Dec 20, 2020
@elprans elprans deleted the fix-custom-record branch December 20, 2020 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

asyncpg/protocol/record/recordobj.c:562: bad argument to internal function when using custom Record class
1 participant