Re: Pickle in C does not work

2020-10-20 Thread Serhiy Storchaka
20.10.20 17:12, Marco Sulla пише: > On Tue, 20 Oct 2020 at 16:07, Serhiy Storchaka wrote: >> You can use PyDict_New() + PyDict_Merge() to create a dict from your >> mapping. > Well, yes, I know. I just wrote it for simplicity now. Do you think this is > the problem? I think that it can be more pe

Re: Pickle in C does not work

2020-10-20 Thread Marco Sulla
On Tue, 20 Oct 2020 at 16:12, Marco Sulla wrote: > tp_name of your class should include the module name. >> > > It will be done :-) > It was the name... Thank you a lot! -- https://mail.python.org/mailman/listinfo/python-list

Re: Pickle in C does not work

2020-10-20 Thread Marco Sulla
On Tue, 20 Oct 2020 at 16:07, Serhiy Storchaka wrote: > You can use PyDict_New() + PyDict_Merge() to create a dict from your > mapping. > Well, yes, I know. I just wrote it for simplicity now. Do you think this is the problem? I forgot to say that copy and deepcopy works. For what I know, they u

Re: Pickle in C does not work

2020-10-20 Thread Serhiy Storchaka
20.10.20 01:28, Marco Sulla пише: > PyObject *d = PyObject_Call((PyObject *)&PyDict_Type, args, NULL); You can use PyDict_New() + PyDict_Merge() to create a dict from your mapping. > but I get: > _pickle.PicklingError: Can't pickle : attribute lookup > frozendict on builtins failed tp_name o

Pickle in C does not work

2020-10-19 Thread Marco Sulla
I tried this code: static PyObject * frozendict_reduce(PyFrozenDictObject* mp, PyObject *Py_UNUSED(ignored)) { PyObject* args = PyTuple_New(1); if (args == NULL) { return NULL; } PyTuple_SET_ITEM(args, 0, (PyObject *)mp); PyObject *d = PyObject_Call((PyObject *)&PyDi