Planet Python
Last update: November 29, 2026 10:47 AM UTC
November 28, 2026
LernerPython blog, from Reuven Lerner
Sorting a Counter by key: Ordering a text histogram with sorted
Let’s sort yesterday’s Python histogram by date! Counter is a dict, and the keys are ints, so sorted will do what we want:
The post Sorting a Counter by key: Ordering a text histogram with sorted appeared first on LernerPython.
November 28, 2026 07:00 AM UTC
November 27, 2026
Kay Hayen
Nuitka Release 4.4
This is to inform you about the new stable release of Nuitka. It is the extremely compatible Python compiler, “download now”.
November 27, 2026 11:00 PM UTC
death and gravity
reader 3.28 released – slow down, no AI redux
November 27, 2026 04:00 PM UTC
Tryton News
Security Release for issue 15271
Cédric Krier has discovered that the access rights on selection field can be bypassed by using the :string suffix.
Impact
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality: Low
- Integrity: None
- Availability: None
Workaround
There is no known workaround.
Resolution
All affected users should upgrade trytond to the latest version.
Affected versions per series:
trytond:- 8.2: <= 8.2.3
- 8.0: <= 8.0.14
- 7.8: <= 7.8.20
- 7.0: <= 7.0.61
Not affected versions per series:
trytond:- 8.2: >= 8.2.4
- 8.0: >= 8.0.15
- 7.8: >= 7.8.21
- 7.0: >= 7.0.62
Reference
Concerns?
Any security concerns should be reported on the bug-tracker at https://bugs.tryton.org/ with the confidential checkbox checked.
1 post - 1 participant
November 27, 2026 07:00 AM UTC
Security Release for issue 15266
Eva Luadora using AI tools has discovered that it is possible for a user to guess the temporary reset password of another user through repeated search.
Impact
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality: Low
- Integrity: High
- Availability: None
Workaround
There is no known workaround.
Resolution
All affected users should upgrade all trytond to the latest version.
Affected versions per series:
trytond:- 8.2: <= 8.2.3
- 8.0: <= 8.0.14
- 7.8: <= 7.8.20
- 7.0: <= 7.0.61
Not affected versions per series:
trytond:- 8.2: >= 8.2.4
- 8.0: >= 8.0.15
- 7.8: >= 7.8.21
- 7.0: >= 7.0.62
Reference
Concerns?
Any security concerns should be reported on the bug-tracker at https://bugs.tryton.org/ with the confidential checkbox checked.
1 post - 1 participant
November 27, 2026 07:00 AM UTC
Security Release for issue 15259 and 15263
EZO Labs Security using AI tools has discovered that it is possible for an authenticated user to read the temporary reset password and the password hash of any web user.
Impact
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality: Low
- Integrity: Low
- Availability: None
Workaround
A field access rule can be added for those fields to forbid the access to users.
Resolution
All affected users should upgrade all web_user module to the latest version.
Affected versions per series:
web_user:- 8.2: <= 8.2.0
- 8.0: <= 8.0.1
- 7.8: <= 7.8.2
- 7.0: <= 7.0.2
Not affected versions per series:
trytond:- 8.2: >= 8.2.1
- 8.0: >= 8.0.2
- 7.8: >= 7.8.3
- 7.0: >= 7.0.3
Reference
Concerns?
Any security concerns should be reported on the bug-tracker at https://bugs.tryton.org/ with the confidential checkbox checked.
1 post - 1 participant
November 27, 2026 07:00 AM UTC
Security Release for issue 15264
EZO Labs Security using AI tools has discovered that it is possible for a user to use the export data on resources without the access rights inherited from the linked record. The resources are attachments, notes and avatars.
Impact
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality: Low
- Integrity: None
- Availability: None
Workaround
The administrator can add global access rights on the resource directly.
Resolution
All affected users should upgrade all trytond to the latest version.
Affected versions per series:
trytond:- 8.2: <= 8.2.3
- 8.0: <= 8.0.14
- 7.8: <= 7.8.20
- 7.0: <= 7.0.61
Not affected versions per series:
trytond:- 8.2: >= 8.2.4
- 8.0: >= 8.0.15
- 7.8: >= 7.8.21
- 7.0: >= 7.0.62
Reference
Concerns?
Any security concerns should be reported on the bug-tracker at https://bugs.tryton.org/ with the confidential checkbox checked.
1 post - 1 participant
November 27, 2026 07:00 AM UTC
Security Release for issue 15258
EZO Labs Security using AI tools has discovered that it is possible for a user to read the temporary reset password of another user.
Impact
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality: High
- Integrity: High
- Availability: None
Workaround
The RPC request to common.db.reset_password can be blocked by a firewall to mitigate the possibility for an attacker to create a reset password for a targeted user.
Resolution
All affected users should upgrade all trytond to the latest version.
Affected versions per series:
trytond:- 8.2: <= 8.2.3
- 8.0: <= 8.0.14
- 7.8: <= 7.8.20
- 7.0: <= 7.0.61
Not affected versions per series:
trytond:- 8.2: >= 8.2.4
- 8.0: >= 8.0.15
- 7.8: >= 7.8.21
- 7.0: >= 7.0.62
Reference
Concerns?
Any security concerns should be reported on the bug-tracker at https://bugs.tryton.org/ with the confidential checkbox checked.
1 post - 1 participant
November 27, 2026 07:00 AM UTC
Security Release for issue 15256
EZO Labs Security using AI tools has discovered that it is possible for a user to change the companies, employees and roles it was assigned to.
Impact
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality: High
- Integrity: Low
- Availability: None
Workaround
There is no known workaround.
Resolution
All affected users should upgrade all trytond, company and user_role modules to the latest version.
Affected versions per series:
trytond:- 8.2: <= 8.2.3
- 8.0: <= 8.0.14
- 7.8: <= 7.8.20
- 7.0: <= 7.0.61
company:- 8.2: <= 8.2.0
user_role:- 8.2: <= 8.2.0
- 8.0: <= 8.0.2
- 7.8: <= 7.8.1
- 7.0: <= 7.0.1
Not affected versions per series:
trytond:- 8.2: >= 8.2.4
- 8.0: >= 8.0.15
- 7.8: >= 7.8.21
- 7.0: >= 7.0.62
company:- 8.2: >= 8.2.1
user_role:- 8.2: >= 8.2.1
- 8.0: >= 8.0.3
- 7.8: >= 7.8.2
- 7.0: >= 7.0.2
Reference
Concerns?
Any security concerns should be reported on the bug-tracker at https://bugs.tryton.org/ with the confidential checkbox checked.
1 post - 1 participant
November 27, 2026 07:00 AM UTC
Security Release for issue 15257
Cédric Krier has discovered that the server accept compressed request from user without enforcing size limit which makes it vulnerable to zip bomb attacks.
This is a continuation of Security Release for issue #13142
Impact
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality: None
- Integrity: None
- Availability: High
Workaround
A proxy can be deployed in front of the trytond server to forbid this kind of request.
Resolution
All affected users should upgrade trytond to the latest version.
Affected versions per series:
trytond:- 8.2: <= 8.2.3
- 8.0: <= 8.0.14
- 7.8: <= 7.8.20
- 7.0: <= 7.0.61
Not affected versions per series:
trytond:- 8.2: >= 8.2.4
- 8.0: >= 8.0.15
- 7.8: >= 7.8.21
- 7.0: >= 7.0.62
Reference
Concerns?
Any security concerns should be reported on the bug-tracker at https://bugs.tryton.org/ with the confidential checkbox checked.
1 post - 1 participant
November 27, 2026 07:00 AM UTC
Jaime Buelta
What a year, huh?
This week marks a full year since the release of Opus 4.5 (24th Nov 2025). And it feels like a decade has happened since then in software. Opus 4.5 was the model that really turned agentic coding from a curiosity that was somehow useful into a real strategy that you could use day to day.But it didn’t stop there. We got new releases, with the Big Two frontier labs (OpenAI and Anthropic) consolidating into models with Small (Luna/Haiku), Medium (Terra/Sonnet), Large (Sol/Opus) and a new XLarge class first introduced with the ominous... Read More
November 27, 2026 01:38 AM UTC
November 26, 2026
LernerPython blog, from Reuven Lerner
Do programmers have a future?
The short answer: Yes, absolutely. For several decades now, a degree in computer science (or a related field) has almost guaranteed employment, with good salaries, excellent benefits, and comfortable working […]
The post Do programmers have a future? appeared first on LernerPython.
November 26, 2026 01:23 PM UTC
Python holidays module: Finding the earliest Thanksgiving
What was the earliest Thanksgiving in the last 100 years? The latest? Python can tell us:
The post Python holidays module: Finding the earliest Thanksgiving appeared first on LernerPython.
November 26, 2026 07:00 AM UTC
Talk Python to Me
#570: Free-Threaded Python
NumPy already releases the GIL. So threads should already pay off for your NumPy code, right? Christopher Ariza tested that. He summed the rows of a 10,000 by 10,000 array on Python 3.14. Sequential took 360 milliseconds. A thread pool took 373, slower than doing nothing. The same code on free- threaded Python 3.14t took 83.7 milliseconds. Free-threaded Python is officially supported as of 3.14. The GIL isn’t gone, though. It’s a zombie. Import one compiled package that hasn’t opted in, psycopg2 for example, and the GIL comes back for your entire process. You get a warning, not an error. Chris is the creator of StaticFrame and its C extension library ArrayKit. We dig into when threads beat plain NumPy, how to tell if you’re actually running free-threaded, and conditional-futures, his drop-in thread pool that stops your code from getting slower when the GIL wakes back up.
November 26, 2026 12:17 AM UTC
November 25, 2026
The Python Coding Stack
Just a Quick Task
A small job. A whole new world.
November 25, 2026 04:30 PM UTC
Ned Batchelder
Human sorting, hardened
“Human sorting” is sorting strings (usually file names) so that any numbers in the names come out in the right order. For example, “file10.txt” should come after “file2.txt”, but regular sorting will put them in the wrong order. I’ve written twice before about the function to do this (Human sorting and Human sorting improved), but there’s more to say about it.
One effect of AI these days is bug reports for obscure edge cases. As a maintainer, it’s been a challenge first to read through them all, and then to decide which ones deserve a fix. It’s tempting to fix every little thing no matter how unlikely it is to happen in the real world. But every fix costs time, energy and focus. Every fix comes with risks in the form of new bugs or changed behavior. So some long-tail issues should be marked as “won’t fix.”
But this one intrigued me: if a file name includes a numeric component with 4301 digits, then the human sorting function fails. Buh?
Before we get to the current problem, here’s the original “buggy” code, slightly simplified:
def human_key(s: str) -> tuple[list[str | int], str]:
"""Turn a string into a sortable value that works how humans expect.
"z23A" -> (["z", 23, "A"], "z23A")
"""
def try_int(s: str) -> str | int:
"""If `s` is a number, return an int, else `s` unchanged."""
try:
return int(s)
except ValueError:
return s
parts = re.split(r"(\d+)", s)
split_key = [try_int(c) for c in parts]
return (split_key, s)
def human_sorted(strings: Iterable[str]) -> list[str]:
"""Sort the given iterable of strings the way that humans expect."""
return sorted(strings, key=human_key)
It splits the string into parts alternating between runs of digits and runs
of non-digits. It uses try_int on all of them, which turns the digits
into ints and leaves the non-digits as strings. That gives us a list of words
and numbers that can be compared to do the sort we need.
The problem now is with that 4301-digit run. Since 2022, Python’s
string-to-integer conversion has had a limit on the number of digits that can be
converted. This is to prevent denial of service attacks based on the quadratic
time to convert a string to an int. The default limit is 4300 digits. If a
string is longer than that, int() raises a ValueError.
But we were counting on ValueError to mean “this isn’t an integer”, and to
separate words from digits. Now that too-long number makes try_int return
the string un-converted, and using it as a sort key will try to compare an int
to a string, failing with:
TypeError: '<' not supported between instances of 'int' and 'str'
Of course, it’s absurd to be concerned that an actual file name will include a run of more than 4300 digits. But I’ve been tweaking this function over decades, and I like fiddling with it. The comments on the original post offered a number of alternative implementations, a few of which would have avoided this problem.
Rather than try to convert all of the parts of the name, we know from how
re.split works that the parts will alternate between words and numbers,
starting with a word even if it’s just an empty string. So we can attempt
conversion only for the parts that we know are digits.
First, we replace try_int with a function to safely convert digit
spans into numbers:
def number(s: str) -> float:
"""Convert s to a number with no errors."""
try:
return int(s)
except ValueError:
# This only happens if the number is too large to convert to an int.
return float("inf")
Now we can create split_key differently by only converting the
odd-numbered parts:
split_key = [(number(p) if i % 2 else p) for i, p in enumerate(parts)]
It’s tempting to check whether a part starts with a digit:
split_key = [(number(p) if p[:1].isdigit() else p) for p in parts]
But isdigit() gets us into Unicode difficulties because \d and
isdigit() disagree on what count as digits. Something odd like
"a1²b" would be split into ['a', '1', '²b'], and
'²'.isdigit() is true, so now we’d be mistaking words for numbers.
Another even-odd approach, but it’s too fancy:
converters = itertools.cycle([str, number])
split_key = [fn(part) for fn, part in zip(converters, parts)]
In the end, though this is a long-tail bug, I fixed the human sort function; it was a tiny isolated fix. Also, I don’t like having a function that works only 99.9999% of the time. And maybe it’s still not done: there are probably other odd edge cases that could be a problem here. If I hear of those, I might make more fixes.
The AI fire-hose of issues and pull requests requires me to exercise and strengthen my “won’t fix” muscle. But I also get to choose where to make a fix just because it pleases me.
Update: Jeff Epler suggested a few clever alternatives. The 4300-digit limit is only applied to base 10 conversion. If we interpret digit spans as base 16, there’s no limit on length, and the resulting ints will sort the same as their base 10 counterparts. No helper function is needed at all. As an added bonus, there are now no floats, so the type hinting can be more straighforward. The result is satisfyingly compact:
def _human_key(s: str) -> tuple[list[str | int], str]:
"""Turn a string into a list of string and number chunks.
"z23a" -> (["z", 35, "a"], "z23a")
Runs of digits are converted using base 16 because it has no digit limit,
and the numbers will sort the same as if they were interpreted as base 10.
The original string is appended as a last value to ensure the key is unique
enough so that "x1y" and "x001y" can be distinguished.
"""
parts = re.split(r"(\d+)", s)
split_key = [(int(p, base=16) if i % 2 else p) for i, p in enumerate(parts)]
return (split_key, s)
def human_sorted(strings: Iterable[str]) -> list[str]:
"""Sort the given iterable of strings the way that humans expect.
Numeric components in the strings are sorted as numbers.
Returns the sorted list.
"""
return sorted(strings, key=_human_key)
Another of his suggestions was to use a different int() substitute. We
don’t need actual integers in the key, just something that will sort the same
way as integers. His idea was to turn digit runs into a tuple of (length,
value) with no conversion at all!
split_key = [
(
(len(p2 := p.lstrip("0")), p2)
if i % 2 else p
)
for i, p in enumerate(parts)
]
I haven’t done timings of any of these solutions. This last solution avoids the quadratic time of integer conversion, but would likely be slower for the real-world data we find in file names.
November 25, 2026 12:46 PM UTC
Kevin Renskers
Announcing Oxen, a simple self-hosted time-tracking and invoicing service
Open source, self-hosted, and made with Django.
November 25, 2026 10:31 AM UTC
LernerPython blog, from Reuven Lerner
Python holidays package: Find the date of Thanksgiving
Tomorrow is Thanksgiving in the US. Use the “holidays” package to calculate its date in Python:
The post Python holidays package: Find the date of Thanksgiving appeared first on LernerPython.
November 25, 2026 07:00 AM UTC
Python Bytes
#506 Raft, Rust, and release day
Topics include De-fanging dangerous triggers in GitHub Actions across an organization, RQlite - The fault-tolerant relational database built on SQLite., diskcache-oxide now supports Django, and.
November 25, 2026 06:28 AM UTC
Armin Ronacher
Abolish Lock Poisoning
November 25, 2026 12:00 AM UTC
November 24, 2026
EuroPython Society
List of EPS Board Candidates for 2026/2027
At this year’s EuroPython Society General Assembly (GA), scheduled for Sunday, 29 November 2026, at 18:00 CET, we will elect a new Board of the EuroPython Society for the 2026/2027 term.
List of Board Candidates
In accordance with the EPS bylaws, the Board consists of one
November 24, 2026 10:51 PM UTC
LernerPython blog, from Reuven Lerner
Announcing: Teleprompter
I record a lot of videos, both for my courses and for my YouTube channel. And while it’s not a huge problem, I’ve always been frustrated that the notes that […]
The post Announcing: Teleprompter appeared first on LernerPython.
November 24, 2026 08:50 PM UTC
PyCoder’s Weekly
Issue #762: Refactoring With AI, Binary Search, Race Conditions, and More (2026-11-24)
November 24, 2026 07:30 PM UTC
Trey Hunner
Python Black Friday & Cyber Monday sales (2026)
November 24, 2026 05:00 PM UTC
LernerPython blog, from Reuven Lerner
The end of enterprise software — or, a world of custom solutions
Let’s say you need a new shirt. In 2026, you have so many options for buying that shirt. You can shop online. You can (horrors!) go into a physical store. […]
The post The end of enterprise software — or, a world of custom solutions appeared first on LernerPython.
