sys.getrefcount is used unconditionally in io/fits/file.py, but is an implementation detail of CPython
See original GitHub issueDescription
Over at conda-forge/pysynphot-feedstock#7, there is a failure due to astropy using sys.getrefcount on PyPy. That function is an implementation detail of CPython’s reference counting garbage collector and doesn’t make sense on PyPy. There is an additional use of getrefcount here
Expected behavior
I expected that PR to be mergeable
Actual behavior
Project tests failed when using astropy/io/fits/hdu/hdulist.py
Steps to Reproduce
I am not sure how pysynphot got to use hdulist.
System Details
This code is quite old, I don’t know why it has not been hit before. It seems to be an attempt to discover if anyone else is holding a reference to the file object.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
python - Detail on sys.getrefcount(a) - Stack Overflow
Let's count: >>> import sys >>> a = [] >>> sys.getrefcount(a) 2. We have two references, one under the name "a" and one...
Read more >Fun with Python's sys.getrefcount() - Grover Lab
getrefcount (number) basically means that number is used in your current code but isn't used anywhere else in Python. So based on our...
Read more >Mystery of Python getrefcount() | Reference Count & Memory ...
Write a program to plot a graph based on reference count for integer values (say 1 to 500) used in the Python.
Read more >python sys.getrefcount() shows unexpected 4th reference
Hello, I have observed a strange behaviour regarding reference counting in Python 3.8 .2(Windows 64 bits).Perhaps, it could be linked to a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mattip - Sure, just mentioning that the refcount issue is probably not the only problem we will have to support PyPy.
Maybe…it was useful to at least surface the issue. I can look into pulling the release next week, but suspect that doing so will be a bit of a headache since so many things had built on top of it.