Updates on the Python nogil Project and GIL Removal Efforts
At the 2022 Python Language Summit, Sam Gross presented the latest progress on the nogil project, targeting Python 3.9, discussing new lock designs, proposed compiler flags to disable the GIL in Python 3.12, and the potential impact on third‑party libraries and CPython development.
The Python GIL topic has been discussed countless times in the community, and at the 2022 Python Language Summit Sam Gross presented the latest status of the nogil project (literally “no GIL”), which was first announced in October 2021 and caused a stir in the Python community.
The Global Interpreter Lock (GIL) is a key feature that prevents true concurrency between threads in Python, making it difficult to run multiple tasks simultaneously in a single Python process. The main early advocate for removing the GIL was Larry Hastings with his famous “Gilectomy” project, which was eventually abandoned because it slowed down single‑threaded Python code.
At the summit Gross reported that the nogil project now targets Python 3.9, as early adoption is crucial to assess feasibility; if third‑party packages fail under nogil, early adopters cannot use it effectively. Compared with Python 3.10, third‑party support is still broader for 3.9, making it a more sensible base branch for now.
Gross also announced changes to thread‑safety: to run Python without the GIL, many pieces of code need new locks to remain thread‑safe, but adding locks to existing code can be very difficult and may cause significant slowdowns. His solution is to invent a new type of lock, a “more lucky” lock.
He proposed adding a new compiler flag in Python 3.12 to disable the GIL, a suggestion that sparked excitement and strong criticism among core developers; Carol Willing questioned whether nogil should remain a separate CPython branch rather than being merged into the main branch, to which Gross replied that this “is not the road to success.”
Samuel Colvin, maintainer of the pydantic library, expressed disappointment that the proposal targets a compiler flag instead of a runtime flag, commenting that being able to change the setting from within Python would greatly increase adoption.
Barry Warsaw and Itamar Ostricher asked Gross about the impact of nogil on third‑party libraries. Gross responded that the impact is minimal—scikit‑learn would see no effect, and NumPy might require only about 15 lines of code. He noted strong interest from the scientific Python community, believing the pressure to build separate C extensions for nogil support will not be excessive. Carol Willing encouraged Gross to attend scientific computing conferences to gather more feedback.
Attendees also worried about the effect of introducing nogil on CPython development: some fear that test suites in CI would need to be doubled, while others worry that maintaining two CPython variants (with and without GIL) would increase maintenance burden.
Overall, participants were very excited and curious about the nogil mode, but major questions about the project's next steps remain unresolved.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.