Skip to content

GithubObjects are no longer serializable with pickle #2436

@josh-fell

Description

@josh-fell

To support data exchange, being able to serialize non-JSON-serializable GithubObjects has been easily achieved in past with pickle. However, starting with v1.58, GithubObjects like Repository, NamedUser, etc. are no longer serializable with with pickle,

For example,

import github
import pickle

repo = github.Github().get_repo(full_name_or_id="PyGithub/PyGithub")
pickle.dumps(repo)

raise the following exception:

Traceback (most recent call last):
  File "/Users/joshfell/code/daedalus/tempCodeRunnerFile.python", line 15, in <module>
    pickle.dumps(repo)
  File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/synchronize.py", line 101, in __getstate__
    context.assert_spawning(self)
  File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/context.py", line 373, in assert_spawning
    raise RuntimeError(
RuntimeError: RLock objects should only be shared between processes through inheritance

The underyling Requester object now has an RLock() attribute, __auth_lock, which looks to be preventing this serialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions