]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
fix warning for deprecated array.tostring
authorAlex Morega <alex@grep.ro>
Tue, 7 Jan 2014 06:16:16 +0000 (08:16 +0200)
committerAlex Morega <alex@grep.ro>
Tue, 7 Jan 2014 06:16:16 +0000 (08:16 +0200)
fixes #75

Makefile
babel/_compat.py
babel/messages/mofile.py

index 48120c6c5815bca7675ef3b5e7b9aa2a0169c314..5bb68a9a96c7a447970e3b23aea40dcc74e8aa26 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 test: import-cldr
-       @py.test
+       @PYTHONWARNINGS=default py.test
 
 test-env:
        @virtualenv test-env
index 86096daa6110cc73e4d54cf6da8242aebc5c761e..0f7640de1d5bb750652efddf735fae10d23afcbb 100644 (file)
@@ -1,4 +1,5 @@
 import sys
+import array
 
 PY2 = sys.version_info[0] == 2
 
@@ -26,6 +27,8 @@ if not PY2:
 
     cmp = lambda a, b: (a > b) - (a < b)
 
+    array_tobytes = array.array.tobytes
+
 else:
     text_type = unicode
     string_types = (str, unicode)
@@ -47,5 +50,7 @@ else:
 
     cmp = cmp
 
+    array_tobytes = array.array.tostring
+
 
 number_types = integer_types + (float,)
index 5dd20aee0325ff1ce07f030eb0b1e727f5274066..18503287b1301ba44006b39763ac564271758d08 100644 (file)
@@ -13,7 +13,7 @@ import array
 import struct
 
 from babel.messages.catalog import Catalog, Message
-from babel._compat import range_type
+from babel._compat import range_type, array_tobytes
 
 
 LE_MAGIC = 0x950412de
@@ -206,4 +206,4 @@ def write_mo(fileobj, catalog, use_fuzzy=False):
         7 * 4,                      # start of key index
         7 * 4 + len(messages) * 8,  # start of value index
         0, 0                        # size and offset of hash table
-    ) + array.array("i", offsets).tostring() + ids + strs)
+    ) + array_tobytes(array.array("i", offsets)) + ids + strs)