diff --git a/esp8266/uart.c b/esp8266/uart.c
index c4d08eac4b45a5fc83708cabacda4f7c56c8edb5..9b2bfb4c830041571feea0beb942ca6995048526 100644
--- a/esp8266/uart.c
+++ b/esp8266/uart.c
@@ -234,6 +234,17 @@ void mp_keyboard_interrupt(void);
 
 int interrupt_char;
 void uart_task_handler(os_event_t *evt) {
+    if (pyexec_repl_active) {
+        // TODO: Just returning here isn't exactly right.
+        // What really should be done is something like
+        // enquing delayed event to itself, for another
+        // chance to feed data to REPL. Otherwise, there
+        // can be situation when buffer has bunch of data,
+        // and sits unprocessed, because we consumed all
+        // processing signals like this.
+        return;
+    }
+
     int c, ret = 0;
     while ((c = ringbuf_get(&input_buf)) >= 0) {
         if (c == interrupt_char) {
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c
index d1205034e54dfdad9e22c5845068404c19dad262..8afa3813cd2194a020aa14372b69f833ef28e4e3 100644
--- a/lib/utils/pyexec.c
+++ b/lib/utils/pyexec.c
@@ -277,12 +277,17 @@ input_restart:
     }
 }
 
+uint8_t pyexec_repl_active;
 int pyexec_event_repl_process_char(int c) {
+    pyexec_repl_active = 1;
+    int res;
     if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
-        return pyexec_raw_repl_process_char(c);
+        res = pyexec_raw_repl_process_char(c);
     } else {
-        return pyexec_friendly_repl_process_char(c);
+        res = pyexec_friendly_repl_process_char(c);
     }
+    pyexec_repl_active = 0;
+    return res;
 }
 
 #else // MICROPY_REPL_EVENT_DRIVEN
diff --git a/lib/utils/pyexec.h b/lib/utils/pyexec.h
index cf44530c5901dfbc218eedb3e683e8d12b4b50e9..e0f62440e0e7f62239e5a2aee102a1ff1cdbc434 100644
--- a/lib/utils/pyexec.h
+++ b/lib/utils/pyexec.h
@@ -42,6 +42,7 @@ int pyexec_file(const char *filename);
 int pyexec_frozen_module(const char *name);
 void pyexec_event_repl_init(void);
 int pyexec_event_repl_process_char(int c);
+extern uint8_t pyexec_repl_active;
 
 MP_DECLARE_CONST_FUN_OBJ(pyb_set_repl_info_obj);