[issue44625] Python C API version of `fractions` module

2021-07-13 Thread Azat Ibrakov
New submission from Azat Ibrakov : Are there any plans for implementing `fractions` module in C (like for `decimal` there is a https://github.com/python/cpython/blob/main/Modules/_decimal/_decimal.c module)? I've implemented one myself (https://github.com/lycantropos/cfractions) and

[issue44301] Is there a way to provide destructor for module written using C API?

2021-06-03 Thread Azat Ibrakov
Azat Ibrakov added the comment: With this setup https://gist.github.com/lycantropos/f9243dc98e104a13ddd991316e93d31a I get prompt about module being initialized but that's it: it never gets deleted and reference count for `Rational` keeps increasing. What am I mi

[issue44301] Is there a way to provide destructor for module written using C API?

2021-06-03 Thread Azat Ibrakov
New submission from Azat Ibrakov : I'm reimplementing `fractions.Fraction` class using C API (https://github.com/lycantropos/cfractions). And the problem is that I want to use `numbers.Rational` interface in my type checks to add support for user-defined rational numbers. I see how