Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when objects have custom `__mpz__` method raising errors #173

Closed
videlec opened this issue Nov 28, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@videlec
Copy link
Contributor

commented Nov 28, 2017

>>> import gmpy2
>>> class A:
...    def __mpz__(self): raise TypeError
>>> a = A()
>>> gmpy2.mpz(a)
** SEGFAULT **

vinklein added a commit to vinklein/gmpy that referenced this issue Nov 28, 2017

gmpy2_cache.c : Fix issue aleaxit#173
- Fix segfault when objects have custom `__mpz__`, `__mpq__`,
`__mpfr__` or `__mpc__` methods raising errors.

- add doctests for these cases.
@vinklein

This comment has been minimized.

Copy link
Contributor

commented Nov 28, 2017

Same problem with __mpq__, __mpfr__ and __mpc__ functions.
All fixed in PR #174

casevh added a commit that referenced this issue Nov 28, 2017

Merge pull request #174 from vinklein/master
gmpy2_cache.c : Fix issue #173
@casevh

This comment has been minimized.

Copy link
Collaborator

commented Nov 28, 2017

Thanks.

@casevh casevh closed this Nov 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.