Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.3k
gh-146092: Raise MemoryError on allocation failure in _zoneinfo#146165
gh-146092: Raise MemoryError on allocation failure in _zoneinfo#146165vstinner merged 3 commits intopython:mainfrom
Conversation
StanFromIreland left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Uh oh!
There was an error while loading.Please reload this page.
vstinner commentedMar 19, 2026
parse_transition_rule() is only used in parse_tz_str() and parse_tz_str() raises ValueError on parse_transition_rule() failure. Other parse_transition_rule() error paths don't set an exception. So I didn't add PyErr_NoMemory() in parse_transition_rule(). |
StanFromIreland commentedMar 19, 2026
Can you please clarify why? The |
vstinner commentedMar 19, 2026
I tried that but I ended up with strange exceptions from a subfunction. |
StanFromIreland commentedMar 20, 2026
Oh yes, I see, I was able to reproduce that. Instead we could do: if (parse_transition_rule(&p, transitions[i])) {- PyErr_Format(PyExc_ValueError,- "Malformed transition rule in TZ string: %R",- tz_str_obj);+ if (!PyErr_ExceptionMatches(PyExc_MemoryError)) {+ PyErr_Format(PyExc_ValueError,+ "Malformed transition rule in TZ string: %R",+ tz_str_obj);+ } goto error; } }Since |
vstinner commentedMar 20, 2026
Ok, I updated parse_transition_rule() to raise MemoryError and use |
vstinner commentedMar 20, 2026
@StanFromIreland: Please review the updated PR. |
StanFromIreland left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, thanks Victor!
6450b1d intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…pythonGH-146165)(cherry picked from commit6450b1d)Co-authored-by: Victor Stinner <vstinner@python.org>
…pythonGH-146165)(cherry picked from commit6450b1d)Co-authored-by: Victor Stinner <vstinner@python.org>
GH-146223 is a backport of this pull request to the3.14 branch. |
vstinner commentedMar 20, 2026
Merged, thanks for your reviews! |
GH-146224 is a backport of this pull request to the3.13 branch. |
* upstream/main: (1475 commits) Docs: replace all `datetime` imports with `import datetime as dt` (python#145640)pythongh-146153: Use `frozendict` in pure python fallback for `curses.has_key` (python#146154)pythongh-138234: clarify returncode behavior for subprocesses created with `shell=True` (python#138536)pythongh-140947: fix contextvars handling for server tasks in asyncio (python#141158)pythonGH-100108: Add async generators best practices section (python#141885)pythonGH-145667: Merge `GET_ITER` and `GET_YIELD_FROM_ITER` (pythonGH-146120)pythongh-146228: Better fork support in cached FastPath (python#146231)pythongh-146227: Fix wrong type in _Py_atomic_load_uint16 in pyatomic_std.h (pythongh-146229)pythongh-145980: Fix copy/paste mistake in binascii.c (python#146230)pythongh-146092: Raise MemoryError on allocation failure in _zoneinfo (python#146165)pythongh-91279: Note `SOURCE_DATE_EPOCH` support in `ZipFile.writestr()` doc (python#139396)pythongh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (python#146201)pythongh-143930: Reject leading dashes in webbrowser URLspythongh-145916: Soft-deprecate ctypes.util.find_library (pythonGH-145919)pythongh-146205: Check the errno with != 0 in close impls in select module (python#146206)pythongh-146171: Fix nested AttributeError suggestions (python#146188)pythongh-146099: Optimize _GUARD_CODE_VERSION+IP via function version symbols (pythonGH-146101)pythongh-145980: Add support for alternative alphabets in the binascii module (pythonGH-145981)pythongh-145754: Update signature retrieval in unittest.mock to use forwardref annotation format (python#145756)pythongh-145177: Add emscripten run --test, uses test args from config.toml (python#146160) ...
Uh oh!
There was an error while loading.Please reload this page.
PyErr_NoMemoryin_zoneinfoload_dataandts_to_local#146092