GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Check documentation of PyObject_CopyData · Issue #102383 · python/cpython

Check documentation of PyObject_CopyData #102383

New issue
Copy link
New issue
Copy link
Closed
Closed
Check documentation of PyObject_CopyData#102383
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@purpleKarrot
purpleKarrot
opened on Mar 3, 2023
Issue body actions

According to the documentation, PyObject_CopyData takes two arguments of type Py_buffer*:

cpython/Doc/c-api/buffer.rst

Line 502 in 71db5db

.. c:function:: int PyObject_CopyData(Py_buffer *dest, Py_buffer *src)

But in the implementation, it actually takes two arguments of PyObject*:

cpython/Objects/abstract.c

Line 613 in 71db5db

int PyObject_CopyData(PyObject *dest, PyObject *src)

Linked PRs

  • gh-102383: [docs] Arguments of PyObject_CopyData are PyObject * #102390
  • [3.11] gh-102383: [docs] Arguments of PyObject_CopyData are PyObject * (GH-102390) #102401

Activity

  1. terryjreedy commented on Mar 3, 2023

    @terryjreedy
    terryjreedy
    on Mar 3, 2023
    Member
    More actions

    I few lines below, abstract.c has

        if (!PyObject_CheckBuffer(dest) ||
            !PyObject_CheckBuffer(src)) {
            PyErr_SetString(PyExc_TypeError,
                            "both destination and source must be "\
                            "bytes-like objects");
    

    So the 'PyObjects' indeed have to be buffer-like. I don't know the technical details, but I suspect that there is no real bug.

  2. ronaldoussoren commented on Mar 3, 2023

    @ronaldoussoren
    ronaldoussoren
    on Mar 3, 2023
    Contributor
    More actions

    I don't know the technical details, but I suspect that there is no real bug.

    There is a bug as the documentation does not match the implementation, Py_buffer is not a Python object. In this case IMHO the documentation should be fixed.

  3. sobolevn commented on Mar 3, 2023

    @sobolevn
    sobolevn
    on Mar 3, 2023
    Member
    More actions

    Yes, PyObject_CheckBuffer looks like so:

    int
    PyObject_CheckBuffer(PyObject *obj)
    {
        PyBufferProcs *tp_as_buffer = Py_TYPE(obj)->tp_as_buffer;
        return (tp_as_buffer != NULL && tp_as_buffer->bf_getbuffer != NULL);
    }

    So, there's clearly a bug in the docs. PR is sent :)
    Thanks a lot for the report!

  4. sobolevn
    added a commit that references this issue on Mar 3, 2023

    pythongh-102383: [docs] Arguments of `PyObject_CopyData` are `PyObject`s

    92835fe
  5. sobolevn
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Mar 3, 2023
  6. kumaraditya303
    added a commit that references this issue on Mar 3, 2023

    gh-102383: [docs] Arguments of `PyObject_CopyData` are `PyObject *` (#…

    7b91320
  7. miss-islington
    added 2 commits that reference this issue on Mar 3, 2023

    pythongh-102383: [docs] Arguments of `PyObject_CopyData` are `PyObjec…

    b492daf

    gh-102383: [docs] Arguments of `PyObject_CopyData` are `PyObject *` (G…

    00791f2
  8. carljm
    added a commit that references this issue on Mar 4, 2023

    Merge branch 'main' into nodeaddict

    a31af32
  9. sobolevn
    closed this as completedon Mar 4, 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 dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.