This repository has been archived by the owner on Dec 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 286
Optionally use __slots__ for payload members #259
Open
misakwa
wants to merge
12
commits into
Thriftpy:develop
Choose a base branch
from
misakwa:fix/optimize-payload
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on Nov 18, 2016
-
Add option to use slots for struct payloads
misakwa committedNov 18, 2016 Configuration menu - View commit details
-
Copy full SHA for 942a89b - Browse repository at this point
Copy the full SHA 942a89bView commit details -
Expose use_slots to load and load_fp
- Expose using slot based generated code to load entry points - Add first tests - TODO: - Fix possible cache poisoning when loading slot vs no slot structs - Add tests for above - Add pickling tests for slot based structs
misakwa committedNov 18, 2016 Configuration menu - View commit details
-
Copy full SHA for b490393 - Browse repository at this point
Copy the full SHA b490393View commit details -
Clear cache before testing slots
misakwa committedNov 18, 2016 Configuration menu - View commit details
-
Copy full SHA for 8c6b369 - Browse repository at this point
Copy the full SHA 8c6b369View commit details -
Cache slot based objects with different keys
misakwa committedNov 18, 2016 Configuration menu - View commit details
-
Copy full SHA for 5f1f01e - Browse repository at this point
Copy the full SHA 5f1f01eView commit details -
misakwa committed
Nov 18, 2016 Configuration menu - View commit details
-
Copy full SHA for cc69f87 - Browse repository at this point
Copy the full SHA cc69f87View commit details
Commits on Nov 20, 2016
-
- Replace class with a newer one with slot fields - Implement subclass and instance checks
misakwa committedNov 20, 2016 Configuration menu - View commit details
-
Copy full SHA for 9aa7a61 - Browse repository at this point
Copy the full SHA 9aa7a61View commit details
Commits on Nov 22, 2016
-
Rewrite class during creation with supported slots
During the first creation of the loaded class with slots, a new class is inserted into the inheritance chain to ensure that the slot fields are defined. This is done because of the need to create an empty struct during the parsing phase and fill it in later - slots require the fields to be known before hand. All checks on the new replacement class will have it looking like the original except an equality comparison between the replaced class and its replacement. >>> import thriftpy >>> ab = thriftpy.load('addressbook.thrift', use_slots=True) >>> ab_inst = ab.AddressBook() >>> ab_inst.__class__ == ab.AddressBook # will return False >>> # all other checks should work as expected >>> isinstance(ab_inst, ab.AddressBook) # will return True >>> issubclass(ab_inst.__class__, ab.AddressBook) # will return True In order to get pickling to work as expected, a new extension type is registered with copyreg (copy_reg for py2x) to avoid pickling errors.
misakwa committedNov 22, 2016 Configuration menu - View commit details
-
Copy full SHA for 1a3b1bd - Browse repository at this point
Copy the full SHA 1a3b1bdView commit details -
misakwa committed
Nov 22, 2016 Configuration menu - View commit details
-
Copy full SHA for 4032763 - Browse repository at this point
Copy the full SHA 4032763View commit details -
misakwa committed
Nov 22, 2016 Configuration menu - View commit details
-
Copy full SHA for afd9acd - Browse repository at this point
Copy the full SHA afd9acdView commit details -
misakwa committed
Nov 22, 2016 Configuration menu - View commit details
-
Copy full SHA for 65292c7 - Browse repository at this point
Copy the full SHA 65292c7View commit details -
misakwa committed
Nov 22, 2016 Configuration menu - View commit details
-
Copy full SHA for 632c88e - Browse repository at this point
Copy the full SHA 632c88eView commit details -
misakwa committed
Nov 22, 2016 Configuration menu - View commit details
-
Copy full SHA for 682e191 - Browse repository at this point
Copy the full SHA 682e191View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.