uqfoundation/dill

dill can't serialize classmethod packaged with cython

Opened this issue · 0 comments

I create a class like

class Fly:   
    @classmethod
    def say(cls):
         print("hello world")

it's saved in tool.py file and placed under tt directory
package it with cython and will get .so file

The test code is here

from tt.tool import Fly
from pathos.pools import  _ProcessPool as Pool
def f(c):
    c()

pool = Pool(1)
t = pool.apply_async(func=f, args=(Fly.say,))
t.get()

this will generate exception
can't pickle <cyfunction xxxx>: it's not the same object as xxx

I have tried pickle and it can deal with this scenario, can it be solved in dill?