Skip to content

RawPlutusData deepcopy error #224

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

Closed
juliusfrost opened this issue Apr 24, 2023 · 3 comments
Closed

RawPlutusData deepcopy error #224

juliusfrost opened this issue Apr 24, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@juliusfrost
Copy link
Contributor

Describe the bug

setattr(tmp_builder, f.name, deepcopy(getattr(self, f.name)))

During a deepcopy in the line above I get
TypeError: cannot pickle '_cbor2.CBORTag' object

This is because in my tx_builder one UTxO's datum is 'RawPlutusData(data=CBORTag(121, [1000]))'

To Reproduce

git clone https://github.com/OpShin/opshin-pioneer-program.git
git checkout 81e0400 
poetry install
poetry run python src/week06/tests/test_negative_r_timed.py

Logs
https://github.com/OpShin/opshin-pioneer-program/actions/runs/4780231723/jobs/8497846594

Expected behavior
Shouldn't pickle should work on CBORTag? It doesn't look like a very complex data type.

Environment and software version (please complete the following information):

  • OS: Windows/Linux
  • PyCardano Version: latest

Additional context
Part of OpShin/opshin-pioneer-program#43

@cffls
Copy link
Collaborator

cffls commented Apr 24, 2023

CBORTag couldn't be pickled by default:

import cbor2
a = cbor2.CBORTag(121, [1000])
import copy
copy.deepcopy(a)
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 1, in <module>
  File "/opt/homebrew/Cellar/[email protected]/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/copy.py", line 161, in deepcopy
TypeError: cannot pickle '_cbor2.CBORTag' object

I will check if there is a quick fix to it.

@cffls
Copy link
Collaborator

cffls commented Apr 24, 2023

This PR should be able to fix the problem: #225

@juliusfrost
Copy link
Contributor Author

This PR should be able to fix the problem: #225

Awesome, thanks!

@cffls cffls added the bug Something isn't working label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants