Skip to content

Add support for class attributes and bound methods to escape hatch#2775

Open
malder08 wants to merge 4 commits intomasterfrom
malder/escape-hatch-additions
Open

Add support for class attributes and bound methods to escape hatch#2775
malder08 wants to merge 4 commits intomasterfrom
malder/escape-hatch-additions

Conversation

@malder08
Copy link
Contributor

Update the escape hatch to allow escaping the following components:

  • Class-level attributes
    • Also fixed a bug where falsy enum values (e.g. 0 and “”) would throw a RuntimeError since they were considered None
  • Bound methods

if name == "function":
# Special handling of pickled functions. We create a new class that
if name in ("function", "method"):
# Special handling of pickled functions and methods. We create a new class that
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference between method and function here? Does member means class member function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes method is a class instance method. I believe they should be handled the same as standalone functions but because the type is method instead of function, the escape hatch didn't recognize it and threw an error.

obj = self._local_objects.get(obj.identifier)
if obj:
return obj
result = self._local_objects.get(obj.identifier)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Copy link
Contributor

@romain-intel romain-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@malder08 malder08 marked this pull request as ready for review February 4, 2026 18:36
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.

3 participants