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 — bpo-43688: Support the limited C API in debug mode by vstinner · Pull Request #25131 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Apr 1, 2021 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

The limited C API is now supported if Python is built in debug mode
(if the Py_DEBUG macro is defined). In the limited C API, the
Py_INCREF() and Py_DECREF() functions are now implemented as opaque
function calls, rather than accessing directly the PyObject.ob_refcnt
member, if Python is built in debug mode and the Py_LIMITED_API macro
targets Python 3.10 or newer. It became possible to support the
limited C API in debug mode because the PyObject structure is the
same in release and debug mode since Python 3.8 (see bpo-36465).

The limited C API is still not supported in the --with-trace-refs
special build (Py_TRACE_REFS macro).

https://bugs.python.org/issue43688

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
vstinner requested a review from a team as a code owner April 1, 2021 07:42
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Apr 1, 2021
@bedevere-bot bedevere-bot added the awaiting core review label Apr 1, 2021
vstinner
vstinner commented Apr 1, 2021
View reviewed changes
Comment thread Include/object.h Outdated

@vstinner vstinner Apr 1, 2021

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.

I would prefer to make Py_INCREF() opaque for Python 3.9 and older, but we cannot magically add _Py_IncRef() to old Python versions :-(

Sorry, something went wrong.

Uh oh!

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

shihai1991 reacted with laugh emoji
All reactions
  • 😄 1 reaction
@vstinner

vstinner commented Apr 1, 2021

Copy link
Copy Markdown
Member Author

cc @encukou

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner mentioned this pull request Apr 1, 2021
bpo-43688: Support "make regen-limited-abi" in debug mode #25133
Merged
@vstinner

vstinner commented Apr 1, 2021

Copy link
Copy Markdown
Member Author

I merged the uncontroversial part in separated commits in https://bugs.python.org/issue43688 I rebased my PR on top on merged changes.

All reactions

Sorry, something went wrong.

Uh oh!

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

shihai1991
shihai1991 reviewed Apr 1, 2021
View reviewed changes
Comment thread setup.py Outdated

@shihai1991 shihai1991 Apr 1, 2021

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.

Hm, I found Py_LIMITED_API=0x03060000 in https://github.com/python/cpython/blob/master/PCbuild/xxlimited_35.vcxproj#L97.

I am not sure which one is right.

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Apr 1, 2021

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.

The module name says "35": Python 3.5. See the C file header:


/* This module is compiled using limited API from Python 3.5,
 * making sure that it works as expected.
 *
 * See the xxlimited module for an extension module template.
 */

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Apr 1, 2021

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.

Well, that's a good reason to put the define into the C file directly, rather than putting it in the recipe to build the file :-D

Sorry, something went wrong.

Uh oh!

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

shihai1991 reacted with laugh emoji
All reactions
  • 😄 1 reaction
@vstinner
bpo-43688: Support the limited C API in debug mode
40023ee
The limited C API is now supported if Python is built in debug mode
(if the Py_DEBUG macro is defined). In the limited C API, the
Py_INCREF() and Py_DECREF() functions are now implemented as opaque
function calls, rather than accessing directly the PyObject.ob_refcnt
member, if Python is built in debug mode and the Py_LIMITED_API macro
targets Python 3.10 or newer. It became possible to support the
limited C API in debug mode because the PyObject structure is the
same in release and debug mode since Python 3.8 (see bpo-36465).

The limited C API is still not supported in the --with-trace-refs
special build (Py_TRACE_REFS macro).
@vstinner

vstinner commented Apr 2, 2021

Copy link
Copy Markdown
Member Author

Windows x86: test_asyncio failed.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Apr 2, 2021

Copy link
Copy Markdown
Member Author

I re-run the CI jobs.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
vstinner merged commit 3359cab into python:master Apr 2, 2021
@bedevere-bot bedevere-bot removed the awaiting core review label Apr 2, 2021
@vstinner
vstinner deleted the ref_debug branch April 2, 2021 13:45
@vstinner vstinner mentioned this pull request Apr 2, 2021
bpo-41111: Move the Py_LIMITED_API macro of xxlimited module from setup.py to xxlimited.c. #25115
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@shihai1991 shihai1991 shihai1991 left review comments

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

4 participants

@vstinner @shihai1991 @the-knights-who-say-ni @bedevere-bot
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 01402520 — 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.