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:

Locale Bugfixes in Python 3

 — 
Unicode Mixed Bag

This article describes a few locales bugs that I fixed in Python 3 between 2012 (Python 3.3) and 2018 (Python 3.7):

  • Support non-ASCII decimal point and thousands separator
  • Crash with non-ASCII decimal point
  • LC_NUMERIC encoding different than LC_CTYPE encoding
  • LC_MONETARY encoding different than LC_CTYPE encoding
  • Tests non-ASCII locales …
Category: cpython Tags:

Python 3, locales and encodings

 — 
I □ Unicode

Recently, I worked on a change which looked simple: move the code to initialize the sys.stdout encoding before Py_Initialize(). While I was on it, I also decided to move the code which selects the Python "filesystem encoding". I didn't expect that I would spend 2 weeks on these issues …

Category: cpython Tags:

Python 3.7 UTF-8 Mode

 — 
Sunrise

Since Python 3.0 was released in 2008, each time an user reported an encoding issue, someone showed up and asked why Python does not "simply" always use UTF-8. Well, it's not that easy. UTF-8 is the best encoding in most cases, but it is still not the best encoding …

Category: python Tags:

Python 3.7 and the POSIX locale

 — 
Bee

During the childhood of Python 3, encodings issues were common, even on well configured systems. Python used UTF-8 rather than the locale encoding, and so commonly produced mojibake. For these reasons, when users complained about the Python behaviour with the POSIX locale, bug reports were closed with a message like …

Category: python Tags:

Python 3.6 now uses UTF-8 on Windows

 — 

September 2016, a few days before the CPython core dev sprint, Steve Dower proposed two major backward incompatible changes for Python 3.6 on Windows: PEP 528: Change Windows console encoding to UTF-8 and PEP 529: Change Windows filesystem encoding to UTF-8. At the first read, I was sure that …

Category: python Tags:

Python 3.2 Painful History of the Filesystem Encoding

 — 

Between Python 3.0 released in 2008 and Python 3.4 released in 2014, the Python filesystem encoding changed multiple times. It took 6 years to choose the best Python filesystem encoding on each platform.

I have been officially promoted as a core developer in January 2010 by Martin von …

Category: python Tags:

Python 3.1 surrogateescape error handler (PEP 383)

 — 

In my previous article, I wrote that os.listdir(str) ignored silently undecodable filenames in Python 3.0 and that lying on the real content of a directory looks like a very bad idea.

Martin v. Löwis found a very smart solution to this problem: the surrogateescape error handler.

This …

Category: python Tags:

© Victor Stinner 2016

Powered by Pelican