beeware / beeware/rubicon-objc
Importing rubicon.objs hangs on pypy
- Dominant language
- Python
- Stars
- 301
- Forks
- 70
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 18
Description
### Describe the bug
When I try to import `rubicon.objc` using Pypy, the process hangs while it allocates more and more memory. I traced this down to this line, and it seems to be related to the `PyDictObject`:
https://github.com/beeware/rubicon-objc/blob/6c3d6b663b2a754506c3115dc37a769f832b6395/src/rubicon/objc/ctypes_patch.py#L121-L132
With "traced it down" I mean that I put `1/0` in the code to make it raise an exception. If the it hung instead of raising the exception, then the hangup occurred bedore it. The code above is where it hangs. And if I comment the field with the `PyDictObject`, then it does not hang, so it looks like it's related to that.
I tried with pypy3.8-7.3.11 and pypy3.9-7.3.11, both installed via pyenv.
### Steps to reproduce
Run `import ubicon.objc` in a pypy interpreter. The process hangs, does not respond to ctrl-c.
### Expected behavior
I would expect the import to work :)
### Screenshots
_No response_
### Environment
MacOS M1 pro Sonoma 14.3
### Logs
```
```
### Additional context
_No response_
Contributor guide
Research direction
Start with src/rubicon/objc/ctypes_patch.py at lines 121-132 and reproduce the hang by running import rubicon.objc under the reported PyPy versions. Investigate the PyDictObject handling there and verify that the import completes without unbounded memory growth or becoming unresponsive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c, python
- Domain
- desktop-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100