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 — gh-141004: Document `PyErr_RangedSyntaxLocationObject` by StanFromIreland · Pull Request #141521 · python/cpython

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Nov 13, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Document the entire C API #141004

📚 Documentation preview 📚: https://cpython-previews--141521.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@StanFromIreland
PyErr_RangedSyntaxLocationObject
13b12f9
@StanFromIreland
StanFromIreland requested review from ZeroIntensity and pablogsal November 13, 2025 17:42
@bedevere-app bedevere-app Bot added awaiting review docs Documentation in the Doc dir skip news labels Nov 13, 2025
@github-project-automation github-project-automation Bot added this to Docs PRs Nov 13, 2025
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Nov 13, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Nov 13, 2025
Document the entire C API #141004
Closed
pablogsal
pablogsal approved these changes Nov 13, 2025
View reviewed changes

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Nov 13, 2025
@pablogsal
pablogsal merged commit 196f151 into python:main Nov 13, 2025
39 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 13, 2025
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Nov 13, 2025
@pablogsal pablogsal added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Nov 13, 2025
@miss-islington-app

miss-islington-app Bot commented Nov 13, 2025

Copy link
Copy Markdown

Thanks @StanFromIreland for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app

miss-islington-app Bot commented Nov 13, 2025

Copy link
Copy Markdown

Thanks @StanFromIreland for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 13, 2025
@StanFromIreland @miss-islington
pythongh-141004: Document PyErr_RangedSyntaxLocationObject (pythonG…
a840b31
…H-141521)

PyErr_RangedSyntaxLocationObject
(cherry picked from commit 196f151)

Co-authored-by: Stan Ulbrych <[email protected]>
@bedevere-app

bedevere-app Bot commented Nov 13, 2025

Copy link
Copy Markdown

GH-141524 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Nov 13, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 13, 2025
@StanFromIreland @miss-islington
pythongh-141004: Document PyErr_RangedSyntaxLocationObject (pythonG…
663ecaa
…H-141521)

PyErr_RangedSyntaxLocationObject
(cherry picked from commit 196f151)

Co-authored-by: Stan Ulbrych <[email protected]>
@bedevere-app

bedevere-app Bot commented Nov 13, 2025

Copy link
Copy Markdown

GH-141525 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 13, 2025
@StanFromIreland
StanFromIreland deleted the PyErr_RangedSyntaxLocationObject branch November 13, 2025 18:01
@StanFromIreland

StanFromIreland commented Nov 13, 2025

Copy link
Copy Markdown
Member Author

Thanks ❤️

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pablogsal pushed a commit that referenced this pull request Nov 13, 2025
@miss-islington @StanFromIreland
[3.14] gh-141004: Document PyErr_RangedSyntaxLocationObject (GH-141521
c5e0ce7
) (#141525)

gh-141004: Document `PyErr_RangedSyntaxLocationObject` (GH-141521)

PyErr_RangedSyntaxLocationObject
(cherry picked from commit 196f151)

Co-authored-by: Stan Ulbrych <[email protected]>
pablogsal pushed a commit that referenced this pull request Nov 13, 2025
@miss-islington @StanFromIreland
[3.13] gh-141004: Document PyErr_RangedSyntaxLocationObject (GH-141521
baa9216
) (#141524)

gh-141004: Document `PyErr_RangedSyntaxLocationObject` (GH-141521)

PyErr_RangedSyntaxLocationObject
(cherry picked from commit 196f151)

Co-authored-by: Stan Ulbrych <[email protected]>
ZeroIntensity
ZeroIntensity reviewed Nov 13, 2025
View reviewed changes
Comment thread Doc/c-api/exceptions.rst
Comment on lines +314 to +315
Similar to :c:func:`PyErr_SyntaxLocationObject`, but also sets the
*end_lineno* and *end_col_offset* information for the current exception.

@ZeroIntensity ZeroIntensity Nov 13, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure that this is correct. Unless I'm going crazy, this is exactly the same as PyErr_SyntaxLocationObjectEx:

cpython/Python/errors.c

Lines 1910 to 1914 in 209eaff

void
PyErr_RangedSyntaxLocationObject(PyObject *filename, int lineno, int col_offset,
int end_lineno, int end_col_offset) {
PyErr_SyntaxLocationObjectEx(filename, lineno, col_offset, end_lineno, end_col_offset);
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@StanFromIreland StanFromIreland Nov 13, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it is, see the PyErr_SyntaxLocationObject invocation of PyErr_SyntaxLocationObjectEx.

void
PyErr_SyntaxLocationObject(PyObject *filename, int lineno, int col_offset) {
    PyErr_SyntaxLocationObjectEx(filename, lineno, col_offset, lineno, -1);
}

We are essentially just exposing the full functionality of PyErr_SyntaxLocationObjectEx.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ZeroIntensity ZeroIntensity Nov 13, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like PyErr_SyntaxLocationObjectEx is undocumented. Let's document that and document PyErr_RangedSyntaxLocationObject as a soft-deprecated alias to it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@StanFromIreland StanFromIreland Nov 13, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd have to expose it first:

cpython/Python/errors.c

Line 1801 in a486d45

static void

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ZeroIntensity ZeroIntensity Nov 13, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so we named something like a public API without exposing it -- yuck! I think we're all good here then.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request Nov 13, 2025
@CuriousLearner
Merge branch 'main' into fix-issue21914
b9f473c
* main: (463 commits)
  pythongh-140601: Add ResourceWarning to iterparse when not closed (pythonGH-140603)
  pythongh-137969: Fix double evaluation of `ForwardRef`s which rely on globals (python#140974)
  pythongh-139109: A new tracing JIT compiler frontend for CPython (pythonGH-140310)
  pythongh-141004: Document `PyErr_RangedSyntaxLocationObject` (python#141521)
  pythongh-140873: Add support of non-descriptor callables in functools.singledispatchmethod() (pythonGH-140884)
  pythongh-139653: Add PyUnstable_ThreadState_SetStackProtection() (python#139668)
  pythongh-141004: Document `PyCode_Optimize` (pythonGH-141378)
  pythongh-141004: Document C APIs for dictionary keys, values, and items (pythonGH-141009)
  pythongh-137959: Fix `TIER1_TO_TIER2` macro name in JIT InternalDocs (pythonGH-141496)
  pythongh-139871: Add `bytearray.take_bytes([n])` to efficiently extract `bytes` (pythonGH-140128)
  pythongh-140601: Refactor ElementTree.iterparse() tests (pythonGH-141499)
  pythongh-135801: Add the module parameter to compile() etc (pythonGH-139652)
  pythongh-140260: fix data race in `_struct` module initialization with subinterpreters (python#140909)
  pythongh-137109: refactor warning about threads when forking (python#141438)
  pythongh-141004: Document `PyRun_InteractiveOneObject` (pythonGH-141405)
  pythongh-124111: Fix TCL 9 thread detection (pythonGH-128103)
  pythongh-141442: Add escaping to iOS testbed arguments (python#141443)
  pythongh-140936: Fix JIT assertion crash at finalization if some generator is alive (pythonGH-140969)
  Add details about JIT build infrastructure and updating dependencies to `Tools/jit` (python#141167)
  pythongh-141412: Use reliable target URL for urllib example (pythonGH-141428)
  ...
CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request Nov 14, 2025
@CuriousLearner
Merge branch 'main' of github.com:python/cpython into fix-Issue18387
c46ecc5
* 'main' of github.com:python/cpython: (464 commits)
  pythongh-140601: Add ResourceWarning to iterparse when not closed (pythonGH-140603)
  pythongh-137969: Fix double evaluation of `ForwardRef`s which rely on globals (python#140974)
  pythongh-139109: A new tracing JIT compiler frontend for CPython (pythonGH-140310)
  pythongh-141004: Document `PyErr_RangedSyntaxLocationObject` (python#141521)
  pythongh-140873: Add support of non-descriptor callables in functools.singledispatchmethod() (pythonGH-140884)
  pythongh-139653: Add PyUnstable_ThreadState_SetStackProtection() (python#139668)
  pythongh-141004: Document `PyCode_Optimize` (pythonGH-141378)
  pythongh-141004: Document C APIs for dictionary keys, values, and items (pythonGH-141009)
  pythongh-137959: Fix `TIER1_TO_TIER2` macro name in JIT InternalDocs (pythonGH-141496)
  pythongh-139871: Add `bytearray.take_bytes([n])` to efficiently extract `bytes` (pythonGH-140128)
  pythongh-140601: Refactor ElementTree.iterparse() tests (pythonGH-141499)
  pythongh-135801: Add the module parameter to compile() etc (pythonGH-139652)
  pythongh-140260: fix data race in `_struct` module initialization with subinterpreters (python#140909)
  pythongh-137109: refactor warning about threads when forking (python#141438)
  pythongh-141004: Document `PyRun_InteractiveOneObject` (pythonGH-141405)
  pythongh-124111: Fix TCL 9 thread detection (pythonGH-128103)
  pythongh-141442: Add escaping to iOS testbed arguments (python#141443)
  pythongh-140936: Fix JIT assertion crash at finalization if some generator is alive (pythonGH-140969)
  Add details about JIT build infrastructure and updating dependencies to `Tools/jit` (python#141167)
  pythongh-141412: Use reliable target URL for urllib example (pythonGH-141428)
  ...
CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request Nov 14, 2025
@CuriousLearner
Merge branch 'main' of github.com:python/cpython into fix-issue24255
c240289
* 'main' of github.com:python/cpython: (464 commits)
  pythongh-140601: Add ResourceWarning to iterparse when not closed (pythonGH-140603)
  pythongh-137969: Fix double evaluation of `ForwardRef`s which rely on globals (python#140974)
  pythongh-139109: A new tracing JIT compiler frontend for CPython (pythonGH-140310)
  pythongh-141004: Document `PyErr_RangedSyntaxLocationObject` (python#141521)
  pythongh-140873: Add support of non-descriptor callables in functools.singledispatchmethod() (pythonGH-140884)
  pythongh-139653: Add PyUnstable_ThreadState_SetStackProtection() (python#139668)
  pythongh-141004: Document `PyCode_Optimize` (pythonGH-141378)
  pythongh-141004: Document C APIs for dictionary keys, values, and items (pythonGH-141009)
  pythongh-137959: Fix `TIER1_TO_TIER2` macro name in JIT InternalDocs (pythonGH-141496)
  pythongh-139871: Add `bytearray.take_bytes([n])` to efficiently extract `bytes` (pythonGH-140128)
  pythongh-140601: Refactor ElementTree.iterparse() tests (pythonGH-141499)
  pythongh-135801: Add the module parameter to compile() etc (pythonGH-139652)
  pythongh-140260: fix data race in `_struct` module initialization with subinterpreters (python#140909)
  pythongh-137109: refactor warning about threads when forking (python#141438)
  pythongh-141004: Document `PyRun_InteractiveOneObject` (pythonGH-141405)
  pythongh-124111: Fix TCL 9 thread detection (pythonGH-128103)
  pythongh-141442: Add escaping to iOS testbed arguments (python#141443)
  pythongh-140936: Fix JIT assertion crash at finalization if some generator is alive (pythonGH-140969)
  Add details about JIT build infrastructure and updating dependencies to `Tools/jit` (python#141167)
  pythongh-141412: Use reliable target URL for urllib example (pythonGH-141428)
  ...
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
@StanFromIreland
pythongh-141004: Document PyErr_RangedSyntaxLocationObject (python#…
a155685
…141521)

PyErr_RangedSyntaxLocationObject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ZeroIntensity ZeroIntensity ZeroIntensity left review comments
@pablogsal pablogsal pablogsal approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@StanFromIreland @pablogsal @ZeroIntensity
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.