Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,8 @@ C API changes
New features
------------

* TODO
* Add :c:func:`PyMethod_New` function to the limited C API.
(Contributed by Nicolas Trangez in :gh:`155588`.)

Porting to Python 3.16
----------------------
Expand Down
1 change: 1 addition & 0 deletions Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ __pragma(warning(disable: 4201))
#include "moduleobject.h"
#include "cpython/monitoring.h"
#include "cpython/funcobject.h"
#include "classobject.h"
#include "cpython/classobject.h"
#include "fileobject.h"
#include "pycapsule.h"
Expand Down
24 changes: 24 additions & 0 deletions Include/classobject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Limited C API of PyMethod API
*/

#ifndef Py_CLASSOBJECT_H
#define Py_CLASSOBJECT_H

#ifdef __cplusplus
extern "C" {
#endif

#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03100000
/* Return a new method object, with `func` being any callable object and
* `self` the instance the method should be bound.
*
* `func` is the function that will be called when the method is called.
* `self` must not be NULL.
*/
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
#endif

#ifdef __cplusplus
}
#endif
#endif /* !Py_CLASSOBJECT_H */
6 changes: 3 additions & 3 deletions Include/cpython/classobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* Revealing some structures (not for general use) */

#ifndef Py_LIMITED_API
#ifndef Py_CLASSOBJECT_H
#define Py_CLASSOBJECT_H
#ifndef Py_CPYTHON_CLASSOBJECT_H
#define Py_CPYTHON_CLASSOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -67,5 +67,5 @@ static inline PyObject* PyInstanceMethod_GET_FUNCTION(PyObject *meth) {
#ifdef __cplusplus
}
#endif
#endif // !Py_CLASSOBJECT_H
#endif // !Py_CPYTHON_CLASSOBJECT_H
#endif // !Py_LIMITED_API
1 change: 1 addition & 0 deletions Lib/test/test_stable_abi_ctypes.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add :c:func:`PyObject_CallFinalizerFromDealloc` function to the limited C
API. Patch by Nicolas Trangez.
3 changes: 3 additions & 0 deletions Misc/stable_abi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2832,3 +2832,6 @@

[function.PyObject_CallFinalizerFromDealloc]
added = '3.15'

[function.PyMethod_New]
added = '3.16'
1 change: 1 addition & 0 deletions PC/python3dll.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading