Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep deprecated functions in Python 3.13: remove this deprecation #105373

Closed
vstinner opened this issue Jun 6, 2023 · 6 comments
Closed

Keep deprecated functions in Python 3.13: remove this deprecation #105373

vstinner opened this issue Jun 6, 2023 · 6 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

vstinner commented Jun 6, 2023

There are multiple Python functions marked as "deprecated", usually only in the documentation, or sometimes in comments, whereas the feature is there for a long time and there is no need to remove them, or the rationale changed.

For example, the array.array('u') format was deprecated since it used the Py_UNICODE C type (which is deprecated), but the code was updated to use the wchar_t C type which is fine and not depreated.

Another example is passing NULL as value to PyObject_SetAttr(obj, name, value) to delete an object attribute is deprecated... but this feature exists since the birth of Python. I don't think that it's really useful to deprecate this behavior: it's fine to keep it. The PyObject_DelAttr() function is just implemented as a macro passing NULL:

#define  PyObject_DelAttr(O, A) PyObject_SetAttr((O), (A), NULL)

Linked PRs

@vstinner vstinner added the type-bug An unexpected behavior, bug, or error label Jun 6, 2023
@hugovk
Copy link
Member

hugovk commented Jun 6, 2023

See also #80480 which links to a merged PR to add array.array('w') and with an open PR to deprecate array.array('u'), cc @methane.

vstinner added a commit to vstinner/cpython that referenced this issue Jun 6, 2023
…precated

Remove the deprecation on the following functions:

* PyObject_SetAttr(obj, attr_name, NULL)
* PyObject_SetAttrString(obj, attr_name, NULL)
* PySequence_SetItem(obj, i, NULL)
* PySequence_SetSlice(obj, i1, i2, NULL)
vstinner added a commit to vstinner/cpython that referenced this issue Jun 6, 2023
Remove the deprecation on the following functions:

* PyObject_SetAttr(obj, attr_name, NULL)
* PyObject_SetAttrString(obj, attr_name, NULL)
* PySequence_SetItem(obj, i, NULL)
* PySequence_SetSlice(obj, i1, i2, NULL)
vstinner added a commit to vstinner/cpython that referenced this issue Jun 6, 2023
Remove the deprecation on the following functions:

* PyObject_SetAttr(obj, attr_name, NULL)
* PyObject_SetAttrString(obj, attr_name, NULL)
* PySequence_SetItem(obj, i, NULL)
* PySequence_SetSlice(obj, i1, i2, NULL)

Deprecation added by commit ed82604.
@vstinner
Copy link
Member Author

vstinner commented Jun 6, 2023

I wanted to propose the keep the deprecated logging.Logger.warn() method (remove its deprecation)... but instead I proposed to remove it :-) see issue #105376.

vstinner added a commit to vstinner/cpython that referenced this issue Jun 6, 2023
There is no plan to deprecate PyArg_Parse().

The deprecation was added as a comment in the C API documentation in
2007 by commit 85eb8c1.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 6, 2023
The deprecation is on decimal.HAVE_THREADS, not on the whole module.
vstinner added a commit that referenced this issue Jun 6, 2023
The deprecation is on decimal.HAVE_THREADS, not on the whole module.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 9, 2023
There is no plan to deprecate PyArg_Parse().

The deprecation was added as a comment in the C API documentation in
2007 by commit 85eb8c1.
@arhadthedev
Copy link
Member

For example, the array.array('u') format was deprecated since it used the Py_UNICODE C type (which is deprecated), but the code was updated to use the wchar_t C type which is fine and not depreated.

@methane
Copy link
Member

methane commented Jun 12, 2023

See #80480 (comment)

There are few situations where platform- or compiler-dependent wchar_t arrays are useful.
Many users use array('u') as a mutable Unicode buffer, and array('w') is recommended for that use.

vstinner added a commit that referenced this issue Jun 13, 2023
There is no plan to deprecate PyArg_Parse().

The deprecation was added as a comment in the C API documentation in
2007 by commit 85eb8c1.
vstinner added a commit to vstinner/cpython that referenced this issue Jul 7, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jul 7, 2023
Schedule the removal of C API global configuration variables in
Python 3.14. Announce the removal to help C extension maintainers to
upgrade their code.
vstinner added a commit that referenced this issue Jul 7, 2023
Schedule the removal of C API global configuration variables in
Python 3.14. Announce the removal to help C extension maintainers to
upgrade their code.
vstinner added a commit to vstinner/cpython that referenced this issue Jul 8, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jul 8, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jul 8, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jul 8, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jul 9, 2023
* Convert PyObject_DelAttr() and PyObject_DelAttrString() macros to
  functions.
* Add PyObject_DelAttr() and PyObject_DelAttrString() functions to
  the stable ABI.
* Replace PyObject_SetAttr(obj, name, NULL) with
  PyObject_DelAttr(obj, name).
* weakref proxy_setattr() calls PyObject_DelAttr() if value is NULL.
vstinner added a commit to vstinner/cpython that referenced this issue Jul 9, 2023
* Convert PyObject_DelAttr() and PyObject_DelAttrString() macros to
  functions.
* Add PyObject_DelAttr() and PyObject_DelAttrString() functions to
  the stable ABI.
* Replace PyObject_SetAttr(obj, name, NULL) with
  PyObject_DelAttr(obj, name).
* weakref proxy_setattr() calls PyObject_DelAttr() if value is NULL.
vstinner added a commit to vstinner/cpython that referenced this issue Jul 9, 2023
* Convert PyObject_DelAttr() and PyObject_DelAttrString() macros to
  functions.
* Add PyObject_DelAttr() and PyObject_DelAttrString() functions to
  the stable ABI.
* Replace PyObject_SetAttr(obj, name, NULL) with
  PyObject_DelAttr(obj, name).
* weakref proxy_setattr() calls PyObject_DelAttr() if value is NULL.
@vstinner
Copy link
Member Author

Another example is passing NULL as value to PyObject_SetAttr(obj, name, value) to delete an object attribute is deprecated... but this feature exists since the birth of Python. I don't think that it's really useful to deprecate this behavior: it's fine to keep it. (...)

I created issue #106572: "Deprecate PyObject_SetAttr(obj, name, NULL): PyObject_DelAttr(obj, name) must be used instead".

@vstinner
Copy link
Member Author

Well, I did the cleanup that I wanted to do about pending incompatible changes. I just proposed a new PR #106675 to elaborate the "Pending Removal" documentation.

I propose to open new issues if we want to adjust other pending incompatible changes: unschedule them, schedule them, or schedule them earlier.

vstinner added a commit that referenced this issue Jul 12, 2023
…06675)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants