◐ Shell
clean mode source ↗

bpo-1635741 - port unicodedata to multi-phase init by koubaa · Pull Request #22145 · python/cpython

Second attempt, this time I'm slightly less ignorant about CPython core and argument clinic.

"Every problem in software engineering can be solved by adding a layer of indirection". I hope this is true about porting unicodedata to multi-phase init.

The challenge with this module is that the methods are shared between the module, class and in some cases a capsule API. Each of those cases will have its own way to get the module state (which is optional in the case of the capsule API).

I created internal functions like unicodedata_UCD_normalize_internal which is passed in the module state. The class methods pass it in by getting it from the defining class, the module methods get it their own way.

https://bugs.python.org/issue1635741