Comments (4)
Hmm… that looks like it could be an oversight. I don't usually extend dill
with the Pickler and Unpickler, so that code's not as strongly tested there. Tell you what… why don't make a pull request and I'll review it? It'd be especially nice if you show how it fixes a simple issue for you. If you don't want to do that, then I'll patch it and write the tests -- but I'd like you to have first crack at it, since it's your patch.
from dill.
The following is a test program that should work:
import dill
import StringIO
def my_fn(x):
return x * 17
obj = lambda : my_fn(34)
print 'obj() returns %d' % obj()
obj_io = StringIO.StringIO()
pickler = dill.Pickler(obj_io)
pickler.dump(obj)
obj_str = obj_io.getvalue()
print 'obj() pickled to %d bytes' % len(obj_str)
obj2_io = StringIO.StringIO(obj_str)
unpickler = dill.Unpickler(obj2_io)
obj2 = unpickler.load()
print 'obj2() returns %d' % obj2()
An associate of mine is preparing a minimal pull request. If that looks like it's heading in the right direction, I think that a couple of things could be cleaned up to simplify things. I suggest we get something working first. Then we submit a second pull request with additional suggestions that I think (but am not 100% sure) would be good for the code.
from dill.
@citibob: sounds good. Thanks for the follow-up.
The procedure is as you have posed… a minimal pull request for pull request for a patch… and additional pull requests for additional features. The more atomic, the easier to merge, the less likely that a merge affects others negatively and is off scope, and thus is more likely to get in.
from dill.
closed by merging #24.
from dill.
Related Issues (20)
- Class attributes changes at load if the object is in a list or tuple. HOT 1
- nan type drift for np.nan HOT 3
- dill.source.findsource fails when in asyncio REPL
- `save_function()` can't save function in a submodule that has the same name as an attribute of the parent module HOT 2
- bytes length not a multiple of item size
- dill.source.getsource returns decorated function instead of function HOT 2
- 0.3.7 incorrectly pickles the class definition for module/class with the same name HOT 7
- Exception: --- Logging error --- HOT 3
- Use dump_module() in jupyter notebook with remote kernel HOT 1
- UnpicklingError using dill but not stdlib pickle HOT 2
- Compatibility with Pyodide HOT 6
- tfp.math.psd_kernels.ExponentiatedQuadratic no longer serialiases with latest versions
- `dill.load_session()` raises `NameError: name 'UnpicklingError' is not defined` HOT 5
- pydantic>=2.5 classes can't be serialized HOT 4
- Failure to load dumped partial function (in older python) properly (in newer python)
- threading.Thread fails to pickle in python > 3.13.0a5 HOT 4
- Error with typing.AbstractContextManager in Python 3.8 and newer dill versions (>=0.3.6) HOT 1
- File gets truncated upon unpickling
- PyTorch C++-generated module "not found as" itself? HOT 1
- Importing dill changes the python pickler behavior HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dill.