According to
http://www.graphicsmagick.org/api/attribute.html#setimageattribute
special handling for EXIF:Orientation has been introduced in
http://hg.code.sf.net/p/graphicsmagick/code/rev/90be78bb60fb
> The new EXIF:Orientation attribute replaces the existing value rather
than being concatenated to it as when setting other attributes.
I have reproduced exactly same behaviour for GM core C API with current
stable from upstream, the problem is resolved in latest developments
snapshot from (1.4-020170315). AFAIK no additional change is needed in
python-pgmagick or libgraphicsmagick++.