Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-135755: Document the newPyFunction_GET_BUILTINS macro#135934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletionsDoc/c-api/function.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -142,6 +142,16 @@ There are a few functions specific to Python functions.
do not do type checking. Passing anything other than an instance of
:c:data:`PyFunction_Type` is undefined behavior.

.. c:function:: PyObject *PyFunction_GET_BUILTINS(PyObject *op)

Return the dictionary used to look up builtins (which might be ``NULL``)
when calling function *op*.

This function cannot fail and does not do error checking; passing anything
other than an instance of :c:data:`PyFunction_Type` is undefined behavior.
There is no ``PyFunction_Get*`` equivalent for this function.
Comment on lines +150 to +152
Copy link
Member

Choose a reason for hiding this comment

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

Hm, I don't think C API WG would approve.
Should this function be in a private header (and with an underscore) instead? It looks untested as well.

ericsnowcurrently reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It'ssort of tested. I'm not opposed to making it private.

Copy link
Member

Choose a reason for hiding this comment

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

That looks like it's used in a test -- the test assumes that it's working?
Yeah, the more I look into it, the better making it private seems.

cc@ericsnowcurrently, who addedPyFunction_GET_BUILTINS in#133128

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'll put up an alternate PR.

Choose a reason for hiding this comment

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

FWIW, I agree with making it internal-only.


.. versionadded 3.14

.. c:function:: int PyFunction_AddWatcher(PyFunction_WatchCallback callback)

Expand Down
3 changes: 3 additions & 0 deletionsDoc/data/refcounts.dat
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -966,6 +966,9 @@ PyFunction_GetAnnotations:PyObject*:op:0:
PyFunction_GET_ANNOTATIONS:PyObject*::0:
PyFunction_GET_ANNOTATIONS:PyObject*:op:0:

PyFunction_GET_BUILTINS:PyObject*::0:
PyFunction_GET_BUILTINS:PyObject*:op:0:

PyFunction_GetClosure:PyObject*::0:
PyFunction_GetClosure:PyObject*:op:0:

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp