question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sys.getrefcount is used unconditionally in io/fits/file.py, but is an implementation detail of CPython

See original GitHub issue

Description

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:open
  • Created a year ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
saimncommented, Nov 3, 2022

@mattip - Sure, just mentioning that the refcount issue is probably not the only problem we will have to support PyPy.

1reaction
mwcraigcommented, Nov 3, 2022

@mwcraig , should we take astropy back out from conda-forge PyPy builds?

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found