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

Type replacement fallback bypasses registered classes registry #48

Open
eudoxos opened this issue Jul 9, 2021 · 3 comments
Open

Type replacement fallback bypasses registered classes registry #48

eudoxos opened this issue Jul 9, 2021 · 3 comments

Comments

@eudoxos
Copy link
Contributor

eudoxos commented Jul 9, 2021

This bit:

Pyro5/Pyro5/serializers.py

Lines 291 to 297 in 0f09262

def register_type_replacement(cls, object_type, replacement_function):
def custom_serializer(obj, serpent_serializer, outputstream, indentlevel):
replaced = replacement_function(obj)
if replaced is obj:
serpent_serializer.ser_default_class(replaced, outputstream, indentlevel)
else:
serpent_serializer._serialize(replaced, outputstream, indentlevel)

will not call special serializers created via Pyro5.api.register_class_to_dict. I sense there must be some reason for that. What is it?

Context: I am hitting a case where Pyro5 creates type replacement for an exposed class (autoproxying). When another instance of that class is not registered, the object itself is returned. Now, in such case, I would to use register_class_to_dict to do automatic daemon registration, but it is not getting called as ser_default_class is called directly.

@irmen
Copy link
Owner

irmen commented Jul 9, 2021

I don't know :) It's been quite a while since I did something with autoproxied classes. Will have to dig into these specifics again to be able to give a good answer.

@irmen
Copy link
Owner

irmen commented Jun 18, 2022

@eudoxos can you provide a snippet of code that demonstrates the problem?

@eudoxos
Copy link
Contributor Author

eudoxos commented Jun 29, 2022

I cannot even understand my own description now... sorry. If I bump into that again, I will remember.

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

No branches or pull requests

2 participants