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 — C API: Remove Include/errcode.h header file · Issue #107162 · python/cpython

C API: Remove Include/errcode.h header file #107162

New issue
Copy link
New issue
Copy link
Closed
Closed
C API: Remove Include/errcode.h header file#107162
Copy link
Labels
topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

Description

@vstinner
vstinner
opened on Jul 23, 2023
Issue body actions

Constants exported by the <errcode.h> header file cannot be used outside Python internals. There is no public C API to tokenize a Python source file. I propose to simply remove this header file (move it to the internal C API). It's not included by Python.h.

In Python 3.12, I removed <token.h > header file: see issue #92651.

In Python 3.10, I removed the C API related to AST and the parser, since it was not possible to use it outside Python internals. See: https://docs.python.org/dev/whatsnew/3.10.html#id4

Linked PRs

  • gh-107162: Remove errcode.h header file #107163
  • gh-107162: Document errcode.h usage in its comment #107177

Activity

  1. vstinner
    added
    type-featureA feature request or enhancementA feature request or enhancement
    topic-C-API
    on Jul 23, 2023
  2. vstinner
    added 2 commits that reference this issue on Jul 23, 2023

    pythongh-107162: Remove errcode.h header file

    384e99c

    pythongh-107162: Remove errcode.h header file

    0cef34e
  3. serhiy-storchaka commented on Jul 24, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Jul 24, 2023
    Member
    More actions

    It is the part of the C API. See PyRun_InteractiveOneFlags() documentation.

  4. vstinner commented on Jul 24, 2023

    @vstinner
    vstinner
    on Jul 24, 2023
    MemberAuthor
    More actions

    https://docs.python.org/dev/c-api/veryhigh.html#c.PyRun_InteractiveOneFlags

    Oh! I looked for errcode.h usage and I couldn't find it. Thanks for pointing me to this function.

    I didn't know that these constants are not only used by the tokenizer, but also by the "high-level" API.

    Maybe we should just better document this header file. One concern is that constant names are not prefixed by Py_ or PY_. But since it's not included by Python, maybe it's not really an issue.

  5. vstinner
    added 3 commits that reference this issue on Jul 24, 2023

    pythongh-107162: Document errcode.h usage in its comment

    28729e0

    pythongh-107162: Document errcode.h usage in its comment

    ff2d397

    gh-107162: Document errcode.h usage in its comment (#107177)

    7516953
  6. jtcave
    added a commit that references this issue on Jul 24, 2023

    pythongh-107162: Document errcode.h usage in its comment (python#107177)

    f3e8a7b
  7. vstinner commented on Jul 24, 2023

    @vstinner
    vstinner
    on Jul 24, 2023
    MemberAuthor
    More actions

    I close this issue which is wrong: the <errcode.h> header file is part of the Python C API and used by public PyRun_InteractiveOneFlags() function. I wrote it directly the header file for future readers: 7516953

  8. vstinner
    closed this as completedon Jul 24, 2023
  9. carljm
    added a commit that references this issue on Jul 24, 2023

    Merge branch 'main' into superfix

    9a6bdfa
  10. serhiy-storchaka commented on Jul 25, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Jul 25, 2023
    Member
    More actions

    I am sure that you can use PyRun_InteractiveOneFlags() even without errcode.h. But if you want to get more details about parsing error, you can include errcode.h.

    Since PyRun_InteractiveOneFlags() can also return -1 and set an exception, we perhaps can get rid of these error codes and turn them into appropriate Python exceptions. errcode.h then became obsolete.

  11. vstinner commented on Jul 25, 2023

    @vstinner
    vstinner
    on Jul 25, 2023
    MemberAuthor
    More actions

    Since PyRun_InteractiveOneFlags() can also return -1 and set an exception, we perhaps can get rid of these error codes and turn them into appropriate Python exceptions. errcode.h then became obsolete.

    Well, if you want to try that, you can propose a change :-)

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

    topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

    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.