subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From futat...@apache.org
Subject svn commit: r1871827 - /subversion/trunk/subversion/bindings/swig/python/tests/client.py
Date Thu, 19 Dec 2019 20:51:31 GMT
Author: futatuki
Date: Thu Dec 19 20:51:31 2019
New Revision: 1871827

URL: http://svn.apache.org/viewvc?rev=1871827&view=rev
Log:
Fix pool life time bug on test_log5_revprops test case in swig-py.

* subversion/bindings/swig/python/tests/client.py
 (SubversionClientTestCase.log_entry_receiver_whole): Moved to the scope
   within SubversionClientTestCase.test_log5_revprops as local function.
 (SubversionClientTestCase.test_log5_revprops):
  - Use local function log_entry_receiver_whole as receiver argument
    instead of SubversionClientTestCase.log_entry_receiver_whole.
  - Make a pool for log_entry used by child function log_entry_receiver_whole
 (SubversionClientTestCase.test_log5_revprops log_entry_receiver_whole):
  - Moved from SubversionClientTestCase.log_entry_receiver_whole.
  - Duplicate log_entry object to bring it out of the function scope
    by using pool on parent scope.

Found by: stsp

Modified:
    subversion/trunk/subversion/bindings/swig/python/tests/client.py

Modified: subversion/trunk/subversion/bindings/swig/python/tests/client.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/python/tests/client.py?rev=1871827&r1=1871826&r2=1871827&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/python/tests/client.py (original)
+++ subversion/trunk/subversion/bindings/swig/python/tests/client.py Thu Dec 19 20:51:31 2019
@@ -58,10 +58,6 @@ class SubversionClientTestCase(unittest.
     """An implementation of svn_log_entry_receiver_t."""
     self.received_revisions.append(log_entry.revision)
 
-  def log_entry_receiver_whole(self, log_entry, pool):
-    """An implementation of svn_log_entry_receiver_t, holds whole log entries."""
-    self.received_log_entries.append(log_entry)
-
   def setUp(self):
     """Set up authentication and client context"""
     self.client_ctx = client.svn_client_create_context()
@@ -287,13 +283,19 @@ class SubversionClientTestCase(unittest.
     rev_range = core.svn_opt_revision_range_t()
     rev_range.start = start
     rev_range.end = end
+    entry_pool = core.Pool()
+
+    def log_entry_receiver_whole(log_entry, pool):
+      """An implementation of svn_log_entry_receiver_t, holds whole log entries."""
+      self.received_log_entries.append(core.svn_log_entry_dup(log_entry,
+                                                              entry_pool))
 
     self.received_log_entries = []
 
     # (Python 3: pass tuple of bytes and str mixture as revprops argment)
     client.log5((directory,), start, (rev_range,), 1, True, False, False,
                 ('svn:author', b'svn:log'),
-                self.log_entry_receiver_whole, self.client_ctx)
+                log_entry_receiver_whole, self.client_ctx)
     self.assertEqual(len(self.received_log_entries), 1)
     revprops = self.received_log_entries[0].revprops
     self.assertEqual(revprops[b'svn:log'], b"More directories.")
@@ -303,7 +305,7 @@ class SubversionClientTestCase(unittest.
     with self.assertRaises(UnicodeEncodeError):
       client.log5((directory,), start, (rev_range,), 1, True, False, False,
                   (u'svn:\udc61uthor', b'svn:log'),
-                  self.log_entry_receiver_whole, self.client_ctx)
+                  log_entry_receiver_whole, self.client_ctx)
 
   def test_uuid_from_url(self):
     """Test svn_client_uuid_from_url on a file:// URL"""



Mime
View raw message