I'm -1 on removing the PyUnicode APIs. We deliberately created a useful and very complete C API for Unicode.
The fact that PyPy chose to use a different internal representation is not a good reason to remove APIs and have CPython extension take the hit as a result. It would be better for PyPy rethink the internal representation or create a shim API which translates between the two worlds.
Note that UTF-8 is not a good internal representation for Unicode if you want fast indexing and slicing. This is why we are using fixed code units to represent the Unicode strings.
On 07.09.2018 10:22, Victor Stinner wrote:
Le ven. 7 sept. 2018 à 09:24, Ronald Oussoren ronaldoussoren@mac.com a écrit :
Maybe earlier if this efforts leads to an API that’s more friendly for PyPy.
Is there anything you can share about what API details are particularly problematic?
I'm in discussion with PyPy developers, and they reported different APIs which cause them troubles:
- in general, any API addition means more work for them
- anything which use borrowed references
- PyObject** should be banned: "PyObject** PySequence_Fast_ITEMS(ob)" has to go https://pythoncapi.readthedocs.io/bad_api.html#array-of-pointers-to-python-o...
- the finalizer API: I guess that it's an issue because of their different garbage collector
- almost all PyUnicode API functions have to go according to them. PyPy3 uses UTF-8 internally, CPython uses "compact string" (array of Py_UCS1, Py_UCS2 or Py_UCS4 depending on the string content). https://pythoncapi.readthedocs.io/bad_api.html#pypy-requests
I tried to list all PyPy requests on this "Bad C API" page.
I'm ok with removing PyObject** and most PyUnicode APIs, but I'm not sure about the finalizer API which seems to be a great enhancement of Python regarding to reference cycles.
Victor
capi-sig mailing list -- capi-sig@python.org To unsubscribe send an email to capi-sig-leave@python.org
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Experts (#1, Sep 07 2018)
Python Projects, Coaching and Consulting ... http://www.egenix.com/ Python Database Interfaces ... http://products.egenix.com/ Plone/Zope Database Interfaces ... http://zope.egenix.com/
::: We implement business ideas - efficiently in both time and costs :::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ http://www.malemburg.com/