Page MenuHomeSoftware Heritage

Do not mutate swh.core.api.serializers.ENCODERS or DECODERS
ClosedPublic

Authored by olasd on Nov 24 2020, 1:00 PM.

Details

Summary

The previous implementation would always append extra_encoders to the main
ENCODERS list. Refactor encoder and decoder extensions both with a common getter
which doesn't mutate the global variable.

Test Plan

Added a tox test to check for the mutation

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D4572 (id=16250)

Rebasing onto f269e2d3d0...

Current branch diff-target is up to date.
Changes applied before test
commit 2c9ea80cab851dcacbd3047aad52afb14622bdac
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Tue Nov 24 12:50:47 2020 +0100

    Do not mutate swh.core.api.serializers.ENCODERS or DECODERS
    
    The previous implementation would always append extra_encoders to the main
    ENCODERS list. Refactor encoder and decoder extensions both with a common getter
    which doesn't mutate the global variable.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/168/ for more details.

anlambert added a subscriber: anlambert.

Subtle memory leak indeed, looks good to me.

This revision is now accepted and ready to land.Nov 24 2020, 1:13 PM