[New-bugs-announce] [issue39722] decimal differs between pure Python and C implementations

Shantanu report at bugs.python.org
Fri Feb 21 20:18:00 EST 2020


New submission from Shantanu <hauntsaninja at gmail.com>:

The dunder methods on decimal.Decimal accept an extra context argument in the pure Python version which the C version does not (violating PEP 399).

This came up in https://github.com/python/typeshed/pull/3633, where Sebastian provided the following summary of the issue:
```
Python 3.8.1 (default, Jan 14 2020, 19:41:43) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from _decimal import Decimal as CDecimal
>>> from _pydecimal import Decimal as PyDecimal
>>> PyDecimal(1).__abs__(None)
Decimal('1')
>>> CDecimal(1).__abs__(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected 0 arguments, got 1
```

----------
components: Library (Lib)
messages: 362443
nosy: hauntsaninja
priority: normal
severity: normal
status: open
title: decimal differs between pure Python and C implementations

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39722>
_______________________________________


More information about the New-bugs-announce mailing list