Rev 2223: Fix test failures under 'python2.4 -O' ('python2.5 -O' was already passing). in sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

Andrew Bennetts andrew.bennetts at canonical.com
Mon Apr 16 06:53:50 BST 2007


At sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

------------------------------------------------------------
revno: 2223
revision-id: andrew.bennetts at canonical.com-20070416055251-imntu6k33rni8h4o
parent: andrew.bennetts at canonical.com-20070416042411-6itr5e3kuqwpm65y
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: hpss
timestamp: Mon 2007-04-16 15:52:51 +1000
message:
  Fix test failures under 'python2.4 -O' ('python2.5 -O' was already passing).
modified:
  bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2007-04-13 05:48:30 +0000
+++ b/bzrlib/transport/__init__.py	2007-04-16 05:52:51 +0000
@@ -618,8 +618,9 @@
         :param mode: Create the file with the given mode.
         :return: None
         """
-        assert isinstance(bytes, str), \
-            'bytes must be a plain string, not %s' % type(bytes)
+        if not isinstance(bytes, str):
+            raise AssertionError(
+                'bytes must be a plain string, not %s' % type(bytes))
         return self.put_file(relpath, StringIO(bytes), mode=mode)
 
     def put_bytes_non_atomic(self, relpath, bytes, mode=None,
@@ -640,8 +641,9 @@
                         create it, and then try again.
         :param dir_mode: Possible access permissions for new directories.
         """
-        assert isinstance(bytes, str), \
-            'bytes must be a plain string, not %s' % type(bytes)
+        if not isinstance(bytes, str):
+            raise AssertionError(
+                'bytes must be a plain string, not %s' % type(bytes))
         self.put_file_non_atomic(relpath, StringIO(bytes), mode=mode,
                                  create_parent_dir=create_parent_dir,
                                  dir_mode=dir_mode)




More information about the bazaar-commits mailing list