davidhewitt / pythonize

MIT License
198 stars 28 forks source link

Using pythonize for an enum with values #29

Closed cisaacson closed 1 year ago

cisaacson commented 1 year ago

I want to use pythonize to convert an enum we have, which is decorated with Serialize, Deserialize. The enum contains many types, some are structs, others are String or numeric types (there are over 20 of them). I used the example as-is and it says that acquire_gil is deprecated. I tried doing this using with_gil and it returns Py<PyAny>> and I just need a PyAny value. I tried various combinations but no luck.

Any advice on how to do this would be much appreciated. I will post this in pyo3 as well.

Great library by the way, overall pyo3 has been very easy to use.

cisaacson commented 1 year ago

I got an answer on the pyo3 project. We are returning Py<PyAny>> and it works as we expect, because in Rust we deserialize each type.