[5.0.14] safe_eval() incompatible with python2.7's bytecode

Bug #644267 reported by Mariusz Mazur
30
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Medium
OpenERP Publisher's Warranty Team

Bug Description

openerp-server 5.0.14 when run on python 2.7 is basically useless (when using addons), due to the changes in low-level python 2.7 opcodes. The safe_eval() function in bin/tools/safe_eval.py doesn't expect the new opcodes and fails on virtually every operation. The attached patch adds the four missing py2.7 opcodes to safe_eval and fixes the problem.

Tags: maintenance
Revision history for this message
Mariusz Mazur (mmazur-pld) wrote :
Changed in openobject-server:
importance: Undecided → Medium
Revision history for this message
Jean-Luc WEYL (jean-luc-weyl) wrote :

This is not the only problem with that new safe_eval function.

If you use "filter" in a .rml file to produce a report, like for example:
  [[ repeatIn( filter( lambda a: not a.is_phantom, o.order_line) , 'line') ]]

you have the following error:
  File "/home/weyl/openerp-server-5.0.14/bin/tools/safe_eval.py", line 272, in safe_eval
    return eval(test_expr(expr,_SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
NameError: name 'filter' is not defined

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

There are more of such opcodes missing, [[ some_string[2:] ]] wont work either: https://bugs.launchpad.net/bugs/662493

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

We need to backport the various improvements made on safe_eval in trunk to support these cases as well as Python 2.7, this is all fixed in trunk.

Changed in openobject-server:
assignee: nobody → Jay (OpenERP) (jvo-openerp)
milestone: none → 5.0.16
status: New → Confirmed
summary: - safe_eval() incompatible with python2.7's bytecode
+ [5.0.14] safe_eval() incompatible with python2.7's bytecode
tags: added: maintenance
Changed in openobject-server:
status: Confirmed → In Progress
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

I just want to confirm you that this patch here at least works :

https://launchpadlibrarian.net/57944780/safe_eval.patch

Thanks !

Changed in openobject-server:
assignee: Jay Vora (OpenERP) (jvo-openerp) → OpenERP Publisher's Warranty Team (openerp-opw)
Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

The Patch provided by Joel has been(not the complete patch, but the bug actually gets fixed) applied by Olivier dony at https://bugs.launchpad.net/openobject-server/+bug/673773 in version 5 as well.

Faced a similar one while my local code was not updated, pulling the code made me sure that it has been fixed by revisions:
http://bazaar.launchpad.net/~openerp/openobject-server/5.0/revision/2111 AND
http://bazaar.launchpad.net/~openerp/openobject-server/5.0/revision/2144

Hence, this bug should end as released (keeping in mind the fact that the version 5.0.16 has been released by revision 2173 - http://bazaar.launchpad.net/~openerp/openobject-server/5.0/revision/2173 )

Thanks,
Serpent Consulting Services.

Changed in openobject-server:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.