Sam Ezeh <[email protected]> added the comment:
This is what functionality looks like when supplying incorrect attribute names
with the patch.
Python 3.11.0a6+ (heads/bpo-47135-dirty:d4bb38f82b, Apr 1 2022, 20:01:56) [GCC
11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _pydecimal
>>> ctx = _pydecimal.getcontext()
>>> ctx.precision = 10
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/run/media/sam/OS/Git/cpython/Lib/_pydecimal.py", line 3974, in
__setattr__
raise AttributeError(
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'decimal.Context' object has no attribute 'precision'
>>> with _pydecimal.localcontext(precision=10) as ctx:
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/run/media/sam/OS/Git/cpython/Lib/_pydecimal.py", line 506, in
localcontext
setattr(ctx, key, value)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/sam/OS/Git/cpython/Lib/_pydecimal.py", line 3974, in
__setattr__
raise AttributeError(
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'decimal.Context' object has no attribute 'precision'
>>> import decimal
>>> ctx = decimal.getcontext()
>>> ctx.precision = 10
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'decimal.Context' object has no attribute 'precision'
>>> with decimal.localcontext(precision=10) as ctx:
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'precision' is an invalid keyword argument for this function
>>>
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue47135>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com