prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  TypeError angr 9.2.16 and PyPy 7.3.9 (CPython 3.9)
  <!--
  *Disclaimer:
  The angr suite is maintained by a small team of volunteers.
  While we cannot guarantee any timeliness for fixes and enhancements, we will do our best.
  For more real-time help with angr, from us and the community, join our [Slack.](https://angr.io/invite/)*
  -->
  ---
  
  **Describe the bug.**
  <!--
  Please include a clear and concise description of what the bug is.
  -->
  
  The latest version of angr appears to have issues when ran with the latest version of PyPy (I haven't tested with CPython). This issue affects all angr versions newer than 9.2.11:
  
  ```text
  $ python --version
  Python 3.9.12 (05fbe3aa5b0845e6c37239768aa455451aa5faba, Mar 29 2022, 08:15:34)
  [PyPy 7.3.9 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]
  $ python -c "import angr; p = angr.Project('/bin/ls')"
  WARNING | 2022-08-31 09:52:12,054 | cle.loader | The main binary is a position-independent executable. It is being loaded with a base address of 0x400000.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/project.py", line 230, in __init__
      self.simos.configure_project()
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/simos/linux.py", line 161, in configure_project
      super(SimLinux, self).configure_project(syscall_abis)
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/simos/userland.py", line 49, in configure_project
      super().configure_project()
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/simos/simos.py", line 82, in configure_project
      self.project.loader.perform_irelative_relocs(irelative_resolver)
    File "/home/carter/env/lib/pypy3.9/site-packages/cle/loader.py", line 601, in perform_irelative_relocs
      val = resolver_func(resolver)
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/simos/simos.py", line 72, in irelative_resolver
      val = resolver()
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/callable.py", line 55, in __call__
      self.perform_call(*args, prototype=prototype)
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/callable.py", line 78, in perform_call
      caller = self._project.factory.simulation_manager(state)
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/factory.py", line 181, in simulation_manager
      return SimulationManager(self.project, active_states=thing, **kwargs)
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/sim_manager.py", line 94, in __init__
      self._hierarchy = StateHierarchy() if hierarchy is None else hierarchy
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/state_hierarchy.py", line 31, in __init__
      self._lock = PicklableRLock()
    File "/home/carter/env/lib/pypy3.9/site-packages/angr/misc/picklable_lock.py", line 11, in __init__
      self._lock = self._LOCK(*args, **kwargs)  # pylint: disable=too-many-function-args
    File "/home/carter/pypy3.9/lib/pypy3.9/threading.py", line 93, in RLock
      return _CRLock(*args, **kwargs)
  TypeError: __new__() takes 1 positional argument but 2 were given
  ```
  
  **Environment Information.**
  <!--
  Many common issues are caused by problems with the local Python environment.
  Before submitting, double-check that your versions of all modules in the angr suite (angr, cle, pyvex, ...) are up to date.
  Please include the output of `python -m angr.misc.bug_report` here.
  -->
  
  * Affects angr versions 9.2.12 through 9.2.16
  * PyPy version 7.3.9 (latest release at time of writing)
  * Debian Bullseye
  
  **To Reproduce.**
  <!--
  Please include *both a script to reproduce the crash, and attach the binary used, if possible*
  -->
  
  1. Install latest PyPy release
  2. Install angr version 9.2.16
  3. Run: `python -c "import angr; p = angr.Project('/bin/ls')`
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `angr/misc/picklable_lock.py`
  Content:
  ```
  1 import threading
  2 
  3 class PicklableLock:
  4     """
  5     Normal thread-locks are not pickleable. This provides a pickleable lock by mandating that the lock is unlocked
  6     during serialization.
  7     """
  8     _LOCK = threading.Lock
  9 
  10     def __init__(self, *args, **kwargs):
  11         self._lock = self._LOCK(*args, **kwargs)  # pylint: disable=too-many-function-args
  12 
  13     def __enter__(self):
  14         return self._lock.__enter__()
  15 
  16     def __exit__(self, exc_type, exc_val, exc_tb):
  17         return self._lock.__exit__(exc_type, exc_val, exc_tb)
  18 
  19     def acquire(self, *args, **kwargs):
  20         return self._lock.acquire(*args, **kwargs)
  21 
  22     def locked(self):
  23         return self._lock.locked()
  24 
  25     def release(self):
  26         return self._lock.release()
  27 
  28     def __reduce__(self):
  29         if self.locked():
  30             raise TypeError("Why are you pickling a locked lock")
  31         return type(self), ()
  32 
  33 class PicklableRLock(PicklableLock):
  34     """
  35     Same as above, but uses RLock instead of Lock for locking. Note that RLock does not provide an interface to tell
  36     whether is it presently held by any thread, and thus this class will lie about whether it is locked.
  37     """
  38     _LOCK = threading.RLock
  39 
  40     def locked(self):
  41         return False   # ummmmmmmmmmmmmmmm
  42
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/angr/misc/picklable_lock.py b/angr/misc/picklable_lock.py
  --- a/angr/misc/picklable_lock.py
  +++ b/angr/misc/picklable_lock.py
  @@ -1,5 +1,6 @@
   import threading
   
  +
   class PicklableLock:
       """
       Normal thread-locks are not pickleable. This provides a pickleable lock by mandating that the lock is unlocked
  @@ -8,7 +9,7 @@
       _LOCK = threading.Lock
   
       def __init__(self, *args, **kwargs):
  -        self._lock = self._LOCK(*args, **kwargs)  # pylint: disable=too-many-function-args
  +        self._lock = self.__class__._LOCK(*args, **kwargs)  # pylint: disable=too-many-function-args
   
       def __enter__(self):
           return self._lock.__enter__()
  @@ -30,6 +31,7 @@
               raise TypeError("Why are you pickling a locked lock")
           return type(self), ()
   
  +
   class PicklableRLock(PicklableLock):
       """
       Same as above, but uses RLock instead of Lock for locking. Note that RLock does not provide an interface to tell
  
verification_info: {"golden_diff": "diff --git a/angr/misc/picklable_lock.py b/angr/misc/picklable_lock.py\n--- a/angr/misc/picklable_lock.py\n+++ b/angr/misc/picklable_lock.py\n@@ -1,5 +1,6 @@\n import threading\n \n+\n class PicklableLock:\n     \"\"\"\n     Normal thread-locks are not pickleable. This provides a pickleable lock by mandating that the lock is unlocked\n@@ -8,7 +9,7 @@\n     _LOCK = threading.Lock\n \n     def __init__(self, *args, **kwargs):\n-        self._lock = self._LOCK(*args, **kwargs)  # pylint: disable=too-many-function-args\n+        self._lock = self.__class__._LOCK(*args, **kwargs)  # pylint: disable=too-many-function-args\n \n     def __enter__(self):\n         return self._lock.__enter__()\n@@ -30,6 +31,7 @@\n             raise TypeError(\"Why are you pickling a locked lock\")\n         return type(self), ()\n \n+\n class PicklableRLock(PicklableLock):\n     \"\"\"\n     Same as above, but uses RLock instead of Lock for locking. Note that RLock does not provide an interface to tell\n", "issue": "TypeError angr 9.2.16 and PyPy 7.3.9 (CPython 3.9)\n<!--\r\n*Disclaimer:\r\nThe angr suite is maintained by a small team of volunteers.\r\nWhile we cannot guarantee any timeliness for fixes and enhancements, we will do our best.\r\nFor more real-time help with angr, from us and the community, join our [Slack.](https://angr.io/invite/)*\r\n-->\r\n---\r\n\r\n**Describe the bug.**\r\n<!--\r\nPlease include a clear and concise description of what the bug is.\r\n-->\r\n\r\nThe latest version of angr appears to have issues when ran with the latest version of PyPy (I haven't tested with CPython). This issue affects all angr versions newer than 9.2.11:\r\n\r\n```text\r\n$ python --version\r\nPython 3.9.12 (05fbe3aa5b0845e6c37239768aa455451aa5faba, Mar 29 2022, 08:15:34)\r\n[PyPy 7.3.9 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]\r\n$ python -c \"import angr; p = angr.Project('/bin/ls')\"\r\nWARNING | 2022-08-31 09:52:12,054 | cle.loader | The main binary is a position-independent executable. It is being loaded with a base address of 0x400000.\r\nTraceback (most recent call last):\r\n  File \"<string>\", line 1, in <module>\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/project.py\", line 230, in __init__\r\n    self.simos.configure_project()\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/simos/linux.py\", line 161, in configure_project\r\n    super(SimLinux, self).configure_project(syscall_abis)\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/simos/userland.py\", line 49, in configure_project\r\n    super().configure_project()\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/simos/simos.py\", line 82, in configure_project\r\n    self.project.loader.perform_irelative_relocs(irelative_resolver)\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/cle/loader.py\", line 601, in perform_irelative_relocs\r\n    val = resolver_func(resolver)\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/simos/simos.py\", line 72, in irelative_resolver\r\n    val = resolver()\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/callable.py\", line 55, in __call__\r\n    self.perform_call(*args, prototype=prototype)\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/callable.py\", line 78, in perform_call\r\n    caller = self._project.factory.simulation_manager(state)\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/factory.py\", line 181, in simulation_manager\r\n    return SimulationManager(self.project, active_states=thing, **kwargs)\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/sim_manager.py\", line 94, in __init__\r\n    self._hierarchy = StateHierarchy() if hierarchy is None else hierarchy\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/state_hierarchy.py\", line 31, in __init__\r\n    self._lock = PicklableRLock()\r\n  File \"/home/carter/env/lib/pypy3.9/site-packages/angr/misc/picklable_lock.py\", line 11, in __init__\r\n    self._lock = self._LOCK(*args, **kwargs)  # pylint: disable=too-many-function-args\r\n  File \"/home/carter/pypy3.9/lib/pypy3.9/threading.py\", line 93, in RLock\r\n    return _CRLock(*args, **kwargs)\r\nTypeError: __new__() takes 1 positional argument but 2 were given\r\n```\r\n\r\n**Environment Information.**\r\n<!--\r\nMany common issues are caused by problems with the local Python environment.\r\nBefore submitting, double-check that your versions of all modules in the angr suite (angr, cle, pyvex, ...) are up to date.\r\nPlease include the output of `python -m angr.misc.bug_report` here.\r\n-->\r\n\r\n* Affects angr versions 9.2.12 through 9.2.16\r\n* PyPy version 7.3.9 (latest release at time of writing)\r\n* Debian Bullseye\r\n\r\n**To Reproduce.**\r\n<!--\r\nPlease include *both a script to reproduce the crash, and attach the binary used, if possible*\r\n-->\r\n\r\n1. Install latest PyPy release\r\n2. Install angr version 9.2.16\r\n3. Run: `python -c \"import angr; p = angr.Project('/bin/ls')`\n", "before_files": [{"content": "import threading\n\nclass PicklableLock:\n    \"\"\"\n    Normal thread-locks are not pickleable. This provides a pickleable lock by mandating that the lock is unlocked\n    during serialization.\n    \"\"\"\n    _LOCK = threading.Lock\n\n    def __init__(self, *args, **kwargs):\n        self._lock = self._LOCK(*args, **kwargs)  # pylint: disable=too-many-function-args\n\n    def __enter__(self):\n        return self._lock.__enter__()\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        return self._lock.__exit__(exc_type, exc_val, exc_tb)\n\n    def acquire(self, *args, **kwargs):\n        return self._lock.acquire(*args, **kwargs)\n\n    def locked(self):\n        return self._lock.locked()\n\n    def release(self):\n        return self._lock.release()\n\n    def __reduce__(self):\n        if self.locked():\n            raise TypeError(\"Why are you pickling a locked lock\")\n        return type(self), ()\n\nclass PicklableRLock(PicklableLock):\n    \"\"\"\n    Same as above, but uses RLock instead of Lock for locking. Note that RLock does not provide an interface to tell\n    whether is it presently held by any thread, and thus this class will lie about whether it is locked.\n    \"\"\"\n    _LOCK = threading.RLock\n\n    def locked(self):\n        return False   # ummmmmmmmmmmmmmmm\n", "path": "angr/misc/picklable_lock.py"}], "after_files": [{"content": "import threading\n\n\nclass PicklableLock:\n    \"\"\"\n    Normal thread-locks are not pickleable. This provides a pickleable lock by mandating that the lock is unlocked\n    during serialization.\n    \"\"\"\n    _LOCK = threading.Lock\n\n    def __init__(self, *args, **kwargs):\n        self._lock = self.__class__._LOCK(*args, **kwargs)  # pylint: disable=too-many-function-args\n\n    def __enter__(self):\n        return self._lock.__enter__()\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        return self._lock.__exit__(exc_type, exc_val, exc_tb)\n\n    def acquire(self, *args, **kwargs):\n        return self._lock.acquire(*args, **kwargs)\n\n    def locked(self):\n        return self._lock.locked()\n\n    def release(self):\n        return self._lock.release()\n\n    def __reduce__(self):\n        if self.locked():\n            raise TypeError(\"Why are you pickling a locked lock\")\n        return type(self), ()\n\n\nclass PicklableRLock(PicklableLock):\n    \"\"\"\n    Same as above, but uses RLock instead of Lock for locking. Note that RLock does not provide an interface to tell\n    whether is it presently held by any thread, and thus this class will lie about whether it is locked.\n    \"\"\"\n    _LOCK = threading.RLock\n\n    def locked(self):\n        return False   # ummmmmmmmmmmmmmmm\n", "path": "angr/misc/picklable_lock.py"}]}