[issue39865] getattr silences an unrelated AttributeError

2020-03-05 Thread pasenor


New submission from pasenor :

if a class has a descriptor and a defined __getattr__ method, and an 
AttributeError (unrelated to the descriptor lookup) is raised inside the 
descriptor, it will be silenced:

class A:
@property
def myprop(self):
print("property called")
a = 1
a.foo  # <-- AttributeError that should not be silenced

def __getattr__(self, attr_name):
print("__getattr__ called")

a = A()
a.myprop


In this example myprop() is called, the error silenced, then __getattr__() is 
called.
This can lead to rather subtle bugs. Probably an explicit AttributeError should 
be raised instead.

--
messages: 363449
nosy: pasenor
priority: normal
severity: normal
status: open
title: getattr silences an unrelated AttributeError
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue37829] Documentation of stdlib: add example of mixed arguments to dict()

2019-08-12 Thread pasenor


Change by pasenor :


--
keywords: +patch
pull_requests: +14946
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15220

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



[issue37829] Documentation of stdlib: add example of mixed arguments to dict()

2019-08-12 Thread pasenor


New submission from pasenor :

The following use of the dict() function with both positional and keyword 
arguments  does follow from the description, but probably needs it's own 
example:

dict({'a': 1}, b=2}) == {'a': 1, 'b': 2}

--
assignee: docs@python
components: Documentation
messages: 349446
nosy: docs@python, pasenor
priority: normal
severity: normal
status: open
title: Documentation of stdlib: add example of mixed arguments to dict()
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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