Python 3.7 Development Mode

 — 
Ready to race

This article describes the discussion on the design of the development mode (-X dev) that I added to Python 3.7 and how it has been implemented.

The development mode enables runtime checks which are too expensive to be enabled by default. It can be enabled by python3 -X dev …

Category: python Tags:

Pass the Python thread state explicitly

 — 
Python C API

Keeping Python competitive

I'm trying to find ways to make Python more efficient for many years, see for example my discussion at the Language Summit during Pycon US 2017: Keeping Python competitive (LWN article); slides. At EuroPython 2019 (Basel), I gave the keynote "Python Performance: Past, Present and Future": slides …

Category: python Tags:

Graphics bugs in Firefox and GNOME

 — 

After explaining how to Debug Hybrid Graphics issues on Linux, here is the story of four graphics bugs that I had in GNOME and Firefox on my Fedora 30 between May 2018 and September 2019: bugs in gnome-shell, Gtk, Firefox and mutter.

Glitch

gnome-shell freezes

In May 2018, six months after …

Category: linux Tags:

Debug Hybrid Graphics issues on Linux

 — 

Hybrid Graphics is a complex hardware and software solution to achieve longer laptop battery life: an integrated graphics device is used by default, and a discrete graphics device with higher graphics performances is enabled on demand.

Hybrid Graphics

If it is designed and implemented carefully, users should not notice that a laptop …

Category: linux Tags:

Split Include/ directory in Python 3.8

 — 
Private way. Trespassers and those disposing rubbish will be prosecuted.

In September 2017, during the CPython sprint at Facebook, I proposed my idea to create A New C API for CPython. I'm still working on the Python C API at: pythoncapi.readthedocs.io.

My analysis is that the C API leaks too many implementation details which prevent to optimize Python …

Category: python Tags:

Python 3.8 sys.unraisablehook

 — 
Hidden kitten

I added a new sys.unraisablehook function to allow to set a custom hook to control how "unraisable exceptions" are handled. It is already testable in Python 3.8 beta1, released last week!

An "unraisable exception" is an error which happens when Python cannot report it to the caller. Examples …

Category: python Tags:

asyncio WSASend() memory leak

 — 
Leaking tap

I fixed multiple bugs in asyncio ProactorEventLoop previously. But test_asyncio still failed sometimes. I noticed a memory leak in test_asyncio which will haunt me for 1 year in 2018...

Yet another example of a test failure which looks harmless but hides a critical bug. The bug is that sending a …

Category: cpython Tags:

asyncio: WSARecv() cancellation causing data loss

 — 
Unlocked lock

In December 2017, Yury Selivanov pushed the long awaited start_tls() function.

A newly added test failed on Windows. Later, the test started to fail randomly on Linux as well. In fact, it was a well hidden race condition in the asynchronous handshake of SSLProtocol which will take 5 months of …

Category: cpython Tags:

Asyncio: Proactor ConnectPipe() Race Condition

 — 
Pipes

Between December 2014 and January 2015, once I succeeded to fix the root issue of the random asyncio crashes on Windows (Proactor Cancellation From Hell), I fixed more race conditions and bugs in ProactorEventLoop:

  • ConnectPipe() Race Condition
  • Race Condition in BaseSubprocessTransport._try_finish()
  • Close the transport on failure: ResourceWarning
  • Cleanup code …
Category: cpython Tags:

Asyncio: Proactor Cancellation From Hell

 — 
South Park Hell

Between 2014 and 2015, I was working on the new shiny asyncio module (module added to Python 3.4 released in March 2014). I helped to stabilize the Windows implementation because... well, nobody else was paying attention to it, and I was worried that test_asyncio randomly crashed on Windows.

One …

Category: cpython Tags:

© Victor Stinner 2016

Powered by Pelican