| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,30 +64,6 @@ as much as it can. | |||
| 64 | 64 | .. versionadded:: 3.13 | |
| 65 | 65 | ||
| 66 | 66 | ||
| 67 | - .. c:function:: PyObject* PyWeakref_GetObject(PyObject *ref) | ||
| 68 | - | ||
| 69 | - Return a :term:`borrowed reference` to the referenced object from a weak | ||
| 70 | - reference, *ref*. If the referent is no longer live, returns ``Py_None``. | ||
| 71 | - | ||
| 72 | - .. note:: | ||
| 73 | - | ||
| 74 | - This function returns a :term:`borrowed reference` to the referenced object. | ||
| 75 | - This means that you should always call :c:func:`Py_INCREF` on the object | ||
| 76 | - except when it cannot be destroyed before the last usage of the borrowed | ||
| 77 | - reference. | ||
| 78 | - | ||
| 79 | - .. deprecated-removed:: 3.13 3.15 | ||
| 80 | - Use :c:func:`PyWeakref_GetRef` instead. | ||
| 81 | - | ||
| 82 | - | ||
| 83 | - .. c:function:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref) | ||
| 84 | - | ||
| 85 | - Similar to :c:func:`PyWeakref_GetObject`, but does no error checking. | ||
| 86 | - | ||
| 87 | - .. deprecated-removed:: 3.13 3.15 | ||
| 88 | - Use :c:func:`PyWeakref_GetRef` instead. | ||
| 89 | - | ||
| 90 | - | ||
| 91 | 67 | .. c:function:: int PyWeakref_IsDead(PyObject *ref) | |
| 92 | 68 | ||
| 93 | 69 | Test if the weak reference *ref* is dead. Returns 1 if the reference is | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2947,12 +2947,6 @@ PyWeakref_CheckProxy:PyObject*:ob:0: | |||
| 2947 | 2947 | PyWeakref_CheckRef:int::: | |
| 2948 | 2948 | PyWeakref_CheckRef:PyObject*:ob:0: | |
| 2949 | 2949 | ||
| 2950 | - PyWeakref_GET_OBJECT:PyObject*::0: | ||
| 2951 | - PyWeakref_GET_OBJECT:PyObject*:ref:0: | ||
| 2952 | - | ||
| 2953 | - PyWeakref_GetObject:PyObject*::0: | ||
| 2954 | - PyWeakref_GetObject:PyObject*:ref:0: | ||
| 2955 | - | ||
| 2956 | 2950 | PyWeakref_GetRef:int::: | |
| 2957 | 2951 | PyWeakref_GetRef:PyObject*:ref:0: | |
| 2958 | 2952 | PyWeakref_GetRef:PyObject**:pobj:+1: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ Pending removal in Python 3.15 | |||
| 3 | 3 | ||
| 4 | 4 | * The :c:func:`!PyImport_ImportModuleNoBlock`: | |
| 5 | 5 | Use :c:func:`PyImport_ImportModule` instead. | |
| 6 | - * :c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: | ||
| 6 | + * :c:func:`!PyWeakref_GetObject` and :c:func:`!PyWeakref_GET_OBJECT`: | ||
| 7 | 7 | Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project | |
| 8 | 8 | <https://github.com/python/pythoncapi-compat/>`__ can be used to get | |
| 9 | 9 | :c:func:`PyWeakref_GetRef` on Python 3.12 and older. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -173,9 +173,9 @@ that return :term:`strong references <strong reference>`. | |||
| 173 | 173 | +-----------------------------------+-----------------------------------+ | |
| 174 | 174 | | :c:func:`PyDict_Next` | none (see :ref:`PyDict_Next`) | | |
| 175 | 175 | +-----------------------------------+-----------------------------------+ | |
| 176 | - | :c:func:`PyWeakref_GetObject` | :c:func:`PyWeakref_GetRef` | | ||
| 176 | + | :c:func:`!PyWeakref_GetObject` | :c:func:`PyWeakref_GetRef` | | ||
| 177 | 177 | +-----------------------------------+-----------------------------------+ | |
| 178 | - | :c:func:`PyWeakref_GET_OBJECT` | :c:func:`PyWeakref_GetRef` | | ||
| 178 | + | :c:func:`!PyWeakref_GET_OBJECT` | :c:func:`PyWeakref_GetRef` | | ||
| 179 | 179 | +-----------------------------------+-----------------------------------+ | |
| 180 | 180 | | :c:func:`PyImport_AddModule` | :c:func:`PyImport_AddModuleRef` | | |
| 181 | 181 | +-----------------------------------+-----------------------------------+ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2673,7 +2673,7 @@ Removed | |||
| 2673 | 2673 | ||
| 2674 | 2674 | (Contributed by Victor Stinner in :issue:`45474`.) | |
| 2675 | 2675 | ||
| 2676 | - * Exclude :c:func:`PyWeakref_GET_OBJECT` from the limited C API. It never | ||
| 2676 | + * Exclude :c:func:`!PyWeakref_GET_OBJECT` from the limited C API. It never | ||
| 2677 | 2677 | worked since the :c:type:`!PyWeakReference` structure is opaque in the | |
| 2678 | 2678 | limited C API. | |
| 2679 | 2679 | (Contributed by Victor Stinner in :issue:`35134`.) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2246,7 +2246,7 @@ New Features | |||
| 2246 | 2246 | (Contributed by Serhiy Storchaka in :gh:`110289`.) | |
| 2247 | 2247 | ||
| 2248 | 2248 | * Add the :c:func:`PyWeakref_GetRef` function | |
| 2249 | - as an alternative to :c:func:`PyWeakref_GetObject` | ||
| 2249 | + as an alternative to :c:func:`!PyWeakref_GetObject` | ||
| 2250 | 2250 | that returns a :term:`strong reference` | |
| 2251 | 2251 | or ``NULL`` if the referent is no longer live. | |
| 2252 | 2252 | (Contributed by Victor Stinner in :gh:`105927`.) | |
@@ -2531,8 +2531,8 @@ Deprecated C APIs | |||
| 2531 | 2531 | are just aliases to :c:type:`!wchar_t`. | |
| 2532 | 2532 | (Contributed by Victor Stinner in :gh:`105156`.) | |
| 2533 | 2533 | ||
| 2534 | - * Deprecate the :c:func:`PyWeakref_GetObject` and | ||
| 2535 | - :c:func:`PyWeakref_GET_OBJECT` functions, | ||
| 2534 | + * Deprecate the :c:func:`!PyWeakref_GetObject` and | ||
| 2535 | + :c:func:`!PyWeakref_GET_OBJECT` functions, | ||
| 2536 | 2536 | which return a :term:`borrowed reference`. | |
| 2537 | 2537 | Replace them with the new :c:func:`PyWeakref_GetRef` function, | |
| 2538 | 2538 | which returns a :term:`strong reference`. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -869,6 +869,11 @@ Removed C APIs | |||
| 869 | 869 | of :c:func:`PyImport_ImportModule`. | |
| 870 | 870 | (Contributed by Bénédikt Tran in :gh:`133644`.) | |
| 871 | 871 | ||
| 872 | + * :c:func:`!PyWeakref_GetObject` and :c:macro:`!PyWeakref_GET_OBJECT`: | ||
| 873 | + use :c:func:`PyWeakref_GetRef` instead. The |pythoncapi_compat_project| | ||
| 874 | + can be used to get :c:func:`!PyWeakref_GetRef` on Python 3.12 and older. | ||
| 875 | + (Contributed by Bénédikt Tran in :gh:`133644`.) | ||
| 876 | + | ||
| 872 | 877 | * Remove deprecated :c:func:`!PySys_ResetWarnOptions`. | |
| 873 | 878 | Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead. | |
| 874 | 879 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,20 +47,3 @@ PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); | |||
| 47 | 47 | ||
| 48 | 48 | // Test if a weak reference is dead. | |
| 49 | 49 | PyAPI_FUNC(int) PyWeakref_IsDead(PyObject *ref); | |
| 50 | - | ||
| 51 | - Py_DEPRECATED(3.13) static inline PyObject* PyWeakref_GET_OBJECT(PyObject *ref_obj) | ||
| 52 | - { | ||
| 53 | - PyWeakReference *ref = _PyWeakref_CAST(ref_obj); | ||
| 54 | - PyObject *obj = ref->wr_object; | ||
| 55 | - // Explanation for the Py_REFCNT() check: when a weakref's target is part | ||
| 56 | - // of a long chain of deallocations which triggers the trashcan mechanism, | ||
| 57 | - // clearing the weakrefs can be delayed long after the target's refcount | ||
| 58 | - // has dropped to zero. In the meantime, code accessing the weakref will | ||
| 59 | - // be able to "see" the target object even though it is supposed to be | ||
| 60 | - // unreachable. See issue gh-60806. | ||
| 61 | - if (Py_REFCNT(obj) > 0) { | ||
| 62 | - return obj; | ||
| 63 | - } | ||
| 64 | - return Py_None; | ||
| 65 | - } | ||
| 66 | - #define PyWeakref_GET_OBJECT(ref) PyWeakref_GET_OBJECT(_PyObject_CAST(ref)) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,6 @@ PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, | |||
| 27 | 27 | PyObject *callback); | |
| 28 | 28 | PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, | |
| 29 | 29 | PyObject *callback); | |
| 30 | - Py_DEPRECATED(3.13) PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); | ||
| 31 | 30 | ||
| 32 | 31 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030D0000 | |
| 33 | 32 | PyAPI_FUNC(int) PyWeakref_GetRef(PyObject *ref, PyObject **pobj); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments