New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_heapq: AttributeError: 'int' object has no attribute 'pop' #53798
Comments
Various buildbots show a failure on test_heapq.
|
This is a variant of the kind of annoyance pointed out in bpo-9548. Here, it seems addbuilddir() in Lib/site.py shouldn't import sysconfig, because it imports the re module. |
For some reason, sys.modules['heapq'] contains the Python implementation instead of the C implementation. Tested with r83981 on python 3: Python 3.2a1+ (py3k:83981M, Aug 13 2010, 19:02:31) >>> import heapq
>>> heapq.heappop(10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/florent/dev/python/py3trunk/Lib/heapq.py", line 140, in heappop
lastelt = heap.pop() # raises appropriate IndexError if heap is empty
AttributeError: 'int' object has no attribute 'pop'
>>> import _heapq
>>> _heapq.heappop(10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: heap argument must be a list These tests (TestErrorHandling) are supposed to run with the C module only. |
Here is a patch which works if the patch in bpo-9548 is also applied. Of course, since the logic in addbuilddir() is now much simpler, it could also be rewritten in C somewhere (where?), and the launched much earlier during the startup phase. |
Here is a C version of addbuilddir. It solves the present issue. |
I've committed an updated version of the C patch in r83988, after Victor's comments on IRC. |
r83988 is also the correct fix for bpo-586680: I updated this issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: