@ai-ecoverse/wasix-python 3.14.2-21 → 3.14.2-23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,12 +4,12 @@ CPython 3.14 for slicc WASIX (`commands` `python` / `python3`).
4
4
 
5
5
  ## Features
6
6
 
7
- - PIE dynamic-main (`dylink.0`) on wasix-sysroot 2025.9.30-28's `sysroot-ehpic` (legacy wasm EH), SOABI `cpython-314-wasm32-wasix`; native side modules (py-numpy, py-scipy, py-pandas, …) load by `dlopen`
7
+ - PIE dynamic-main (`dylink.0`) on wasix-sysroot 2025.9.30-30's `sysroot-ehpic` (legacy wasm EH), SOABI `cpython-314-wasm32-wasix`; native side modules (py-numpy, py-scipy, py-pandas, …) load by `dlopen`
8
8
  - **File modes** (3.14.2-12, on slicc-kernel ≥ 1.35.1; older kernels keep the no-op modes): `os.umask`, `open()`/`os.mkdir` create modes, `os.chmod`, `tempfile.mkstemp` 600 / `mkdtemp` 700, pip console scripts 755
9
9
  - Built in: `ssl`/`hashlib` (OpenSSL 3.5.9, `@ai-ecoverse/wasix-openssl`), `zlib` 1.3.1, `bz2`, `lzma` (xz 5.8.4), `sqlite3` (3.54.0; FTS5, JSON, math, R*Tree; no WAL, no extensions), `readline` 8.3 (ncurses 6.5 terminfo compiled in: xterm, screen, tmux, vt100, linux), `ctypes` / `_ctypes` (wasix-org/libffi; needs slicc-kernel#306 step 1 for `call_dynamic` + `closure_{allocate,free}`), `mmap`, `fcntl`, `termios`, `resource`, `pwd`, `grp`, `select`
10
10
  - No `fork`/`vfork`; `subprocess` via `os.posix_spawn` (`proc_spawn2`/`3`)
11
11
  - `os.getuid()`/`getgid()`/`getgroups()` and `pwd`/`grp` come from slicc-kernel's process credentials and its `/etc/passwd`/`/etc/group` (3.14.2-13, wasix-sysroot -20; slicc-kernel ≥ 1.44.0, no fallback: ids are -1 on older kernels). Root is uid 0 with home `/root`.
12
- - Advisory file locks (`flock`, `fcntl` F_SETLK*, `lockf`) are no-ops (Emscripten parity)
12
+ - Record locks (`fcntl` F_SETLK*, `lockf`) go through slicc-kernel (since -21, below); `flock` is a no-op
13
13
  - stdout is line-buffered unless it is a regular file, so output streams and survives crashes
14
14
  - `signal.alarm`/`setitimer` and `time.sleep` resuming after a signal (the sysroot's libc patches, `patches/`)
15
15
  - Bundled `pip` 25.3; `.pyc` are unchecked-hash
@@ -18,14 +18,55 @@ CPython 3.14 for slicc WASIX (`commands` `python` / `python3`).
18
18
 
19
19
  Since 3.14.2-12 the package is cross-built from source in CI (`build.sh`); see `THIRD-PARTY-NOTICES.md` for the statically linked libraries.
20
20
 
21
+ Since 3.14.2-23:
22
+
23
+ - `multiprocessing.connection`'s `Listener` on an AF_UNIX path closes
24
+ cleanly on every kernel. slicc-kernel before 1.103.1 keeps socket paths out
25
+ of the filesystem (slicc-kernel#753), so the path it unlinks at close was
26
+ already gone, and up to -22 `close()` raised `FileNotFoundError` there. `multiprocessing.Manager()` also
27
+ needs WASIX's libc to return AF_UNIX addresses from `getsockname`, which
28
+ comes with wasix-sysroot -31 in the next release (homescoop#515).
29
+ - `threading.get_native_id()` and `Thread.native_id` exist (WASIX's thread id;
30
+ homescoop#587). Up to -22 they were missing or `None`, and
31
+ `scipy.fft.set_backend`/`skip_backend` raised `AttributeError`.
32
+ - **Shared memory fails loudly instead of silently** (homescoop#516).
33
+ Processes share no memory here, so nothing written into an `mp.Value`,
34
+ `mp.Array` (with or without a lock) or `SharedMemory` ever reached another
35
+ process, and up to -22 nothing said so.
36
+ - Passing a `Value`, `Array` or other shared ctypes object to a child
37
+ (`Process` arguments, `Pool` initargs) now raises `NotImplementedError` at
38
+ `start()`, naming a Queue, a Pipe or a Manager as the alternatives. Inside
39
+ one process (threads) they work as before.
40
+ - `multiprocessing.shared_memory` raises `ImportError` on import, as on
41
+ upstream WASI builds, and `multiprocessing.managers.HAS_SHMEM` is
42
+ `False`.
43
+ - `multiprocessing.get_all_start_methods()` is `['spawn']`, and
44
+ `get_context("fork")`/`("forkserver")` raise `ValueError`. Up to -22 they
45
+ listed `fork` and `forkserver`, and a fork `Process` failed at `start()`
46
+ with `AttributeError` (no `os.fork`, homescoop#357).
47
+
48
+ Since 3.14.2-22 the `sqlite3` module uses SQLite's `unix` VFS, with `fcntl`
49
+ locks, instead of SQLITE_WASI's default `unix-dotfile`, whose `.lock`
50
+ directory no other program saw. Python and the sqlite3 CLI (or another
51
+ program) now lock each other out on the same database. Up to -21, a CLI write
52
+ during a python transaction went through, and python's commit then failed
53
+ with `disk I/O error`.
54
+
55
+ **-22 needs slicc-kernel ≥ 1.100.0** (`engines`; it was ≥ 1.51.0). Its
56
+ `fcntl` locks only reach other processes through slicc-kernel's
57
+ `slicc.fcntl_lock` (1.100.0, #722). On an older kernel the libc grants every
58
+ lock locally, so two python processes writing one database could lose a row
59
+ (homescoop#567); -21's `.lock` directory had kept them apart.
60
+
21
61
  Since 3.14.2-21 (wasix-sysroot -30):
22
62
 
23
63
  - `multiprocessing` works with the `spawn` start method (the default):
24
64
  `Pool`, `Queue`, `Lock`, `Semaphore` and the other synchronisation
25
65
  primitives, across processes. Its named semaphores are kept by slicc-kernel
26
- (≥ 1.99.0). `shared_memory` and shared ctypes (`Value`/`Array` with
27
- `lock=False`) don't work, because processes don't share memory. There is
28
- no `fork` start method (no `os.fork`).
66
+ (≥ 1.99.0). `shared_memory` and shared ctypes (`Value`/`Array`, whatever
67
+ their `lock`) aren't shared between processes, because processes don't
68
+ share memory (an error since -23). There is no `fork` start method (no
69
+ `os.fork`).
29
70
  - `fcntl.lockf`/`fcntl.fcntl` record locks and `os.lockf` go through the libc
30
71
  to slicc-kernel (slicc-kernel#722) and hold against other processes, such as
31
72
  a second python or the sqlite3 CLI on the same database. On an older kernel
@@ -192,7 +233,7 @@ On plain Wasmer without `_ssl`, use a local wheel (`--no-index --find-links`) un
192
233
  python -m venv v && v/bin/pip install requests && v/bin/python -c "import requests"
193
234
  ```
194
235
 
195
- **Venvs need slicc-kernel ≥ 1.29.0** (`engines` asks for ≥ 1.51.0 for `_ctypes`). On older kernels a
236
+ **Venvs need slicc-kernel ≥ 1.29.0** (`engines` asks for ≥ 1.100.0 since -22, for sqlite's locks; ≥ 1.51.0 before, for `_ctypes`). On older kernels a
196
237
  venv's `bin/python` and `bin/pip` run as the base interpreter: `v/bin/pip
197
238
  install` then installs into the **base** package directory, not the venv.
198
239
 
package/bin/python.wasm CHANGED
Binary file
@@ -42,7 +42,7 @@ PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void);
42
42
  #if (defined(__APPLE__) || defined(__linux__) || defined(_WIN32) \
43
43
  || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
44
44
  || defined(__OpenBSD__) || defined(__NetBSD__) \
45
- || defined(__DragonFly__) || defined(_AIX))
45
+ || defined(__DragonFly__) || defined(_AIX) || defined(__wasi__))
46
46
  #define PY_HAVE_THREAD_NATIVE_ID
47
47
  PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void);
48
48
  #endif
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/lib/libpython3.14.a
3
- size: 59668280 bytes
4
- sha256: 48c633745276bc36c59b7b161b9e3e3d58e8fbffd689d466da59bddcb3076ab3
3
+ size: 59670786 bytes
4
+ sha256: c614008b169a505ef753438e52e6e65be14fecfa21454dcea57589d91504a5d5
@@ -634,7 +634,8 @@ class SocketListener(object):
634
634
  if family == 'AF_UNIX' and not util.is_abstract_socket_namespace(address):
635
635
  # Linux abstract socket namespaces do not need to be explicitly unlinked
636
636
  self._unlink = util.Finalize(
637
- self, os.unlink, args=(address,), exitpriority=0
637
+ self, _unlink_socket if sys.platform == 'wasi' else os.unlink,
638
+ args=(address,), exitpriority=0
638
639
  )
639
640
  else:
640
641
  self._unlink = None
@@ -654,6 +655,13 @@ class SocketListener(object):
654
655
  unlink()
655
656
 
656
657
 
658
+ def _unlink_socket(path):
659
+ try:
660
+ os.unlink(path)
661
+ except FileNotFoundError:
662
+ pass
663
+
664
+
657
665
  def SocketClient(address):
658
666
  '''
659
667
  Return a connection object connected to the socket given by `address`
@@ -319,10 +319,13 @@ if sys.platform != 'win32':
319
319
  'spawn': SpawnContext(),
320
320
  'forkserver': ForkServerContext(),
321
321
  }
322
+ if sys.platform == 'wasi' and not hasattr(os, 'fork'):
323
+ del _concrete_contexts['fork'], _concrete_contexts['forkserver']
322
324
  # bpo-33725: running arbitrary code after fork() is no longer reliable
323
325
  # on macOS since macOS 10.14 (Mojave). Use spawn by default instead.
324
326
  # gh-84559: We changed everyones default to a thread safeish one in 3.14.
325
- if reduction.HAVE_SEND_HANDLE and sys.platform != 'darwin':
327
+ if ('forkserver' in _concrete_contexts and reduction.HAVE_SEND_HANDLE
328
+ and sys.platform != 'darwin'):
326
329
  _default_context = DefaultContext(_concrete_contexts['forkserver'])
327
330
  else:
328
331
  _default_context = DefaultContext(_concrete_contexts['spawn'])
@@ -98,6 +98,11 @@ else:
98
98
  return util.get_temp_dir()
99
99
 
100
100
  def reduce_arena(a):
101
+ if sys.platform == 'wasi':
102
+ raise NotImplementedError(
103
+ 'multiprocessing: Value, Array and other shared ctypes '
104
+ 'cannot be shared with another process on WASI, where '
105
+ 'processes share no memory; use a Queue, a Pipe or a Manager')
101
106
  if a.fd == -1:
102
107
  raise ValueError('Arena is unpicklable because '
103
108
  'forking was enabled when it was created')
@@ -14,11 +14,16 @@ import os
14
14
  import errno
15
15
  import struct
16
16
  import secrets
17
+ import sys
17
18
  import types
18
19
 
19
20
  if os.name == "nt":
20
21
  import _winapi
21
22
  _USE_POSIX = False
23
+ elif sys.platform == "wasi":
24
+ raise ImportError(
25
+ "multiprocessing.shared_memory is not available on WASI: "
26
+ "processes share no memory")
22
27
  else:
23
28
  import _posixshmem
24
29
  _USE_POSIX = True
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/wasix-python",
3
- "version": "3.14.2-21",
3
+ "version": "3.14.2-23",
4
4
  "description": "CPython 3.14 for slicc WASIX (commands python, python3; cross-built in CI on wasix-sysroot)",
5
5
  "license": "PSF-2.0 AND GPL-3.0-or-later",
6
6
  "engines": {
7
- "slicc-kernel": ">=1.51.0"
7
+ "slicc-kernel": ">=1.100.0"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",