On Thu, Apr 02, 2015 at 12:03:40PM -0700, Steve Beattie wrote:
> > The difference is this:
> >
> > $ python2.7 -c "print(len(' ')/2)"
> > 1
> > $ python3 -c "print(len(' ')/2)"
> > 1.5Argh. I still can't believe that made it into a relese.. > So importing division from __future__ gives floating point division > by default in python 2.7, to match the behavior of division in python3. > Adding it to apparmor/aa.py lets the tests that were failing only under > python 2.7 pass, but I'm a little leery of adding it, as grepping for > division in aa.py gives at least: > > data += write_methods[segs](prof_data, int(depth / 2)) > data += write_header(write_prof_data[name], int(depth > / 2), name, False, include_flags) > depth = int(len(line) - len(line.lstrip()) / 2) + 1 > depth = int((len(line) - len(line.lstrip())) / 2) > > so I'm concerned we'd be introducing other changes by doing > so... though getting consistent behavior across python2 and python3 > would be a benefit, I'd say. It looks like those other cases are prepared for it, the int() wrappers look like they are bringing back the usual truncation on division. I think importing division from future makes sense here. Thanks
signature.asc
Description: Digital signature
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
