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 — A paragraph in ctypes documentation refers to an example that is no longer present in the documentation · Issue #115091 · python/cpython

A paragraph in ctypes documentation refers to an example that is no longer present in the documentation #115091

New issue
Copy link
New issue
Copy link
Closed
Closed
A paragraph in ctypes documentation refers to an example that is no longer present in the documentation#115091
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir

Description

@ztane
ztane
opened on Feb 6, 2024
Issue body actions

Documentation

In ctypes documentation for 3.11 there was this excerpt in ctypes documentation:

ctypes can access values like this with the in_dll() class methods of the type. pythonapi is a predefined symbol giving access to the Python C api:

>>> opt_flag = c_int.in_dll(pythonapi, "Py_OptimizeFlag")
>>> print(opt_flag)
c_long(0)
>>>

If the interpreter would have been started with -O, the sample would have printed c_long(1), or c_long(2) if -OO would have been specified.

The example was rewritten for 3.12 to use the - probably more widely understood Py_Version instead:

ctypes can access values like this with the in_dll() class methods of the type. pythonapi is a predefined symbol giving access to the Python C api:

>>> version = ctypes.c_int.in_dll(ctypes.pythonapi, "Py_Version")
>>> print(hex(version.value))
0x30c00a0

However the last paragraph referring to the old example is still present:

If the interpreter would have been started with -O, the sample would have printed c_long(1), or c_long(2) if -OO would have been specified.

Linked PRs

  • gh-115091: Remove a left-over sentence that refers to Py_OptimizeFlag from ctypes documentation #115092
  • [3.12] gh-115091: Remove a left-over sentence that refers to Py_OptimizeFlag from ctypes documentation (GH-115092) #115936

Activity

  1. ztane
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Feb 6, 2024
  2. encukou
    added a commit that references this issue on Feb 26, 2024

    gh-115091: Remove a left-over sentence that refers to Py_OptimizeFlag…

    915d7dd
  3. miss-islington
    added a commit that references this issue on Feb 26, 2024

    pythongh-115091: Remove a left-over sentence that refers to Py_Optimi…

    1080bf8
  4. encukou
    added a commit that references this issue on Feb 26, 2024

    [3.12] gh-115091: Remove a left-over sentence that refers to Py_Optim…

    79061af
  5. encukou commented on Feb 26, 2024

    @encukou
    encukou
    on Feb 26, 2024
    Member
    More actions

    Thanks for the catch!

  6. encukou
    closed this as completedon Feb 26, 2024
  7. woodruffw
    added a commit that references this issue on Mar 4, 2024

    pythongh-115091: Remove a left-over sentence that refers to Py_Optimi…

    04c6d77
  8. adorilson
    added a commit that references this issue on Mar 25, 2024

    pythongh-115091: Remove a left-over sentence that refers to Py_Optimi…

    892a5fe
  9. diegorusso
    added a commit that references this issue on Apr 17, 2024

    pythongh-115091: Remove a left-over sentence that refers to Py_Optimi…

    4cb5193
  10. LukasWoodtli
    added a commit that references this issue on Jan 22, 2025

    pythongh-115091: Remove a left-over sentence that refers to Py_Optimi…

    bb8d39c
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 dir

    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.