Skip to content

Commit f6fae2a

Browse files
committed
python3: add ctypes pythonapi patch
1 parent 5cc87dd commit f6fae2a

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

pythonforandroid/recipes/python3/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,18 @@ class Python3Recipe(TargetPythonRecipe):
7575
]
7676

7777
if shutil.which('lld') is not None:
78-
patches = patches + [
78+
patches += [
7979
("patches/py3.7.1_fix_cortex_a8.patch", version_starts_with("3.7")),
8080
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.8")),
8181
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.9")),
8282
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.10")),
8383
("patches/py3.11.4_fix_cortex_a8.patch", version_starts_with("3.11"))
8484
]
8585

86+
# ctypes pythonapi fix.
87+
# Taken from : https://github.com/gabomdq/ignifuga/blob/master/tools/patches/python.android.diff
88+
patches += ["patches/ctypes-pythonapi.patch"]
89+
8690
depends = ['hostpython3', 'sqlite3', 'openssl', 'libffi']
8791
# those optional depends allow us to build python compression modules:
8892
# - _bz2.so
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--- Python-3.11.5/Lib/ctypes/__init__.py 2023-08-24 17:39:18.000000000 +0530
2+
+++ Python-3.11.5.mod/Lib/ctypes/__init__.py 2023-11-14 13:42:08.642311286 +0530
3+
@@ -460,10 +460,8 @@
4+
5+
if _os.name == "nt":
6+
pythonapi = PyDLL("python dll", None, _sys.dllhandle)
7+
-elif _sys.platform == "cygwin":
8+
- pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
9+
else:
10+
- pythonapi = PyDLL(None)
11+
+ pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
12+
13+
14+
if _os.name == "nt":

0 commit comments

Comments
 (0)