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

ctypes: Add docstring forctypes.Array #107689

Closed
Labels
@tomasr8

Description

@tomasr8

Documentation

TheArray class from thectypes module doesn't have a proper docstring:

fromctypesimportArrayhelp(Array)>>>HelponclassArrayinmodule_ctypes:>>>>>>classArray(_CData)>>>|XXXtobeprovided# !!>>>|

Though the class is documented in thedocs so we could just reuse that description.

Feel free to pick up this issue :) If you're new to the C internals, here's a small guide to help you get started:

ctypes.Array is a class implemented in C defined inModules/_ctypes/_ctypes.c. Here is the current docstring definition:

Py_TPFLAGS_DEFAULT |Py_TPFLAGS_BASETYPE,/* tp_flags */
PyDoc_STR("XXX to be provided"),/* tp_doc */
(traverseproc)PyCData_traverse,/* tp_traverse */

To update the docstring, we could simply change the argument ofPyDoc_STR(...) but if the docstring is longer it's better to usePyDoc_STRVAR to create a separate variable with the new docstring:

PyDoc_STRVAR(array_doc,"Abstract base class for arrays.\n""\n""The recommended way to create ...");

then you substitute it back instead ofPyDoc_STR:

Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */- PyDoc_STR("XXX to be provided"),        /* tp_doc */+ array_doc,                              /* tp_doc */(traverseproc)PyCData_traverse,

To test that it worked, rebuild python and check the docstring ;)

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp