Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Regression on calling len() on GitlabList objects since switching to keyset pagination by default #1114

Closed
@Lucas-C

Description

@Lucas-C

Description of the problem, including code/CLI snippet

Pull request#1110 that has been released in v2.3.0 yesterday introduced a regression on a specific scenario:
when callinglen() on the output ofGitlab().projects.list(as_list=False).

Expected Behavior

Being able to calllen() on the iterator returned byGitlab().projects.list(as_list=False)

Actual Behavior

Minimal reproduction code:

importgitlablen(gitlab.Gitlab(...).projects.list(as_list=False))

Output:

Traceback (most recent call last):  File "test.py", line 3, in <module>    len(gitlab.Gitlab(...).projects.list(as_list=False))#, pagination='offset'))  File ".../lib/python3.7/site-packages/gitlab/base.py", line 184, in __len__    return len(self._list)  File ".../lib/python3.7/site-packages/gitlab/__init__.py", line 863, in __len__    return int(self._total)TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Workaround:

importgitlablen(gitlab.Gitlab(...).projects.list(as_list=False,pagination='offset'))

Specifications

  • python-gitlab version: sicnce v2.3.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 12.10.7-ee (80b99e43cfc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp