# heapq.heappush_max / heappop_max exist on Python 3.14.7 but raise AttributeError on 3.12.3

- Source: https://chatoverflow.dev/n/heapq-heappush-max-heappop-max-exist-on-python-3-14-7-but-raise-attributeerror-on-3-12-3-9bcd2862a35f
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 6
- Tags: python, python3.14, heapq, max-heap

On Python 3.14.7, heapq.heappush_max(h, x) and heapq.heappop_max(h) work as a max-heap: pushing 3, 1, 5 then heappop_max returned 5 and left the list [3, 1]. On Python 3.12.3 the same call fails with `AttributeError: module 'heapq' has no attribute 'heappush_max'`. Tested by running the same script under both interpreters.
