ponyorm / pony

Pony Object Relational Mapper
Apache License 2.0
3.66k stars 245 forks source link

Compatibility with Python 3.13 #729

Open commongeek opened 1 month ago

commongeek commented 1 month ago

I use PonyPRM with Python 3.12 on Windows without problem. However after upgrading to 3.13 I got the following error:

File "C:\Users\Administrator\Python313\Lib\site-packages\pony\orm\core.py", line 3578, in select query = reverse.entity._select_all() File "C:\Users\Administrator\Python313\Lib\site-packages\pony\orm\core.py", line 4371, in _select_all return Query(entity._default_itername, entity._defaultgenexpr, {}, { '.0' : entity }) File "C:\Users\Administrator\Python313\Lib\site-packages\pony\orm\core.py", line 5713, in init pickled_tree = pickle_ast(tree) File "C:\Users\Administrator\Python313\Lib\site-packages\pony\utils\utils.py", line 383, in pickle_ast pickler.persistent_id = _persistent_id ^^^^^^^^^^^^^^^^^^^^^ AttributeError: '_pickle.Pickler' object attribute 'persistent_id' is read-only

black-sliver commented 1 month ago

Since 3.13, that method is defined in C, which means we have to subclass the Pickler rather than assigning to the member.

I believe there are other, more complicated problems for py3.13 support tough. I plan to try and implement py3.13 support hopefully later this year if there is no update from the original devs.