Use six.moves.reduce instead of builtin reduce

Bug #1530249 reported by HouMing Wang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Ankit Agrawal
Glance
Fix Released
Undecided
HouMing Wang

Bug Description

Builtin function 'reduce' in Python 2 has been moved to standard
library module in Python 3 [1]. To make code compatible, we should
replace reduce(expr) with six.moves.reduce(expr)

[1] http://python3porting.com/stdlib.html#moved-builtins

Changed in glance:
assignee: nobody → HouMing Wang (houming-wang)
Changed in glance:
status: New → In Progress
LiuNanke (nanke-liu)
Changed in cinder:
assignee: nobody → LiuNanke (nanke-liu)
status: New → In Progress
Changed in cinder:
status: In Progress → Invalid
LiuNanke (nanke-liu)
no longer affects: cinder
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/262523
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=9ae3d53a8df4979e28eb49cc752ee5b7cd087f09
Submitter: Jenkins
Branch: master

commit 9ae3d53a8df4979e28eb49cc752ee5b7cd087f09
Author: houming-wang <email address hidden>
Date: Wed Dec 30 08:55:30 2015 -0500

    Use six.moves.reduce instead of builtin reduce

    Builtin function 'reduce' in Python 2 has been moved to standard
    library module in Python 3 [1]. To make code compatible, we should
    replace reduce(expr) with six.moves.reduce(expr)

    [1] http://python3porting.com/stdlib.html#moved-builtins

    Change-Id: Idca3420918471c41548a871d043fafc983aa7ee6
    Closes-Bug: #1530249

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
Ankit Agrawal (ankitagrawal) wrote :
Changed in cinder:
assignee: nobody → Ankit Agrawal (ankitagrawal)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/268059
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=9cc2b79301d73929c6f673b4314950b8e0013a70
Submitter: Jenkins
Branch: master

commit 9cc2b79301d73929c6f673b4314950b8e0013a70
Author: Ankit Agrawal <email address hidden>
Date: Fri Jan 15 01:56:56 2016 -0800

    Python 3: Replace reduce and xrange with six.moves

    1. Builtin function 'reduce' in Python 2 has been moved to standard
    library module in Python 3 [1]. To make code compatible, replaced
    reduce(expr) with six.moves.reduce(expr).
    2. xrange is renamed to range in Python 3, replaced it with
    six.moves.range
    3. Added __bool__() method in FeatureState class to make it python 3
    compatible because Python 3 calls the __bool__() method instead of
    __nonzero__ when evaluating an instance in a boolean context.
    4. Added this test case to tests-py3.txt.

    [1] http://python3porting.com/stdlib.html#moved-builtins

    Closes-Bug: 1530249
    Change-Id: I376cd643b9f58358a3e147532dafe77a7325a114

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/glance 12.0.0.0b2

This issue was fixed in the openstack/glance 12.0.0.0b2 development milestone.

Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/cinder 8.0.0.0b2

This issue was fixed in the openstack/cinder 8.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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