Closed mdickinson closed 2 years ago
The missing __class__
appears to be fixed in Python 3.7 and later. I'm testing using this script:
import functools, gc
@functools.lru_cache()
def square(x):
return x*x
# Make sure there are entries in the cache
square(3)
len([obj.__class__ for obj in gc.get_objects()])
Under Python 3.6, I get:
(envisage) mdickinson@mirzakhani temp % python3.6 test.py
Traceback (most recent call last):
File "test.py", line 10, in <module>
len([obj.__class__ for obj in gc.get_objects()])
File "test.py", line 10, in <listcomp>
len([obj.__class__ for obj in gc.get_objects()])
AttributeError: 'functools._lru_list_elem' object has no attribute '__class__'
Under Python 3.7 and later (tested with 3.7 through 3.11 inclusive), the script completes with no error (or output):
(envisage) mdickinson@mirzakhani temp % python3.7 test.py
So if we can't find a better solution, it may be reasonable to simply skip this test on Python 3.6.
So if we can't find a better solution
Another possible quick-and-dirty solution may be to limit the zmq
version on Python 3.6.
The PyPI workflow is failing on Python 3.6 with the following failure, which I can also reproduce locally:
The main issue here is that with the relevant versions of the packages,
zmq.Socket
is not a type:That the internal
functools._lru_list_elem
object doesn't have a__class__
attribute is a secondary issue. Either or both of these may be fixed in a later version of Python; I haven't yet checked.