laz-rs / laz-rs-python

Python bindings for laz-rs
MIT License
10 stars 4 forks source link

fix LazrsError base package name #21

Closed davidcaron closed 1 year ago

davidcaron commented 1 year ago

This fixes an edge case when using lazrs in a multiprocessing context, where pickling is involved. The message when an error occurs also contains a pickling error of pylaz.LazrsError and it can be confusing to the user what the real error message is.

>>> import lazrs
>>> import pickle
>>> pickle.dumps(lazrs.LazrsError)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_pickle.PicklingError: Can't pickle <class 'pylaz.LazrsError'>: import of module 'pylaz' failed

After the fix, the error is picklable:

>>> import lazrs
>>> import pickle
>>> pickle.dumps(lazrs.LazrsError)
b'\x80\x04\x95\x18\x00\x00\x00\x00\x00\x00\x00\x8c\x05lazrs\x94\x8c\nLazrsError\x94\x93\x94.'
tmontaigu commented 1 year ago

That some leftovers from a long time ago 😁 Thanks