You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from pony.orm import (
Database,
Required,
Set,
Optional,
PrimaryKey,
set_sql_debug,
commit,
)
import pony.orm as pny
db = Database()
db.bind(provider="sqlite", filename=":memory:")
class Metric(db.Entity):
id = PrimaryKey(int, auto=True)
spec = Required(str)
name = Optional(str, nullable=True)
db.generate_mapping(create_tables=True)
with pny.db_session:
m1 = Metric(spec="MetricSpec1")
commit()
ident_value = "key"
query_req = pny.select(
(m.id, m.name, m.spec)
for m in Metric
if m.name == ident_value or m.name is None
)
Output:
Traceback (most recent call last):
File "/app/pony_bug.py", line 30, in
query_req = pny.select(
^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/pony/orm/core.py", line 5560, in select
return make_query(args, frame_depth=cut_traceback_depth+1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/pony/orm/core.py", line 5546, in make_query
tree, external_names, cells = decompile(gen)
^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/pony/orm/decompiling.py", line 43, in decompile
decompiler = Decompiler(codeobject)
^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/pony/orm/decompiling.py", line 162, in init
decompiler.decompile()
File "/app/.venv/lib/python3.12/site-packages/pony/orm/decompiling.py", line 313, in decompile
throw(DecompileError('Unsupported operation: %s' % opname))
File "/app/.venv/lib/python3.12/site-packages/pony/utils/utils.py", line 99, in throw
raise exc
pony.orm.decompiling.DecompileError: Unsupported operation: POP_JUMP_IF_NOT_NONE
The text was updated successfully, but these errors were encountered:
I've encountered this issue, too. Worked around it with if/else, thereby doubling the queries.
Thanks @cam-mh for this workaround!
But I think the devs should take a closer look on this despite. Seems no one cared so far. :/
Seems those two instructions (POP_JUMP_IF_NONE/POP_JUMP_IF_NOT_NONE) are not/not correctly handled in decompiling.py
Script Example on Python 3.12 and ponyorm 0.7.19:
Output:
The text was updated successfully, but these errors were encountered: