◐ Shell
clean mode source ↗

bpo-45434: Remove pystrhex.h header file by vstinner · Pull Request #28923 · python/cpython

Conversation

@vstinner

Move Include/pystrhex.h to Include/internal/pycore_strhex.h.
The header file only contains private functions.

The following C extensions are now built with Py_BUILD_CORE_MODULE
macro defined to get access to the internal C API:

  • _blake2
  • _hashopenssl
  • _md5
  • _sha1
  • _sha3
  • _ssl
  • binascii

https://bugs.python.org/issue45434

Move Include/pystrhex.h to Include/internal/pycore_strhex.h.
The header file only contains private functions.

The following C extensions are now built with Py_BUILD_CORE_MODULE
macro defined to get access to the internal C API:

* _blake2
* _hashopenssl
* _md5
* _sha1
* _sha3
* _ssl
* binascii

@vstinner

In the PyPI top 5000 packages, a single package uses the pystrhex.h private functions: the pysha3 package uses the private function _Py_strhex().

$ ./search_pypi_top_5000.sh _Py_strhex
pypi-top-5000_2021-08-17/pysha3-1.0.2.tar.gz
pypi-top-5000_2021-08-17/graphene-federation-0.1.0.tar.gz
pypi-top-5000_2021-08-17/frozendict-2.0.6.tar.gz
  • pysha3-1.0.2.tar.gz: #include "pystrhex.h", it has a copy of the code for Python 3.4 and older
  • graphene-federation-0.1.0.tar.gz: false alarm, it contains a virtual environment which contains python executable files
  • frozendict-2.0.6.tar.gz: false alarm, it contains a copy of the Include/pystrhex.h file.

@vstinner

the pysha3 package uses the private function _Py_strhex()

https://pypi.org/project/pysha3/ is a backport of the Python stdlib _sha3 module for Python 2.7-3.6. The latest release was published in 2017. Since this project only makes sense on Python 3.6 and older, I don't think that we should bother with this module. It should not be used on Python 3.11 which already provides a maintained _sha3 module.