PEP 741: C API to configure Python initialization

 — 

PEP 741 story

The Starry Night (1889) by Vincent Van Gogh

Sometimes, writing a PEP can be a wild ride. It took two whole years between the early discussions and getting PEP 741 eventually accepted by the Steering Council. The API is only made of 18 functions, but it took more than 200 messages to design properly these …

Category: cpython Tags:

Add PyUnicodeWriter C API

 — 
La Danse - Matisse

In May, I designed a new C API to build a Python str object: the PyUnicodeWriter API. Many people were involved in the design and the discussion was quite long. The C API Working Group helped to design a better and more convenient API. It took me basically a whole …

Category: cpython Tags:

Status of the Python Limited C API (March 2024)

 — 
Ghibli - Spirited Away

In Python 3.13, I made multiple enhancements to make the limited C API more usable:

  • Add 14 functions to the limited C API.
  • Make the special debug build Py_TRACE_REFS compatible with the limited C API.
  • Enhance Argument Clinic to generate C code using the limited C API.
  • Add an …
Category: cpython Tags:

Remove private C API functions

 — 
Mucha paintaing: the 4 seasons

In Python 3.13 alpha 1, I removed more than 300 private C API functions. Even if I announced my plan early in July, users didn't "embrace" my plan and didn't agree with the rationale. I reverted 50 functions in the alpha 2 release to calm down the situation and …

Category: cpython Tags:

Design the API of a new PyDict_GetItemRef() function

 — 

Last June, I proposed adding a new PyDict_GetItemRef() function to Python 3.13 C API. Every aspect of the API design was discussed in length. I will explain how the API was designed, to finish with the future creation of C API Working Group.

Psyche Revived by Cupid's Kiss

Photo: Psyche Revived by Cupid's Kiss …

Category: cpython Tags:

My contributions to Python (July 2023)

 — 

In 2023, between May 4 and July 8, I made 144 commits in the Python main branch. In this article, I describe the most important Python contributions that I made to Python 3.12 and Python 3.13 in these months.

Foxes in Love: Cuddle

Drawing: Foxes in Love: Cuddle

Summary

  • Add PyImport_AddModuleRef() and …
Category: cpython Tags:

Convert macros to functions in the Python C API

 — 
L'oeil du cyclone - Théo Grosjean

Drawing: "L'oeil du cyclone" by Théo Grosjean.

Convert macros to functions

For 4 years, between Python 3.7 (2018) and Python 3.12 (2022), I made many changes on macros in the Python C API to make the API less error prone (avoid macro pitfalls) and better define the API …

Category: cpython Tags:

Debug a Python reference leak

 — 
Childhood memories in the countryside

This morning, I got this email from the buildbot-status mailing list:

The Buildbot has detected a new failure on builder PPC64LE Fedora Rawhide Refleaks 3.x while building Python.

I get many of buildbot failures per month (by email), but I like to debug reference leaks: they are more challenging …

Category: cpython Tags:

Python C API: Add functions to access PyObject

 — 
A spider in my bedroom

The PyObject structure prevents indirectly to optimize CPython. We will see why and how I prepared the C API to make this structure opaque. It took me 1 year and a half to add functions and to introduce incompatible C API changes (fear!).

In February 2020, I started by adding …

Category: cpython Tags:

C API changes between Python 3.5 to 3.10

 — 
Homer Simpson hiding

I'm trying to enhance and to fix the Python C API for 5 years. My first goal was to shrink the C API without breaking third party C extensions. I hid many private functions from the public functions: I moved them to the "internal C API". I also deprecated and …

Category: cpython Tags:

© Victor Stinner 2016

Powered by Pelican