[pygobject] docs: Skip implicit array length args when building function doc strings



commit 28a178e385e32c56910f1c430b370a8872218081
Author: Simon Feltman <sfeltman src gnome org>
Date:   Tue Dec 31 17:50:36 2013 -0800

    docs: Skip implicit array length args when building function doc strings
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697356

 gi/docstring.py         |    8 ++++++--
 tests/test_docstring.py |    4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gi/docstring.py b/gi/docstring.py
index 2aa2629..9b4f640 100644
--- a/gi/docstring.py
+++ b/gi/docstring.py
@@ -89,8 +89,12 @@ def _generate_callable_info_function_signature(info):
     # Build a lists of indices prior to adding the docs because
     # because it is possible the index retrieved comes before in
     # argument being used.
-    ignore_indices = set([arg.get_destroy() for arg in in_args])
-    user_data_indices = set([arg.get_closure() for arg in in_args])
+    ignore_indices = set()
+    user_data_indices = set()
+    for arg in in_args:
+        ignore_indices.add(arg.get_destroy())
+        ignore_indices.add(arg.get_type().get_array_length())
+        user_data_indices.add(arg.get_closure())
 
     for i, arg in enumerate(in_args):
         if i in ignore_indices:
diff --git a/tests/test_docstring.py b/tests/test_docstring.py
index 54349b8..2f176ff 100644
--- a/tests/test_docstring.py
+++ b/tests/test_docstring.py
@@ -57,3 +57,7 @@ class Test(unittest.TestCase):
                           'progress_callback_data=None)'
 
         self.assertEqual(Gio.File.copy.__doc__, g_file_copy_doc)
+
+    def test_array_length_arg(self):
+        self.assertEqual(GIMarshallingTests.array_in.__doc__,
+                         'array_in(ints:list)')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]