This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove _PySys_GetObjectId / _PySys_GetObjectId
Type: enhancement Stage: resolved
Components: C API Versions: Python 3.11
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: corona10 Nosy List: arhadthedev, corona10, eric.snow, pitrou, vstinner
Priority: normal Keywords: patch

Created on 2022-03-11 14:08 by corona10, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 31835 merged corona10, 2022-03-12 09:37
Messages (9)
msg414907 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2022-03-11 14:08
There is no usage of _PySys_GetObjectId / _PySys_GetObjectId private APIs in CPython project.
Since these APIs use _Py_Identifier as the parameter, it looks good to be removed this time when there is no usage at all.
But before removing these APIs, I will investigate the current usage of external projects even if they are not intended to be used from outside.
msg414913 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2022-03-11 15:32
./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stdin)  // borrowed ref
./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stdout)  // borrowed ref
./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stderr)  // borrowed ref
./top_5000/pickle5-0.0.12.tar.gz: pickle5-0.0.12/pickle5/_pickle.c: modules = _PySys_GetObjectId(&PyId_modules);
msg414914 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2022-03-11 15:38
@pitrou

https://github.com/pitrou/pickle5-backport/blob/e6117502435aba2901585cc6c692fb9582545f08/pickle5/_pickle.c#L1937

Do you have a plan to use PySys_GetObject("modules") instead of _PySys_GetObjectId(&PyId_modules)?
msg414915 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2022-03-11 15:40
@vstinner
From my view, PySys_GetObject is available since Python3.2 both APIs look safe to remove.
msg414917 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-03-11 16:38
https://pypi.org/project/pickle5/ should not be used on Python 3.8 and newer: it's a backport for Python 3.7 and older.
msg414918 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-03-11 16:40
> From my view, PySys_GetObject is available since Python3.2 both APIs look safe to remove.

_PySys_GetObjectId() and _PySys_GetObjectId() are private API and can be removed anytime. We don't provide any backward compatibility warranty on the private API:
https://docs.python.org/dev/c-api/stable.html#c-api-stability

"Names prefixed by an underscore, such as _Py_InternalState, are private API that can change without notice even in patch releases."
msg414920 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-03-11 16:41
> ./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stdout)  // borrowed ref

It would be nice to notify datatable, or even propose a PR, if the _PySys_GetObjectId() is removed in Python 3.11.
msg414989 - (view) Author: Oleg Iarygin (arhadthedev) * Date: 2022-03-12 11:25
> ./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stdin)  // borrowed ref

All three occurences look like this [1] for two years (see git blame):

    #ifndef Py_LIMITED_API
      _PySys_GetObjectId(&PyId_stdin)  // borrowed ref
    #else
      PySys_GetObject("stdin")         // borrowed ref
    #endif

So everything is fixed already.

[1]: https://github.com/h2oai/datatable/search?q=_PySys_GetObjectId
msg415133 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2022-03-14 12:48
New changeset bb1c543f4a183f5cfdf15aad59f59094d50b37fd by Dong-hee Na in branch 'main':
bpo-46987: Remove _PySys_GetObjectId / _PySys_GetObjectId (GH-31835)
https://github.com/python/cpython/commit/bb1c543f4a183f5cfdf15aad59f59094d50b37fd
History
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91143
2022-03-14 12:48:17corona10setstatus: open -> closed
stage: patch review -> resolved
2022-03-14 12:48:09corona10setmessages: + msg415133
2022-03-12 11:25:09arhadthedevsetnosy: + arhadthedev
messages: + msg414989
2022-03-12 09:37:42corona10setkeywords: + patch
stage: patch review
pull_requests: + pull_request29933
2022-03-11 16:41:39vstinnersetmessages: + msg414920
2022-03-11 16:40:05vstinnersetmessages: + msg414918
2022-03-11 16:38:40vstinnersetmessages: + msg414917
2022-03-11 15:40:19corona10setmessages: + msg414915
2022-03-11 15:38:12corona10setnosy: + pitrou
messages: + msg414914
2022-03-11 15:32:23corona10setmessages: + msg414913
2022-03-11 14:08:22corona10create