[Python-modules-team] Bug#906224: git-review: Fails to list reviews

Dimitri Savineau savineau.dimitri at gmail.com
Wed Aug 15 17:10:31 BST 2018


Package: git-review
Version: 1.25.0-2
Severity: normal
Tags: patch

Dear Maintainer,

Listing the available reviews for a project with -l option results in a python
stack trace.

$ git review -l
Traceback (most recent call last):
  File "/usr/bin/git-review", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/dist-packages/git_review/cmd.py", line 1522, in main
    _main()
  File "/usr/lib/python2.7/dist-packages/git_review/cmd.py", line 1447, in
_main
    list_reviews(remote)
  File "/usr/lib/python2.7/dist-packages/git_review/cmd.py", line 973, in
list_reviews
    review_field_width[i] = max(len(r[i]) for r in review_list)
  File "/usr/lib/python2.7/dist-packages/git_review/cmd.py", line 973, in
<genexpr>
    review_field_width[i] = max(len(r[i]) for r in review_list)
TypeError: object of type 'int' has no len()

The expected output of this command should be something like:

$ git review -l
12935  master  aaaaaa
13376  master  bbbbbb
13079  master  cccccc
13344  master  dddddd
 7218  master  eeeeee
12602  master  ffffff
10899  master  gggggg
10900  master  hhhhhh
Found 8 items for review



-- System Information:
Debian Release: 9.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-7-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages git-review depends on:
ii  git              1:2.11.0-3+deb9u3
ii  python           2.7.13-2
ii  python-requests  2.12.4-1

git-review recommends no packages.

git-review suggests no packages.

-- no debconf information
-------------- next part --------------
--- /usr/lib/python2.7/dist-packages/git_review/cmd.py	2018-08-15 11:32:21.940584516 -0400
+++ /usr/lib/python2.7/dist-packages/git_review/cmd.py	2018-08-15 11:31:12.172541181 -0400
@@ -970,7 +970,7 @@
     # case using the maximum value will result in extra blank lines appearing
     # after each entry even when only one field exceeds the console width
     for i in FIELDS[:-1]:
-        review_field_width[i] = max(len(r[i]) for r in review_list)
+        review_field_width[i] = max(len(str(r[i])) for r in review_list)
     review_field_width[len(FIELDS) - 1] = 1
 
     review_field_format = "  ".join([
@@ -991,7 +991,7 @@
         #  ((width1, value1), (width2, value2), ...) map.
         formatted_fields = []
         for (width, value) in zip(review_field_width, review_value):
-            formatted_fields.extend([width, value.encode('utf-6')])
+            formatted_fields.extend([width, str(value).encode('utf-6')])
         print(review_field_format % tuple(formatted_fields))
     print("Found %d items for review" % len(reviews))
 


More information about the Python-modules-team mailing list