Roundup Robot added the comment:
New changeset d84a69b7ba72 by Ethan Furman in branch 'default':
Issue8297: module attribute lookup failures now include module name in error
message.
http://hg.python.org/cpython/rev/d84a69b7ba72
--
nosy: +python-dev
Changes by Benjamin Peterson benja...@python.org:
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
Ethan Furman added the comment:
Yay, 'resolved' !
--
stage: patch review - resolved
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
___
Ethan Furman added the comment:
Mostly new patch against 3.5
--
Added file: http://bugs.python.org/file34634/issue8297.stoneleaf.01.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
Changes by Ethan Furman et...@stoneleaf.us:
--
versions: +Python 3.5 -Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
___
Ethan Furman added the comment:
ysj.ray: Your patch looks good. I had to make some changes since we're now at
3.5.
Before I can use your code, though, you need to sign the CLA [1].
Thanks.
[1] https://www.python.org/psf/contrib/contrib-form
--
Changes by Ethan Furman et...@stoneleaf.us:
--
assignee: - ethan.furman
versions: +Python 3.4 -Python 2.7, Python 3.2
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
___
Python-bugs-list
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
I also like the idea; 3 remarks though:
- the patch introduces a new function that returns a PyObject*, but returns
NULL when the attribute is not found, and the caller should raise
AttributeError.
This convention is not standard
Ray.Allen ysj@gmail.com added the comment:
Amaury:
Thanks for reviewing! I quite appreciate your ideas. I was not quite familiar
with python source code convention at that time. Here I worked out a new patch
based on your ideas.
Since py2.7 has released, this feature can only go to
Daniel Urban urban.dani...@gmail.com added the comment:
According to PEP 7 [1], all declarations must be at the top of a block. So you
probably should move the char *mod_name_str and PyModuleObject *module
declarations to the beginning of the function's body.
[1]
Ray.Allen ysj@gmail.com added the comment:
Thanks! durban.
Here is the updated patch fixing such problem.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
Changes by Daniel Diniz aja...@gmail.com:
--
nosy: +ajaksu2
stage: unit test needed - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
Ray.Allen ysj@gmail.com added the comment:
The unittest of this patch.
--
Added file: http://bugs.python.org/file16815/issue_8297_test.py
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
R. David Murray rdmur...@bitdance.com added the comment:
This is a feature request, so it only applies to unreleased versions. It'll be
up to Benjamin whether it can go into 2.7, if the change is approved, since 2.7
is now technically in feature freeze.
The patch also needs unit tests.
I do
Ray.Allen ysj@gmail.com added the comment:
This patch makes the AttributeError message generated from getting attributes
from module object more helpful, that is, print the module name. Now the error
message is:
module object 'mod_name' has no attribute 'xxx'
Instead of:
'module'
Chris Jerdonek chris.jerdo...@gmail.com added the comment:
Great -- thanks a lot for taking a stab at this!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
Changes by Chris Jerdonek chris.jerdo...@gmail.com:
--
versions: +Python 2.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
___
Ray.Allen ysj@gmail.com added the comment:
Yes, I agree with this feature request. And also the super(Class, obj) call
should return a reasonable AttributeError message when the requested attribute
is not found in one of Class's base classes, not just 'super' object has no
attribute
Ray.Allen ysj@gmail.com added the comment:
In fact, there are only three types of tp_getattro functions:
1.For type objects, it is type_getattro(), in case of AttributeError, this
function give the message format:
type object %(type)s has no attribute %(attr)s
2.For super
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti
priority: - low
stage: - needs patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8297
___
New submission from Chris Jerdonek chris.jerdo...@gmail.com:
It would be nice if the error message for an AttributeError could include the
module name when getting from a module -- just like it does for getting from a
class.
This would make the message more helpful. For example, it would
22 matches
Mail list logo