cloudpipe / cloudpipe/cloudpickle

Dill breaks cloudpickle > 1.3.0 on inner functions with closure

Aperta
#393 7 commenti 0 reazioni 1 assegnatario Rivendicata da @pierreglaser Vedi su GitHub
Lingua principale
Python
Stelle
1.9k
Fork
197
Merge medio
1g 10h
PR unite (30g)
1

Descrizione

Cloudpickle 1.5.0, dill 0.3.2 or 0.3.1.1:

```python
import dill
import cloudpickle

class Foo:

def bar(self, param: int):
hello = "Hello"
def baz() -> None:
print(hello, param)

cloudpickle.loads(cloudpickle.dumps(baz))()

if __name__ == '__main__':
Foo().bar(param=2)
```

This fails with `ValueError: Cell is empty`.

Without the `dill` import, or with the dill import after the cloudpickle import, and it's all fine.

If the inner function is just
```python
def baz() -> None:
print("Hello world")
```
then it's also fine.

The problem seems to be if the inner function captures anything in its closure.

This was fine with cloudpickle 1.3.0

Should I bring this up with dill?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.