[issue32239] decimal module exception args incorrect for c module

2017-12-07 Thread Stefan Krah

Stefan Krah  added the comment:

This is known and was deliberate when I wrote the module. The list contains 
conditions that trigger the exception.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> decimal C module's exceptions don't match the Python version

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32239] decimal module exception args incorrect for c module

2017-12-07 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +skrah

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32239] decimal module exception args incorrect for c module

2017-12-06 Thread Joshua Ringer

New submission from Joshua Ringer :

Exception instance args for decimal errors are supposed to be a descriptive 
string. However, in the c module, they are currently a list of one containing 
the underlying exception class. The pure python module is correct.

See the following interpreter output for further detail:

Python 3.6.3 (default, Oct  4 2017, 06:09:15)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from _pydecimal import Decimal
>>> Decimal('badstring')
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_pydecimal.py",
 line 597, in __new__
"Invalid literal for Decimal: %r" % value)
  File 
"/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_pydecimal.py",
 line 4081, in _raise_error
raise error(explanation)
decimal.InvalidOperation: Invalid literal for Decimal: 'badstring'
>>> from _decimal import Decimal
>>> Decimal('badstring')
Traceback (most recent call last):
  File "", line 1, in 
decimal.InvalidOperation: []

--
components: Library (Lib)
messages: 307788
nosy: joshringer
priority: normal
severity: normal
status: open
title: decimal module exception args incorrect for c module
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com