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
pickletools.optimize doesn't reframe correctly #63953
Comments
pickletools.optimize() can output arbitrarily large frames (much larger than then 64 KB heuristic). This may be annoying for memory use when pickling -- on the other hand if you keep the whole pickle in memory for optimize() perhaps it's not a problem keeping it in memory for load() :-) $ ./python -c "import pickle, pickletools; d = pickle.dumps(list(range(100000)), 4); pickletools.dis(d)" | head
0: \x80 PROTO 4
2: \x95 FRAME 65537
11: ] EMPTY_LIST
12: \x94 MEMOIZE
13: ( MARK
14: K BININT1 0
16: K BININT1 1
18: K BININT1 2
20: K BININT1 3
22: K BININT1 4
$ ./python -c "import pickle, pickletools; d = pickle.dumps(list(range(100000)), 4); pickletools.dis(pickletools.optimize(d))" | head
0: \x80 PROTO 4
2: \x95 FRAME 368875
11: ] EMPTY_LIST
12: \x94 MEMOIZE
13: ( MARK
14: K BININT1 0
16: K BININT1 1
18: K BININT1 2
20: K BININT1 3
22: K BININT1 4 |
This is not always true. You run optimize() on one computer or environment and load() on other. |
New changeset bb71baa28f1b by Alexandre Vassalotti in branch 'default': |
Now, pickletools.optimize doesn't do anything on protocol 4. :) |
New changeset 9feada79a411 by Alexandre Vassalotti in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: