Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latest_release throws exception #1105

Open
mwoehlke-kitware opened this issue Sep 8, 2022 · 2 comments
Open

latest_release throws exception #1105

mwoehlke-kitware opened this issue Sep 8, 2022 · 2 comments

Comments

@mwoehlke-kitware
Copy link

latest_release() is dying with:

  File ".../src/github3/repos/repo.py", line 2163, in latest_release
    return self._instance_or_null(release.Release, json)
  File ".../src/github3/models.py", line 152, in _instance_or_null
    return instance_class(json, self)
  File ".../src/github3/models.py", line 53, in __init__
    self._update_attributes(json)
  File ".../src/github3/repos/release.py", line 102, in _update_attributes
    self.author = users.ShortUser(release["author"], self)
  File ".../src/github3/models.py", line 53, in __init__
    self._update_attributes(json)
  File ".../src/github3/users.py", line 309, in _update_attributes
    self.avatar_url = user["avatar_url"]
TypeError: 'NoneType' object is not subscriptable

This happens on https://api.github.com/repos/uNetworking/uSockets/releases/latest, which, as of reporting, is https://api.github.com/repos/uNetworking/uSockets/releases/tags/v0.8.1, which are producing "author": null rather than "author": {...}.

This looks to be similar to #988.

@sigmavirus24
Copy link
Owner

Can you include version information about github3.py, it's dependencies, and the version of Python you're using? We can definitely fix this, I just want to make sure it's definitely a bug in the latest version

@mwoehlke-kitware
Copy link
Author

mwoehlke-kitware commented Sep 12, 2022

I did the following:

$ docker run --rm -it ubuntu:jammy
# apt update && apt install -y python3-pip
# pip3 install github3.py
# python3
>>> gh = github3.GitHub()
>>> repo = gh.repository('uNetworking','uSockets')
>>> repo.latest_release()

This reproduces the issue. It should also be trivial to reproduce this environment to get whatever version information you want; however, AFAICT, the relevant code hasn't changed and this should be just as trivially reproducible on master. Basically, _User._update_attributes expects to get a JSON object, but gets None because of the "author": null that is sent in the reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants