samuelcolvin / watchfiles

Simple, modern and fast file watching and code reload in Python.
https://watchfiles.helpmanual.io
MIT License
1.79k stars 108 forks source link

Segfault when running under free-threaded Python #299

Open dairiki opened 3 months ago

dairiki commented 3 months ago

Description

I am starting to play with the new GIL-less python.

When importing watchfiles, Python 3.13.0rc0t (installed using pyenv on Ubuntu 22.0) segfaults immediately.

It does this if either PYTHON_GIL=0 or PYTHON_GIL=1 is set, so it doesn't explicitly have to do with the GIL being disabled.

It does not segfault under the standard (non-free-threading) build of Python 3.13.0rc0 (even when I install from sdist rather than wheel).

Sadly, I do not have enough familiarity with rust to debug further.

Example Code

$ python -m watchfiles
Segmentation fault (core dumped)

$ python -c 'import watchfiles'
Segmentation fault (core dumped)

$ PYTHON_GIL=1 python -c 'import watchfiles'
Segmentation fault (core dumped)

$ PYTHON_GIL=0 python -c 'import watchfiles'
Segmentation fault (core dumped)

Watchfiles Output

No response

Operating System & Architecture

$ python -c 'import platform; print(platform.platform()); print(platform.version())' Linux-6.8.0-40-generic-x86_64-with-glibc2.35

40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2

Environment

No response

Python & Watchfiles Version

python: 3.13.0rc1 experimental free-threading build (main, Aug 21 2024, 13:10:59) [GCC 11.4.0], watchfiles: 0.23.0

Rust & Cargo Version

cargo 1.75.0, rustc 1.75.0 (82e1608df 2023-12-21) (built from a source tarball)