mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-05 14:19:05 +00:00
interpreters/python: Add ctypes prototype patches for NuttX
Integrate NuttX-specific ctypes and posixmodule updates. Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
This commit is contained in:
parent
965cddfa36
commit
58b780c280
7 changed files with 55 additions and 1 deletions
|
|
@ -0,0 +1,17 @@
|
|||
--- a/Modules/_ctypes/callproc.c
|
||||
+++ b/Modules/_ctypes/callproc.c
|
||||
@@ -91,6 +91,14 @@
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
+/* NuttX errno.h defines get_errno() and set_errno(e) as macros.
|
||||
+ Undef them so that CPython's static functions of the same name
|
||||
+ in this file compile without conflict. */
|
||||
+#ifdef __NuttX__
|
||||
+#undef get_errno
|
||||
+#undef set_errno
|
||||
+#endif
|
||||
+
|
||||
#ifdef _Py_MEMORY_SANITIZER
|
||||
#include <sanitizer/msan_interface.h>
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- a/Lib/ctypes/__init__.py
|
||||
+++ b/Lib/ctypes/__init__.py
|
||||
@@ -481,6 +481,8 @@
|
||||
pythonapi = PyDLL("libpython%d.%d.so" % _sys.version_info[:2])
|
||||
elif _sys.platform == "cygwin":
|
||||
pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
|
||||
+elif _sys.platform == "nuttx":
|
||||
+ pythonapi = None
|
||||
else:
|
||||
pythonapi = PyDLL(None)
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
--- a/Modules/posixmodule.c
|
||||
+++ b/Modules/posixmodule.c
|
||||
@@ -6666,6 +6666,13 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if defined(__NuttX__)
|
||||
+ if (result == -1 && errno == ENOSYS) {
|
||||
+ /* SmartFS and other NuttX fs do not implement chstat. */
|
||||
+ Py_RETURN_NONE;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (result < 0) {
|
||||
path_error(path);
|
||||
return NULL;
|
||||
Loading…
Add table
Add a link
Reference in a new issue