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.

Author eric.snow
Recipients eric.snow, kumaraditya, serhiy.storchaka, vstinner
Date 2022-02-04.01:34:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643938461.12.0.505001669712.issue46541@roundup.psfhosted.org>
In-reply-to
Content
(thanks Victor: https://mail.python.org/archives/list/python-dev@python.org/message/7RMLIJHUWVBZFV747TFEHOE6LNBVQSMM/)

3rd party use of _Py_IDENTIFIER():

* blender
   + https://github.com/blender/blender/blob/master/source/blender/python/intern/bpy_traceback.c#L53
      - copied from core code
      - "msg", "filename", "lineno", "offset", "text", "<string>"
      - uses _PyObject_GetAttrId()
* datatable
   + https://github.com/h2oai/datatable/blob/45a87337bc68576c7fb6900f524925d4fb77d6a6/src/core/python/obj.cc#L76
      - in C++ wrapper getting sys.stdout, etc. and writing to sys.stdout
      - has to hack around C++14 support
      - has a fallback under limited API
      - "stdin", "stdout", "stderr", "write"
      - uses _PySys_GetObjectId(), _PyObject_GetAttrId()
* multidict (in aiohttp)
   + https://github.com/aio-libs/multidict/blob/6dedb623cca8e8fe64f502dfa479826efc321385/multidict/_multilib/defs.h#L8
   + https://github.com/aio-libs/multidict/blob/6dedb623cca8e8fe64f502dfa479826efc321385/multidict/_multilib/istr.h#L46
   + https://github.com/aio-libs/multidict/blob/6dedb623cca8e8fe64f502dfa479826efc321385/multidict/_multilib/pair_list.h#L114
      - calling str.lower()
      - "lower"
      - uses _PyObject_CallMethodId()
* mypy (exclusively in mypyc, including in generated code!)
   + https://github.com/python/mypy/blob/3c935bdd1332672f5daeae7f3f9a858a453333d4/mypyc/lib-rt/dict_ops.c#L76
   + https://github.com/python/mypy/blob/3c935bdd1332672f5daeae7f3f9a858a453333d4/mypyc/lib-rt/dict_ops.c#L131
      - "setdefault", "update"
      - uses _PyObject_CallMethodIdObjArgs(), _PyObject_CallMethodIdOneArg()
   + https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/pythonsupport.h#L26
   + https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/pythonsupport.h#L109
      - "__mro_entries__", "__init_subclass__"
      - uses _PyObject_LookupAttrId(), _PyObject_GetAttrId()
   + https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/misc_ops.c#L27
   + https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/misc_ops.c#L47
      - "send", "throw", "close"
      - uses _PyObject_CallMethodIdOneArg(), _PyObject_GetAttrId()
   + https://github.com/python/mypy/blob/8c5c915a89ec0f35b3e07332c7090e62f143043e/mypyc/lib-rt/bytes_ops.c#L104
      - "join"
      - uses _PyObject_CallMethodIdOneArg()
   + https://github.com/python/mypy/blob/3c935bdd1332672f5daeae7f3f9a858a453333d4/mypyc/codegen/emitwrapper.py#L326
   + https://github.com/python/mypy/blob/2b7e2df923f7e4a3a199915b3c8563f45bc69dfa/mypyc/lib-rt/misc_ops.c#L694
      - uses _PyObject_GetAttrId()
* pickle5
   + https://github.com/pitrou/pickle5-backport/blob/e6117502435aba2901585cc6c692fb9582545f08/pickle5/_pickle.c#L224
   + https://github.com/pitrou/pickle5-backport/blob/e6117502435aba2901585cc6c692fb9582545f08/pickle5/compat.h
      - "getattr"
      - uses _PyUnicode_FromId()
* pysqlite3
   + https://github.com/coleifer/pysqlite3/blob/f302859dc9ddb47a1089324dbca3873740b74af9/src/microprotocols.c#L103
   + https://github.com/coleifer/pysqlite3/blob/f302859dc9ddb47a1089324dbca3873740b74af9/src/microprotocols.c#L119
      - "__adapt__", "__conform__"
      - uses _PyObject_CallMethodId()
   + https://github.com/coleifer/pysqlite3/blob/093b88d1a58b141db8cf971c35ea1f6b674d0d02/src/connection.c#L51
   + https://github.com/coleifer/pysqlite3/blob/093b88d1a58b141db8cf971c35ea1f6b674d0d02/src/connection.c#L772
      - "finalize", "value", "upper", "cursor"
      - uses _PyObject_CallMethodId(), _PyObject_CallMethodIdObjArgs()
   + https://github.com/coleifer/pysqlite3/blob/49ce9c7a89a3c9f47ab8d32b6c4e2f7d629c1688/src/module.c#L195
      - "upper"
      - uses _PyObject_CallMethodId()
   + https://github.com/coleifer/pysqlite3/blob/91b2664f525b19feedfca3f0913302c6f1e8be8a/src/cursor.c#L103
      - "upper"
      - uses _PyObject_CallMethodId()
* typed_ast
   + a fork of CPython's ast code
* zodbpickle
   + a fork of CPython's pickle

All of them should be trivial to drop _Py_IDENTIFIER() without any real performance impact or mess.

Also, the following implies that PyPy has some sort of _Py_IDENTIFIER() support: https://github.com/benhoyt/scandir/blob/3396aa4155ffde8600a0e9ca50d5872569169b5d/_scandir.c#L51.
History
Date User Action Args
2022-02-04 01:34:21eric.snowsetrecipients: + eric.snow, vstinner, serhiy.storchaka, kumaraditya
2022-02-04 01:34:21eric.snowsetmessageid: <1643938461.12.0.505001669712.issue46541@roundup.psfhosted.org>
2022-02-04 01:34:21eric.snowlinkissue46541 messages
2022-02-04 01:34:20eric.snowcreate