Skip to content

Use the C domain roles consistently in the documentation #107091

Description

@serhiy-storchaka

:c:member:, :c:data: and :c:var: are equivalent. I do not know whether there is a semantic difference between :c:data: and :c:var: (although I think that :c:member: is semantically different and should be used for attributes).

:c:member: is used 813 times for 202 names.

:c:data: is used 265 times for 143 names:

Details
:c:data:`command`
:c:data:`errno`
:c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>`
:c:data:`nb_long`
:c:data:`nb_reserved`
:c:data:`PyBool_Type`
:c:data:`Py_buffer`
:c:data:`Py_buffer.format`
:c:data:`Py_buffer.itemsize`
:c:data:`Py_BytesWarningFlag`
:c:data:`PyCallIter_Type`
:c:data:`PyCFunction`
:c:data:`PyCMethod`
:c:data:`PyContextToken_Type`
:c:data:`PyContext_Type`
:c:data:`PyContextVar_Type`
:c:data:`PyDateTimeAPI`
:c:data:`PyDateTime_Date`
:c:data:`PyDateTime_DateTime`
:c:data:`PyDateTime_DateTimeType`
:c:data:`PyDateTime_DateType`
:c:data:`PyDateTime_Delta`
:c:data:`PyDateTime_DeltaType`
:c:data:`PyDateTime_Time`
:c:data:`PyDateTime_TimeType`
:c:data:`PyDateTime_TimeZone_UTC`
:c:data:`PyDateTime_TZInfoType`
:c:data:`Py_Ellipsis`
:c:data:`Py_eval_input`
:c:data:`PyExc_ArithmeticError`
:c:data:`PyExc_AssertionError`
:c:data:`PyExc_AttributeError`
:c:data:`PyExc_BaseException`
:c:data:`PyExc_BlockingIOError`
:c:data:`PyExc_BrokenPipeError`
:c:data:`PyExc_BufferError`
:c:data:`PyExc_BytesWarning`
:c:data:`PyExc_ChildProcessError`
:c:data:`PyExc_ConnectionAbortedError`
:c:data:`PyExc_ConnectionError`
:c:data:`PyExc_ConnectionRefusedError`
:c:data:`PyExc_ConnectionResetError`
:c:data:`PyExc_DeprecationWarning`
:c:data:`PyExc_EnvironmentError`
:c:data:`PyExc_EOFError`
:c:data:`PyExc_Exception`
:c:data:`PyExc_FileExistsError`
:c:data:`PyExc_FileNotFoundError`
:c:data:`PyExc_FloatingPointError`
:c:data:`PyExc_FutureWarning`
:c:data:`PyExc_GeneratorExit`
:c:data:`PyExc_ImportError`
:c:data:`PyExc_ImportWarning`
:c:data:`PyExc_IndentationError`
:c:data:`PyExc_IndexError`
:c:data:`PyExc_InterruptedError`
:c:data:`PyExc_IOError`
:c:data:`PyExc_IsADirectoryError`
:c:data:`PyExc_KeyboardInterrupt`
:c:data:`PyExc_KeyError`
:c:data:`PyExc_LookupError`
:c:data:`PyExc_MemoryError`
:c:data:`PyExc_ModuleNotFoundError`
:c:data:`PyExc_NameError`
:c:data:`PyExc_NotADirectoryError`
:c:data:`PyExc_NotImplementedError`
:c:data:`PyExc_OSError`
:c:data:`PyExc_OverflowError`
:c:data:`PyExc_PendingDeprecationWarning`
:c:data:`PyExc_PermissionError`
:c:data:`PyExc_ProcessLookupError`
:c:data:`PyExc_RecursionError`
:c:data:`PyExc_ReferenceError`
:c:data:`PyExc_ResourceWarning`
:c:data:`PyExc_RuntimeError`
:c:data:`PyExc_RuntimeWarning`
:c:data:`PyExc_StopAsyncIteration`
:c:data:`PyExc_StopIteration`
:c:data:`PyExc_SyntaxError`
:c:data:`PyExc_SyntaxWarning`
:c:data:`PyExc_SystemError`
:c:data:`PyExc_SystemExit`
:c:data:`PyExc_TabError`
:c:data:`PyExc_TimeoutError`
:c:data:`PyExc_TypeError`
:c:data:`PyExc_UnboundLocalError`
:c:data:`PyExc_UnicodeDecodeError`
:c:data:`PyExc_UnicodeEncodeError`
:c:data:`PyExc_UnicodeError`
:c:data:`PyExc_UnicodeTranslateError`
:c:data:`PyExc_UnicodeWarning`
:c:data:`PyExc_UserWarning`
:c:data:`PyExc_ValueError`
:c:data:`PyExc_Warning`
:c:data:`PyExc_WindowsError`
:c:data:`PyExc_ZeroDivisionError`
:c:data:`Py_False`
:c:data:`Py_file_input`
:c:data:`Py_FileSystemDefaultEncodeErrors`
:c:data:`PyFunction_Type`
:c:data:`Py_IgnoreEnvironmentFlag`
:c:data:`PyImport_FrozenModules`
:c:data:`PyImport_Inittab`
:c:data:`PyInstanceMethod_Type`
:c:data:`PyMethod_Type`
:c:data:`Py_mod_exec`
:c:data:`PyModuleDef_HEAD_INIT`
:c:data:`PyModule_Type`
:c:data:`Py_None`
:c:data:`Py_NotImplemented`
:c:data:`PyOS_ReadlineFunctionPointer`
:c:data:`Py_Py3kWarningFlag`
:c:data:`PySeqIter_Type`
:c:data:`Py_single_input`
:c:data:`PyStructSequence_UnnamedField`
:c:data:`Py_tp_base`
:c:data:`Py_tp_bases`
:c:data:`PyTrace_CALL`
:c:data:`PyTrace_C_CALL`
:c:data:`PyTrace_C_EXCEPTION`
:c:data:`PyTrace_C_RETURN`
:c:data:`PyTrace_EXCEPTION`
:c:data:`PyTrace_LINE`
:c:data:`PyTrace_OPCODE`
:c:data:`PyTrace_RETURN`
:c:data:`Py_True`
:c:data:`PyType_GetModuleByDef`
:c:data:`PyType_Type`
:c:data:`PyUnicode_1BYTE_KIND`
:c:data:`PyUnicode_2BYTE_KIND`
:c:data:`PyUnicode_4BYTE_KIND`
:c:data:`PyUnicode_WCHAR_KIND`
:c:data:`Py_UTF8Mode`
:c:data:`Py_Version`
:c:data:`rl_attempted_completion_function`
:c:data:`rl_completer_word_break_characters`
:c:data:`rl_completion_display_matches_hook`
:c:data:`rl_completion_type`
:c:data:`rl_line_buffer`
:c:data:`rl_pre_input_hook`
:c:data:`rl_startup_hook`
:c:data:`SpamError`
:c:data:`sts`
In some of these cases (e.g. for `nb_long` or `Py_buffer.format`) `:c:member:` looks more semantically appropriate.

:c:var: is used 51 times for 28 names:

Details
:c:var:`Py_BytesWarningFlag`
:c:var:`Py_DebugFlag`
:c:var:`Py_DontWriteBytecodeFlag`
:c:var:`Py_FileSystemDefaultEncodeErrors`
:c:var:`Py_FileSystemDefaultEncoding`
:c:var:`Py_FrozenFlag`
:c:var:`Py_HasFileSystemDefaultEncoding`
:c:var:`Py_HashRandomizationFlag`
:c:var:`Py_IgnoreEnvironmentFlag`
:c:var:`Py_InspectFlag`
:c:var:`Py_InteractiveFlag`
:c:var:`Py_IsolatedFlag`
:c:var:`Py_LegacyWindowsFSEncodingFlag`
:c:var:`Py_LegacyWindowsStdioFlag`
:c:var:`Py_NoSiteFlag`
:c:var:`Py_NoUserSiteDirectory`
:c:var:`Py_OptimizeFlag`
:c:var:`PyOS_InputHook`
:c:var:`PyOS_ReadlineFunctionPointer`
:c:var:`Py_QuietFlag`
:c:var:`PyStructSequence_UnnamedField`
:c:var:`PyType_Type`
:c:var:`Py_UnbufferedStdioFlag`
:c:var:`Py_UTF8Mode`
:c:var:`Py_VerboseFlag`
:c:var:`Py_Version`

In some cases :data: (purposed for use with Python names) is used with a C name. It is definitely error.

In what cases should we use :c:data: and in what cases should we use :c:var:? I do not see a system in the current use.

Linked PRs

Activity

  1. added a commit that references this issue on Jul 23, 2023
  2. added a commit that references this issue on Jul 23, 2023
  3. added a commit that references this issue on Jul 23, 2023
  4. added 2 commits that reference this issue on Jul 23, 2023
  5. serhiy-storchaka commented on Jul 23, 2023

    @serhiy-storchaka
    MemberAuthor

    Py_BytesWarningFlag, Py_FileSystemDefaultEncodeErrors, Py_IgnoreEnvironmentFlag, PyOS_ReadlineFunctionPointer, PyStructSequence_UnnamedField, PyType_Type, Py_UTF8Mode, Py_Version are used with both :c:data: and :c:var: roles.

  6. added 2 commits that reference this issue on Jul 23, 2023
  7. added a commit that references this issue on Jul 23, 2023
  8. added a commit that references this issue on Jul 23, 2023
  9. erlend-aasland commented on Jul 23, 2023

    @erlend-aasland
    Contributor

    In what cases should we use :c:data: and in what cases should we use :c:var:? I do not see a system in the current use.

    The former is the most frequent used, so it would be less churn to change :c:var: to :c:data:.

  10. erlend-aasland commented on Jul 23, 2023

    @erlend-aasland
    Contributor

    Another option is to keep both :c:var: and c:data: and make sure they are referenced properly; that generates minimal churn.

  11. added a commit that references this issue on Jul 23, 2023
  12. added a commit that references this issue on Jul 26, 2023
  13. 17 remaining items

  14. added 5 commits that reference this issue on Jul 27, 2023
  15. added 2 commits that reference this issue on Jul 28, 2023
  16. added 7 commits that reference this issue on Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions