Skip to content

gh-121249: Deprecate using F/D type codes in the struct module#152309

Merged
vstinner merged 6 commits into
python:mainfrom
skirpichev:deprecate-FD-codes/121249
Jun 30, 2026
Merged

gh-121249: Deprecate using F/D type codes in the struct module#152309
vstinner merged 6 commits into
python:mainfrom
skirpichev:deprecate-FD-codes/121249

Conversation

@skirpichev

@skirpichev skirpichev commented Jun 26, 2026

Copy link
Copy Markdown
Member

@read-the-docs-community

read-the-docs-community Bot commented Jun 26, 2026

Copy link
Copy Markdown

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO F/D formats soft deprecation should be removed from Doc/deprecations/soft-deprecations.rst, since the formats are now hard deprecated.

Comment thread Misc/NEWS.d/next/Library/2026-06-26-19-01-13.gh-issue-121249.p1SBW0.rst Outdated
Comment thread Doc/deprecations/pending-removal-in-3.21.rst Outdated
Comment thread Doc/whatsnew/3.16.rst Outdated
Comment thread Lib/test/test_struct.py Outdated
Comment thread Lib/test/test_struct.py Outdated
with self.subTest(format=f):
with warnings.catch_warnings():
warnings.simplefilter("error", DeprecationWarning)
self.assertRaises(DeprecationWarning, struct.pack, f, z)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already check with self.assertWarns(DeprecationWarning): below. I'm not sure that checking for DeprecationWarning exception is useful.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do this in other places.

Comment thread Lib/test/test_struct.py Outdated
Comment thread Doc/whatsnew/3.16.rst
skirpichev and others added 2 commits June 30, 2026 03:04
Co-authored-by: Victor Stinner <vstinner@python.org>
@skirpichev

Copy link
Copy Markdown
Member Author

IMO F/D formats soft deprecation should be removed from Doc/deprecations/soft-deprecations.rst, since the formats are now hard deprecated.

Sure, I completely forgot that file. Done, with other requested changes.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner vstinner merged commit 40795f2 into python:main Jun 30, 2026
58 checks passed
@vstinner

Copy link
Copy Markdown
Member

Merged, thanks.

@skirpichev skirpichev deleted the deprecate-FD-codes/121249 branch June 30, 2026 10:34
maurycy added a commit to maurycy/cpython that referenced this pull request Jul 1, 2026
* main: (266 commits)
  pythongh-151626: Fix tests that fail when PYTHONPYCACHEPREFIX is set (pythonGH-151952)
  pythongh-152728: IDLE - move 3 toplevel fix_xyz functions to idlelb.util (python#152729)
  pythongh-152711: Add pythoninfo-build command to Platforms/Android (python#152713)
  pythongh-152715: Add pythoninfo-build command to Platforms/Apple (python#152716)
  pythongh-152433: Windows: enable mmapmodule for UWP (python#152473)
  pythongh-152433: Windows: use GetFileSizeEx instead of GetFileSize for memory mapped files (python#152383)
  pythonGH-81881: Raise `SpecialFileError` for sockets and devices in `shutil.copyfile` (python#142693)
  pythongh-152502: Detect the curses mouse interface and is_* methods portably (pythonGH-152705)
  pythongh-145857: Replace `DELETE_GLOBAL` with `PUSH_NULL; STORE_GLOBAL` (pythonGH-146314)
  pythongh-145854: Replace `DELETE_NAME` with `PUSH_NULL; STORE_NAME` (pythonGH-146006)
  pythongh-152680: Detect container/VM in test.pythoninfo (python#152668)
  pythongh-152682: Fix NULL dereference on OOM in `symtable_visit_type_param_bound_or_default` (python#152684)
  pythongh-151881: Skip tk_inactive negativity check on Windows (pythonGH-152683)
  pythongh-152546: Refactor `mappingproxy.__new__` to use `PyDictProxy_New` (python#152547)
  pythongh-151126: Fix a possible crash during the startup with no memory under `Py_STACKREF_DEBUG` (python#152478)
  pythongh-152635: Raise MemoryError when the lock allocation fails in `_interpchannels.create()` (python#152642)
  pythongh-151029: Fix `test_remote_exec_deleted_static_executable` on static installed builds (pythonGH-152653)
  pythongh-121249: Deprecate using F/D type codes in the struct module (python#152309)
  pythongh-152192: Fix JUMP_BACKWARD passing a truncated oparg to the jit tracer (pythonGH-152382)
  Don't require the `_test{internal}capi` modules in `test_monitoring.py` (python#152311)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants