Python 3.8 Launch, C Extensions, and Cybersecurity

·26m 57s
Shared point

Understanding Python C Extensions

Exploring how to extend Python with C allows developers to bridge the gap between high-level ease and low-level control. This is particularly useful for:

Performance optimizations: Moving heavy computational tasks to C.
Accessing OS-level APIs: Interfacing with existing libraries that lack native Python bindings.

"Everything that gets passed around is a Python object pointer... even numbers."

Implementation Process

The process involves declaring arguments using PyArg_ParseTuple, working with PyObject pointers, and ensuring proper conversion between C types and Python objects. Crucially, the Global Interpreter Lock (GIL) helps manage safety, while setup.py configuration simplifies the compilation into a distributable module.

Python 3.8 Officially Released

Python 3.8 has moved from beta to its final release. The update introduces significant improvements, including:

Async REPL: Type python -m asyncio to use an async native environment.
Improved Warnings: Better diagnostics for identity comparison errors (is instead of ==) and missing commas in data structures.
Syntax Changes: Enhanced support for iterable unpacking in return statements.

Security and Legacy Risks

Following official guidance from the NCSC, upgrading from Python 2 to 3 is now critical to avoid severe security vulnerabilities. Maintaining obsolete versions of libraries increases the global attack surface, as demonstrated by historical incidents like the Equifax breach.

Community Resources and Hardware

News for Python: The community is exploring sites like news.python.sc for curated content.
GPU Hardware: For high-end machine learning, companies like Lambda offer dedicated workstations as cost-effective alternatives to expensive cloud instances.
Auto Formatters: Using tools like Black, YAPF, or autopep8 removes the subjective friction from code reviews, allowing teams to focus on architecture over style.

Topics

Chapters

6 chapters
Python Bytes
AI chat — answers grounded in episodes