extmod: Add uheapq module.
diff --git a/py/builtin.h b/py/builtin.h
index a69712b..58b821b 100644
--- a/py/builtin.h
+++ b/py/builtin.h
@@ -91,3 +91,4 @@
extern const mp_obj_module_t mp_module_uzlib;
extern const mp_obj_module_t mp_module_ujson;
extern const mp_obj_module_t mp_module_ure;
+extern const mp_obj_module_t mp_module_uheapq;
diff --git a/py/builtintables.c b/py/builtintables.c
index 0e5daf6..238d788 100644
--- a/py/builtintables.c
+++ b/py/builtintables.c
@@ -211,6 +211,9 @@
#if MICROPY_PY_URE
{ MP_OBJ_NEW_QSTR(MP_QSTR_ure), (mp_obj_t)&mp_module_ure },
#endif
+#if MICROPY_PY_UHEAPQ
+ { MP_OBJ_NEW_QSTR(MP_QSTR_uheapq), (mp_obj_t)&mp_module_uheapq },
+#endif
// extra builtin modules as defined by a port
MICROPY_PORT_BUILTIN_MODULES
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 4efe21d..201621e 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -403,6 +403,10 @@
#define MICROPY_PY_URE (0)
#endif
+#ifndef MICROPY_PY_UHEAPQ
+#define MICROPY_PY_UHEAPQ (0)
+#endif
+
/*****************************************************************************/
/* Hooks for a port to add builtins */
diff --git a/py/py.mk b/py/py.mk
index f58a5d0..a821b7c 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -114,6 +114,7 @@
../extmod/modujson.o \
../extmod/modure.o \
../extmod/moduzlib.o \
+ ../extmod/moduheapq.o \
# prepend the build destination prefix to the py object files
PY_O = $(addprefix $(PY_BUILD)/, $(PY_O_BASENAME))
diff --git a/py/qstrdefs.h b/py/qstrdefs.h
index 0f52071..d1bb4dc 100644
--- a/py/qstrdefs.h
+++ b/py/qstrdefs.h
@@ -485,3 +485,10 @@
Q(group)
Q(DEBUG)
#endif
+
+#if MICROPY_PY_UHEAPQ
+Q(uheapq)
+Q(heappush)
+Q(heappop)
+Q(heapify)
+#endif