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

dill_bugs breaks in pypy on save_wrapper_descriptor #175

Closed
mmckerns opened this issue Jun 30, 2016 · 12 comments
Closed

dill_bugs breaks in pypy on save_wrapper_descriptor #175

mmckerns opened this issue Jun 30, 2016 · 12 comments
Labels
Milestone

Comments

@mmckerns
Copy link
Member

As reported by @Peque:

$ pypy tests/dill_bugs.py 
True: <type 'str'>, __main__
True: <type 'function'>, <function _method at 0x0000000002534ea8>
Traceback (most recent call last):
  File "tests/dill_bugs.py", line 42, in <module>
    print ("%s: %s, %s" % (dill.pickles(i), type(i), i))
  File "/media/src/dill/dill/dill.py", line 1304, in pickles
    pik = copy(obj, **kwds)
  File "/media/src/dill/dill/dill.py", line 206, in copy
    return loads(dumps(obj, *args, **kwds))
  File "/media/src/dill/dill/dill.py", line 256, in dumps
    dump(obj, file, protocol, byref, fmode, recurse)#, strictio)
  File "/media/src/dill/dill/dill.py", line 249, in dump
    pik.dump(obj)
  File "/usr/lib64/pypy-4.0.1/lib-python/2.7/pickle.py", line 224, in dump
    self.save(obj)
  File "/usr/lib64/pypy-4.0.1/lib-python/2.7/pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "/media/src/dill/dill/dill.py", line 1008, in save_wrapper_descriptor
    pickler.save_reduce(_getattr, (obj.__objclass__, obj.__name__,
AttributeError: generic property has no __objclass__
@Peque
Copy link
Contributor

Peque commented Dec 14, 2016

Hi Mike, is there any update on this matter? 😇

@mmckerns
Copy link
Member Author

@Peque: if there were, I'd update this ticket. I believe this is all that is needed for you to have the compatibility you want, but I have not had time to resolve this issue with the wrapper_descriptor just yet.

@Peque
Copy link
Contributor

Peque commented Dec 20, 2016

@mmckerns I understand. Thanks a lot for taking the time to reply anyway! 😊

@mmckerns
Copy link
Member Author

I have opened a ticket on pypy at: https://bitbucket.org/pypy/pypy/issues/2464/getset_descriptor-cannot-access

@mmckerns
Copy link
Member Author

There's now a patch for this in pypy. After some testing against the latest pypy, I think this should be able to be closed.

@mmckerns
Copy link
Member Author

While it seems the current patch fixes the issue for some cases, it doesn't work in all cases. Also, there's an error in the pickling that is produced when the descriptors are a weakref. I'm punting the discussion to the pypy ticket until it's better suited to come back here.

@mmckerns
Copy link
Member Author

mmckerns commented Jan 14, 2017

While testing with the latest pypy (with the patch applied), I've found some other issues for pypy compatibility and fixed them in de597c5. Looks like now only the remaining issue is that descriptors for built-ins in pypy don't have an __objclass__ attribute - -and that would require a change to pypy. Otherwise, I don't see any further issues.

@mmckerns
Copy link
Member Author

Another iteration with pypy. With, 5aa2636, looks like only the descriptor for __doc__ is missing the __objclass__ attribute. When this is patched in pypy, then I think this ticket can close.

@Peque
Copy link
Contributor

Peque commented Jan 16, 2017

Great news. I am subscribed to the Bitbucket's issue, following your discussion. 👍

@mmckerns
Copy link
Member Author

I'm closing this, as it is fixed in the pypy nightly builds… and should roll into latest release soon enough.

mmckerns added a commit that referenced this issue Jan 17, 2017
git-svn-id: svn+ssh://svn.mystic.cacr.caltech.edu/pathos/dill@940 8bfda07e-5b16-0410-ab1d-fd04ec2748df
@mmckerns mmckerns modified the milestone: dill-0.2.6 Feb 1, 2017
@irmen
Copy link

irmen commented Feb 9, 2017

By the way it looks like the recent dill release fixed the problems I was having with Pyro4 where it didn't work on pypy. Somehow I didn't even have to install the latest pypy nightly with the fixes on their end.

@mmckerns
Copy link
Member Author

@irmen: I had some iterations with the pypy developers. pypy and dill both made some tweaks that have hopefully "solved the problem". I expect you may encounter a case that fails until the pypy release it out -- but maybe you won't, and that will be even better.

troyharvey added a commit to brstrat/dill that referenced this issue Jun 15, 2017
* tag '0.2.6': (71 commits)
  release dill-0.2.6
  fix: use correct pickler for arrays in other objects (see uqfoundation#163)
  fix: make a copy of result from vars so doesn't pollute globals (see uqfoundation#167)
  revert scripts to use .py extension (primarily for windows)
  don't use .py extension for scripts; edit MANIFEST accordingly
  completely handle namedtuple pickling
  Add fallback option for badly named namedtuples
  remove .py extension from scripts (see uqfoundation#189)
  fix bug so obj class can point to main
  allow for rare case where module's name attribute has been deleted
  remove workaround required for oddity in pypy __doc__ descriptor __name__
  changes for issue uqfoundation#175, including workaround for pypy __doc__ descriptor
  check for dictproxy in _getattr
  added ClassMethodDescriptorType to dill.objects and register it in dill.dill; modified special handling in _getattr for __prepare__ and __weakref__; fix _create_function when obj.__globals__ is None; modified test_detect and test_selected to reflect the above
  use sys.hexversion not dill.PY3 for __qualname__ condition in namedtuple test
  updated test_classdef so rename of namedtuple uses __qualname__
  convert test_detect and test_diff for pytest
  prepare test_module, test_moduledict, test_source, test_temp for pytest move dill_bugs to test_selected; prepare test_selected for pytest
  update test_classdef as pytest compatible
  Remove pytest dependency and fix test teardown
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants