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

replace deepcopy with copy because of strange error "can't pickle gen… #60

Merged
merged 1 commit into from
Jan 22, 2017
Merged

replace deepcopy with copy because of strange error "can't pickle gen… #60

merged 1 commit into from
Jan 22, 2017

Conversation

pbiering
Copy link
Contributor

Looks like I've used the wrong copy method in my original pull request, causing big problems now on reading valid ICS files:

-> please apply this fix asap and rebase 0.9.4 if possible.

Sorry for that, please also extend selftesting capabilities by using e.g. code from
https://github.com/pbiering/Radicale/blob/pbiering-testing/radicale-storage-check.py
and feed one VCARD and one ICS into.

  File "/path/to/radicale-storage-check.py", line 48, in <module>
    item_ser = item.serialize()
  File "/usr/lib/python3.4/site-packages/vobject/base.py", line 254, in serialize
    return behavior.serialize(self, buf, lineLength, validate)
  File "/usr/lib/python3.4/site-packages/vobject/behavior.py", line 166, in serialize
    out = base.defaultSerialize(transformed, buf, lineLength)
  File "/usr/lib/python3.4/site-packages/vobject/base.py", line 1002, in defaultSerialize
    child.serialize(outbuf, lineLength, validate=False)
  File "/usr/lib/python3.4/site-packages/vobject/base.py", line 254, in serialize
    return behavior.serialize(self, buf, lineLength, validate)
  File "/usr/lib/python3.4/site-packages/vobject/behavior.py", line 168, in serialize
    obj.transformToNative()
  File "/usr/lib/python3.4/site-packages/vobject/base.py", line 183, in transformToNative
    self_orig = copy.deepcopy(self)
  File "/usr/lib64/python3.4/copy.py", line 182, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib64/python3.4/copy.py", line 300, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib64/python3.4/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/usr/lib64/python3.4/copy.py", line 246, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib64/python3.4/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/usr/lib64/python3.4/copy.py", line 246, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib64/python3.4/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/usr/lib64/python3.4/copy.py", line 219, in _deepcopy_list
    y.append(deepcopy(a, memo))
  File "/usr/lib64/python3.4/copy.py", line 182, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib64/python3.4/copy.py", line 300, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib64/python3.4/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/usr/lib64/python3.4/copy.py", line 246, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib64/python3.4/copy.py", line 182, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib64/python3.4/copy.py", line 294, in _reconstruct
    args = deepcopy(args, memo)
  File "/usr/lib64/python3.4/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/usr/lib64/python3.4/copy.py", line 226, in _deepcopy_tuple
    y.append(deepcopy(a, memo))
  File "/usr/lib64/python3.4/copy.py", line 182, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib64/python3.4/copy.py", line 300, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib64/python3.4/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/usr/lib64/python3.4/copy.py", line 246, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib64/python3.4/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/usr/lib64/python3.4/copy.py", line 219, in _deepcopy_list
    y.append(deepcopy(a, memo))
  File "/usr/lib64/python3.4/copy.py", line 182, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib64/python3.4/copy.py", line 300, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib64/python3.4/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/usr/lib64/python3.4/copy.py", line 246, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib64/python3.4/copy.py", line 182, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib64/python3.4/copy.py", line 300, in _reconstruct
    state = deepcopy(state, memo)
  File "/usr/lib64/python3.4/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/usr/lib64/python3.4/copy.py", line 246, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib64/python3.4/copy.py", line 174, in deepcopy
    rv = reductor(2)
TypeError: can't pickle generator objects

@pbiering
Copy link
Contributor Author

btw: an error test using the code extension is having an ICS with an invalid date, e.g.

DTSTART;TZID=Europe/Budapest:2016-03-01

resulting then in

vobject.base.ParseError: At line 12: In transformToNative, unhandled exception on line 12: <class 'ValueError'>: invalid literal for int() with base 10: '3-' (<DTSTART{'TZID': ['Europe/Budapest']}2016-03-01>)

(..) is appended

Once the original pull request was created, no good-case test was done afterwards with that particular code :-(

@pbiering
Copy link
Contributor Author

@wpercy wpercy merged commit d4f98fe into skarim:master Jan 22, 2017
@wpercy
Copy link
Contributor

wpercy commented Jan 22, 2017

@pbiering would you be willing to write a test for this?

@pbiering
Copy link
Contributor Author

I can write a test if one point me which test code must be extended, is it test.py?

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.

2 participants