raiden00pl commented on code in PR #3746:
URL: https://github.com/apache/nuttx-apps/pull/3746#discussion_r3836001477


##########
interpreters/python/python_wrapper.c:
##########
@@ -92,6 +107,103 @@
  * Private Functions
  ****************************************************************************/
 
+#ifdef CONFIG_SYSTEM_READLINE
+/****************************************************************************
+ * Name: python_readline
+ *
+ * Description:
+ *   Read an interactive line with the NuttX line editor.  CPython calls
+ *   this hook only for a TTY attached to the main interpreter, leaving its
+ *   standard fgets-based reader in place for redirected input and
+ *   subinterpreters.
+ *
+ ****************************************************************************/
+
+static char *python_readline(FILE *sys_stdin, FILE *sys_stdout,
+                             const char *prompt)
+{
+#if defined(CONFIG_READLINE_TABCOMPLETION) || defined(CONFIG_READLINE_EDIT)
+  FAR const char *oldprompt;
+#endif
+  FAR char *line;
+  FAR char *tmp;
+  size_t linesize;
+  size_t used;
+  ssize_t nread;
+
+  fflush(sys_stdout);
+
+  if (prompt != NULL)
+    {
+      fputs(prompt, stderr);
+    }
+
+  fflush(stderr);

Review Comment:
   it follows python implementation:
   
   
https://github.com/python/cpython/blob/c2dd934fb8e120f14ad50e58f9378872e8630fa3/Parser/myreadline.c#L308-L312
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to