Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-108907: ctypes: Document _type_ codes#145837

Merged
encukou merged 2 commits intopython:mainfrom
encukou:doc-_type_
Mar 23, 2026
Merged

gh-108907: ctypes: Document _type_ codes#145837
encukou merged 2 commits intopython:mainfrom
encukou:doc-_type_

Conversation

@encukou
Copy link
Member

@encukouencukou commentedMar 11, 2026
edited by github-actionsbot
Loading

Add_SimpleCData._type_ docs.

Add type codes to the summary table.

Cross-linkstruct,array, andctypes; throw innumpy too. (Anyone wanting to add a code should be aware of those.)

Addpy_object, andVARIANT_BOOL for completeness.


📚 Documentation preview 📚:https://cpython-previews--145837.org.readthedocs.build/

Add `_SimpleCData._type_` docs.Add type codes to the summary table.Cross-link `struct`, `array`, and `ctypes`; throw in `numpy` too.(Anyone wanting to add a code should be aware of those.)Add `py_object`, and `VARIANT_BOOL` for completeness.

.. seealso::

The :mod:`array` and :ref:`struct <format-characters>` modules,
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need this? It looks like type codes match, when same data type is present (and not an alias).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

They match, and I'd like to keep it that way.

I'd like to add this note, for a very specific case: when adding a new one (in stdlib or a third-party module), it's good to be aware of the others -- and more importantly, of the fact that there are several lists to be aware of.

Copy link
Member

Choose a reason for hiding this comment

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

I see point of doing this for third-party modules, but for stdlib I would rather advocate more simple invariant to keep: struct/array/memoryview should usesame type codes. Modulo well documented differences:

  1. some fundamental types in the ctypes module are implemented as aliases.
  2. some just aren't supported by the struct (e.g. long double, perhaps it's not forever) or the ctype (e.g. Pascal strings).

I suggest just add references to the struct and the array modules. And a more detailed note about the NumPy.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That's a goodinvariant design goal, and I hope these notes will help us do that.

But, I'm assuming most readers want docs for one specific module. For those, readers separate tables are better.

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
@encukou
Copy link
MemberAuthor

Thank you for the review!

I'll merge now; follow-ups welcome :)

@encukouencukou merged commit1114d7f intopython:mainMar 23, 2026
28 checks passed
@github-project-automationgithub-project-automationbot moved this fromTodo toDone inDocs PRsMar 23, 2026
@encukouencukou deleted the doc-_type_ branchMarch 23, 2026 12:41
@encukouencukou added the needs backport to 3.14bugs and security fixes labelMar 23, 2026
@miss-islington-app
Copy link

Thanks@encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMar 23, 2026
Add `_SimpleCData._type_` docs.Add type codes to the summary table.Cross-link `struct`, `array`, and `ctypes`; throw in `numpy` too.(Anyone wanting to add a code should be aware of those.)Add `py_object`, and `VARIANT_BOOL` for completeness.(cherry picked from commit1114d7f)Co-authored-by: Petr Viktorin <encukou@gmail.com>
@bedevere-app
Copy link

GH-146328 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMar 23, 2026
encukou added a commit that referenced this pull requestMar 23, 2026
gh-108907: ctypes: Document _type_ codes (GH-145837)Add `_SimpleCData._type_` docs.Add type codes to the summary table.Cross-link `struct`, `array`, and `ctypes`; throw in `numpy` too.(Anyone wanting to add a code should be aware of those.)Add `py_object`, and `VARIANT_BOOL` for completeness.(cherry picked from commit1114d7f)Co-authored-by: Petr Viktorin <encukou@gmail.com>
CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull requestMar 23, 2026
…8577* 'main' of github.com:python/cpython:pythongh-146197: Run -m test.pythoninfo on the Emscripten CI (python#146332)pythongh-146325: Use `test.support.requires_fork` in test_fastpath_cache_cleared_in_forked_child (python#146330)pythongh-146197: Add Emscripten to CI (python#146198)pythongh-143387: Raise an exception instead of returning None when metadata file is missing. (python#146234)pythongh-108907: ctypes: Document _type_ codes (pythonGH-145837)pythongh-146175: Soft-deprecate outdated macros; convert internal usage (pythonGH-146178)pythongh-146056: Rework ref counting in treebuilder_handle_end() (python#146167)  Add a warning about untrusted input to `configparser` docs (python#146276)pythongh-145264: Do not ignore excess Base64 data after the first padded quad (pythonGH-145267)pythongh-146308: Fix error handling issues in _remote_debugging module (python#146309)pythongh-146192: Add base32 support to binascii (pythonGH-146193)pythongh-135953: Properly obtain main thread identifier in Gecko Collector (python#146045)pythongh-143414: Implement unique reference tracking for JIT, optimize unpacking of such tuples (pythonGH-144300)pythongh-146261: Fix bug in `_Py_uop_sym_set_func_version` (pythonGH-146291)pythongh-145144: Add more tests for UserList, UserDict, etc (pythonGH-145145)pythongh-143959: Fix test_datetime if _datetime is unavailable (pythonGH-145248)pythongh-146245: Fix reference and buffer leaks via audit hook in socket module (pythonGH-146248)pythongh-140049: Colorize exception notes in `traceback.py` (python#140051)  Update docs forpythongh-146056 (pythonGH-146213)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@skirpichevskirpichevskirpichev left review comments

Assignees

No one assigned

Labels

docsDocumentation in the Doc dirskip news

Projects

Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@encukou@skirpichev

[8]ページ先頭

©2009-2026 Movatter.jp