[Python-modules-team] Bug#934271: python-tablib: newer pyyaml changes default_flow_style

Mathieu Trudel-Lapierre cyphermox at ubuntu.com
Thu Aug 8 23:15:55 BST 2019


Package: python-tablib
Version: 0.12.1-3
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu eoan ubuntu-patch

Dear Maintainer,

default_flow_style=None changed to default_flow_style=False by default
in pyyaml 5.1 [1].

I wrote the following pretty heavy-handed patch to address the situation
and maintain previous behavior, though you might want to change the tests
instead and follow the changes made upstream.

[1] https://github.com/yaml/pyyaml/issues/265


*** /tmp/tmpU9xam4/bug_body

In Ubuntu, the attached patch was applied to achieve the following:

  * debian/patches/fix_pyyaml_default_flow_style.patch: Make sure all calls
    to yaml.dump() include default_flow_style=None, to retain previous behavior
    that is checked for in tests, unless it's already otherwise specified.


Thanks for considering the patch.


-- System Information:
Debian Release: buster/sid
  APT prefers eoan
  APT policy: (500, 'eoan')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.0-8-generic (SMP w/4 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru python-tablib-0.12.1/debian/patches/fix_pyyaml_default_flow_style.patch python-tablib-0.12.1/debian/patches/fix_pyyaml_default_flow_style.patch
--- python-tablib-0.12.1/debian/patches/fix_pyyaml_default_flow_style.patch	1969-12-31 19:00:00.000000000 -0500
+++ python-tablib-0.12.1/debian/patches/fix_pyyaml_default_flow_style.patch	2019-08-08 18:06:41.000000000 -0400
@@ -0,0 +1,30 @@
+From: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre at canonical.com>
+Subject: Force yaml.dump() calls to specify default_flow_style=None
+
+default_flow_style changed to False by default, which actually changes
+the output format. Make sure we retain the previous behavior expected
+by the tests.
+
+cf. https://github.com/yaml/pyyaml/issues/265
+
+Index: python-tablib-0.12.1/tablib/formats/_yaml.py
+===================================================================
+--- python-tablib-0.12.1.orig/tablib/formats/_yaml.py
++++ python-tablib-0.12.1/tablib/formats/_yaml.py
+@@ -13,12 +13,14 @@ extensions = ('yaml', 'yml')
+ def export_set(dataset):
+     """Returns YAML representation of Dataset."""
+ 
+-    return yaml.safe_dump(dataset._package(ordered=False))
++    return yaml.safe_dump(dataset._package(ordered=False),
++                          default_flow_style=None)
+ 
+ 
+ def export_book(databook):
+     """Returns YAML representation of Databook."""
+-    return yaml.safe_dump(databook._package(ordered=False))
++    return yaml.safe_dump(databook._package(ordered=False),
++                          default_flow_style=None)
+ 
+ 
+ def import_set(dset, in_stream):
diff -Nru python-tablib-0.12.1/debian/patches/series python-tablib-0.12.1/debian/patches/series
--- python-tablib-0.12.1/debian/patches/series	1969-12-31 19:00:00.000000000 -0500
+++ python-tablib-0.12.1/debian/patches/series	2019-08-08 18:05:44.000000000 -0400
@@ -0,0 +1 @@
+fix_pyyaml_default_flow_style.patch


More information about the Python-modules-team mailing list