Python: Base64 Gets Better and Security Tightens Up
The Python core team shipped 20 pull requests with some fantastic improvements! The biggest story is enhanced Base64 and Base32 encoding with optional padding support, plus important security fixes and performance optimizations. We also see some great community contributions improving documentation and development workflows.
Duration: PT4M29S
Transcript
Hey there, Python friends! Welcome back to another episode of the Python podcast. I'm your host, and wow, do we have some exciting updates from the CPython repository to share with you today, April 5th, 2026. Grab your favorite beverage because we've got 20 merged pull requests and 15 additional commits to dive into!
Let's start with the star of today's show - a fantastic enhancement to Python's encoding capabilities. Serhiy Storchaka just landed a major improvement to Base32 and Base64 encoding that developers have been waiting for since 2008! This change adds a new `padded` parameter to functions in both the `binascii` and `base64` modules.
Here's why this is so cool - you can now control whether padding characters get added during encoding, and whether they're required during decoding. This is huge for anyone working with APIs or systems that handle Base64 data differently. The cherry on top? The `base64.urlsafe_b64decode` function no longer requires padding by default, making it much more flexible for real-world use cases. With over 460 lines of changes across 13 files, this is the kind of thoughtful improvement that makes Python even more developer-friendly.
Speaking of improvements, the optimization team has been busy too! Donghee Na delivered two related pull requests that enhance Python's bytecode optimizer. The first adds constant-folding support for set containment operations with frozensets - basically making your `item in my_frozenset` checks faster. But here's the clever part: the follow-up PR prevents constant folding when dealing with container types, ensuring we don't break anything while chasing performance gains. This is exactly the kind of careful, incremental improvement that makes Python faster without sacrificing reliability.
Security got some love today as well. Stan Ulbrych fixed two heap-buffer-overflow issues in the `_zoneinfo` module - the kind of low-level bugs that could cause real problems if left uncaught. These fixes were important enough to get backported to both Python 3.13 and 3.14, showing how seriously the core team takes security issues.
On the development workflow side, Ezio Melotti made a smart security improvement by adding explicit permission declarations to all reusable GitHub workflows. It might sound technical, but this kind of infrastructure work helps keep the entire Python development process secure and transparent.
I also want to highlight some great community contributions. Stan from Ireland was busy fixing typos and standardizing documentation, while Hugo van Kemenade updated the regex documentation to address syntax warnings. These might seem like small changes, but they add up to make Python's documentation clearer and more consistent for everyone.
The profiling tools got an upgrade too, with Ivona Stojanovic adding self-time display to flamegraph tooltips. If you've ever used Python's profiler to debug performance issues, you'll appreciate being able to see exactly how much time a function spends in its own code versus calling other functions.
Pablo Galindo Salgado made an interesting architectural change by moving garbage collection statistics to heap allocation instead of embedding them in the interpreter state. This shrinks the interpreter by about 1.6 KB and keeps frequently-accessed fields at predictable memory locations - the kind of optimization that helps external profilers and debuggers work more reliably.
Today's focus is really about these incremental improvements that make Python better in small but meaningful ways. Whether you're encoding data, optimizing performance, or just reading documentation, today's changes touch on fundamental parts of the Python experience.
If you're working with Base64 encoding in your projects, definitely check out the new padding options in Python 3.15 - they might solve some compatibility headaches you've been dealing with. And if you're contributing to Python or any open source project, take inspiration from today's contributors who tackled everything from major features to documentation typos.
That's a wrap on today's Python updates! Keep coding, keep learning, and remember - every small improvement makes the whole ecosystem better. Until next time, happy Pythoning!