Ethan Furman added the comment:
Found it!
It was a combination of __objclass__ not being defined on the enum mmebers, and
the metatype not being searched in the __mro__ by inspect. Thanks, Ronald, for
the necessary clues.
Patch attached.
I'm not sure if I have the method wowser showi
Ethan Furman added the comment:
Issue18693 has a patch to `inspect` so that classify_class_attrs will also look
in the metaclass. If that is accepted I think PyDoc is okay as is.
--
___
Python tracker
<http://bugs.python.org/issue16
Ethan Furman added the comment:
help() won't really be fixed with the inspect patch. If no objections within a
few hours I'll open a new issue for it.
--
___
Python tracker
<http://bugs.python.o
Ethan Furman added the comment:
I'm not suggesting we try to make it impossible, just tougher (akin to what we
did with the name and value attributes on
an Enum member -- at Guido's behest, no less ;).
--
___
Python tracker
<http://bu
New submission from Ethan Furman:
Python 3.4.0a1+ (default:33727fbb4668+, Aug 31 2013, 12:34:55)
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
--> import enum
--> class Test(enum.Enum):
... this
Ethan Furman added the comment:
Eli Bendersky added the comment:
>
> So let's stop trying to make enums even more alien. This is a non-issue in
> Python.
Enumerations are supposed to be constant. Since this is Python there is
actually very little that cannot be changed,
b
Ethan Furman added the comment:
Yes, as a matter of fact:
--> Test.this
--> Test.this = 'other'
--> Test.this
'other'
--> Test('that')
--> list(Test)
[]
As you can see, the Test Enum becomes inconsistent if this is allowed.
--
_
New submission from Ethan Furman:
Part of the solution for Issue18693 is to have `inspect.classify_class_attrs()`
properly consider the metaclass (or type) of the class when searching for the
origination point of class attributes.
The fix is changing line 325:
-for base in (cls
Changes by Ethan Furman :
Added file: http://bugs.python.org/file31594/local_fix.stoneleaf.01
___
Python tracker
<http://bugs.python.org/issue18929>
___
___
Python-bug
Changes by Ethan Furman :
Added file: http://bugs.python.org/file31595/global_fix.stoneleaf.01
___
Python tracker
<http://bugs.python.org/issue18929>
___
___
Python-bug
Changes by Ethan Furman :
--
stage: -> patch review
Added file: http://bugs.python.org/file31596/issue18924.stoneleaf.patch.01
___
Python tracker
<http://bugs.python.org/issu
Ethan Furman added the comment:
The global fix causes these two tests to fail:
==
FAIL: test_newstyle_mro (test.test_inspect.TestClassesAndFunctions
Ethan Furman added the comment:
Another option with the global fix is to only add the metaclass to the mro if
the metaclass is not 'type'.
--
___
Python tracker
<http://bugs.python.o
Ethan Furman added the comment:
Heavy-handed would be having the metaclass turn all the enum members into
read-only properties. The solution I have proposed is more like a wagging of
one's finger saying, "No, no, that's no
Ethan Furman added the comment:
In retrospect the read-only properties would not be any more difficult to get
around than the __setattr__ solution, and it would conflict with our use of
_RouteClassAttributeToGetattr.
To properly replace an enum member one has to change two internal data
Ethan Furman added the comment:
"Crash" is probably too strong. help() runs, but doesn't return anything
useful.
Metaclasses aside, I think the real issue here is objects that don't have
__objclass__ defined. __objclass__ has been around for over a decade (see
PEP-
Ethan Furman added the comment:
Ronald said:
> One possible workaround: assume that the class is the inspected
> class when a name returned by dir(cls) cannot be found in one of
> the classes on the mro.
At some point will this cause help to display an attribute on the wr
Ethan Furman added the comment:
dir(obj) is only confused if it returns attributes that are not found in
obj.__dict__ (aka virtual attributes).
For these virtual attributes, setting __objclass__ solves the problem.
Armin, when you say it's a workaround do you mean __objclass__ itself, o
Ethan Furman added the comment:
Run the test suite both with and without the patch, and compare the results.
Additional skipped tests, additional failed tests, or less than the number of
expected additional tests signal a problem.
The first two should be automatable, the last depends on the
Ethan Furman added the comment:
Okay, taking a step back.
It seems that currently inspect is geared towards instances and classes, not
metaclasses. Consequently, so is help.
So, how do we enhance inspect so that help can be metaclass aware?
classify_class_attrs seems like an obvious choice
Ethan Furman added the comment:
Antoine, to answer all your questions at once, and using an Enum as the example:
--> dir(Color)
['__class__', '__doc__', '__members__', '__module__', 'blue', 'green', 'red']
-->
Ethan Furman added the comment:
This is a more useful help() -- patch attached.
==
Help on class Color in module __main__:
class Color(enum.Enum)
| Method resolution order:
| Color
| enum.Enum
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue18986>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
I would say
- transformkeydict
Too bad we can't just add an extra 'transform_key' keyword to defaultdict.
--
___
Python tracker
<http://bugs.pyt
New submission from Ethan Furman:
Consider:
==
-->from enum import Enum
-->class Color(Enum):
... red = 1
... green = 2
... blue = 3
... red = 4
...
Traceback (most recent call last):
File "&q
Ethan Furman added the comment:
To the point, however, Eric's example would make use of both the defaultdict
portion and the transformkey portion in a single dict.
--
___
Python tracker
<http://bugs.python.org/is
Ethan Furman added the comment:
Precisely what I was thinking. :)
--
___
Python tracker
<http://bugs.python.org/issue18986>
___
___
Python-bugs-list mailin
Ethan Furman added the comment:
Cool. Latest patch has a slight doc fix for getmembers.
Will commit on Friday if no other pertinent feedback.
--
assignee: -> ethan.furman
stage: -> patch review
Added file: http://bugs.python.org/file31706/issue18929.stoneleaf.04
Changes by Ethan Furman :
--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file31707/issue18281.stoneleaf.01.patch
___
Python tracker
<http://bugs.python.org/issu
Ethan Furman added the comment:
Interestingly enough, the two constants that are used are prefixed with `stat`.
Patch attached.
Adios!
--
___
Python tracker
<http://bugs.python.org/issue18
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue19002>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ethan Furman :
--
versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.5
___
Python tracker
<http://bugs.python.org/issue19002>
___
___
Python-bug
Ethan Furman added the comment:
It's going to take more than "I think that that's not true," to get a change
made.
>From http://docs.python.org/2/library/functions.html#dir :
>
> Because dir() is supplied primarily as a convenience for use at an
> interacti
Ethan Furman added the comment:
So when you do a `dir(int)` you don't want to know what you can call on 7?
You'd rather know what you can call on 'type'?
--
___
Python tracker
<http://bug
Ethan Furman added the comment:
Cool, I didn't even know __reversed__ existed!
--
assignee: -> ethan.furman
stage: -> patch review
___
Python tracker
<http://bugs.python.
Ethan Furman added the comment:
Yes, I was aware of that method (not that we would add it that way).
__reversed__ is definitely better for Enum.
--
___
Python tracker
<http://bugs.python.org/issue18
Ethan Furman added the comment:
On 09/11/2013 02:39 PM, Tim Delaney wrote on PyDev:
>
> I would think that retrieving the keys from the dict would return the
> transformed keys (I'd
> call them canonical keys).
The more I think about this the more I agree. A canonic
New submission from Ethan Furman :
>From http://docs.python.org/py3k/reference/datamodel.html#object.__hash__
---
Classes which inherit a __hash__() method from a parent class but change the
meaning of __eq__() such that
Ethan Furman added the comment:
Éric Araujo wrote:
> Changes by Éric Araujo :
>
>
> --
> versions: +Python 2.7 -Python 3.1
The docs for 2.7 are correct, as __hash__ is not automatically
suppressed in that ver
Ethan Furman added the comment:
More re-writing...
--
Added file: http://bugs.python.org/file25264/__hash__2.diff
___
Python tracker
<http://bugs.python.org/issue14
Ethan Furman added the comment:
Are the changes good? Can they be commited?
--
___
Python tracker
<http://bugs.python.org/issue14617>
___
___
Python-bugs-list m
Ethan Furman added the comment:
Newest changes uploaded.
--
Added file: http://bugs.python.org/file25707/__hash__3.diff
___
Python tracker
<http://bugs.python.org/issue14
New submission from Ethan Furman :
The weak reference docs could be clearer about when weak ref'ed objects are no
longer available. Attached doc patch attempts to do so.
--
files: weakref_doc_updates.diff
keywords: patch
messages: 161895
nosy: stoneleaf
priority: normal
sev
Ethan Furman added the comment:
Changed "... will return the object ..." to " ... may return the object ..."
For reference, here's the new text:
A weak reference to an object is not enough to keep the object alive: when the
only remaining references to a referent a
Ethan Furman added the comment:
I agree that "raise from None" would be a nice enhancement.
I don't see it going into 3.3 since we've hit feature freeze.
Nick, do we need another PEP, or just consensus on pydev? (If consensus, I can
bring it up there after 3.
Ethan Furman added the comment:
Okay, I see your point. It's also not difficult to work around if you really
want to toss the extra info:
except NameError:
try:
fallback_module.getch()
except Exception as exc:
raise exc
Ethan Furman added the comment:
Patch attached. It basically says:
8<
Note: Because using :keyword:`from` can throw away valuable debugging
information, its use with a bare :keyword:`raise` is not supported. If you
Ethan Furman added the comment:
Nick Coghlan wrote:
> The from clause is intended for replacing previous exceptions with *new*
> exceptions, not editing the attributes of existing ones which may already
> have a different __cause__ set.
Huh. While I agree with the doc patch solution
Ethan Furman added the comment:
Tyler Crompton wrote:
> I'm in a little over my head as I can't conceptualize __cause__, so I may be
> looking over things.
>
> First, you, Ethan, said the following:
>
>> It's also not difficult to work around if you re
Ethan Furman added the comment:
Removed sample code from doc patch as it was not robust, nor recommended
practice. New patch is effectively:
Note: Because using :keyword:`from` can throw away valuable debugging
information, its use with a bare :keyword:`raise` is not supported
Ethan Furman added the comment:
The documentation says, "Returns a list of output lines"; an empty list is not
a list of lines.
--
nosy: +stoneleaf
___
Python tracker
<http://bugs.python.o
Ethan Furman added the comment:
Not sure I would worry about fixing it in 2.7, although I don't have strong
feelings about that.
--
___
Python tracker
<http://bugs.python.org/is
Ethan Furman added the comment:
Antoine Pitrou wrote:
> Antoine Pitrou added the comment:
>
>> an empty list is not a list of lines
>
> Really?
>
>>>> "".splitlines()
> []
Really.
--> ''.split('\n')
['
Ethan Furman added the comment:
Ethan Furman wrote:
>> Antoine Pitrou added the comment:
>>
>>>>> "".splitlines()
>> []
>
> --> ''.split('\n')
> ['']
I see the docs have been fixed in 3 to explain
Ethan Furman added the comment:
Antoine Pitrou wrote:
> Antoine Pitrou added the comment:
>
>> Really.
>>
>> --> ''.split('\n')
>> ['']
>
> You claimed that an empty list is not a list of lines. I countered that
> spli
Ethan Furman added the comment:
Chris Jerdonek wrote:
> Here is an example on a paragraph with line breaks between paragraphs:
s/paragraph/text/
>>>> def wrap_paras(text, width=70, **kwargs):
> ... lines = [line for para in text.splitlines()
> ...
Ethan Furman added the comment:
Any problems with the current doc patch? If not, can it be applied before RC1?
--
___
Python tracker
<http://bugs.python.org/issue15
Ethan Furman added the comment:
Any problems with the current doc patch? If not, can it be applied before RC1?
--
___
Python tracker
<http://bugs.python.org/issue14
Ethan Furman added the comment:
Any problems with the current doc patch? If not, can it be applied before RC1?
--
___
Python tracker
<http://bugs.python.org/issue14
Ethan Furman added the comment:
RC2 has just been released. Any chance of this getting in to the final
release? Nobobdy has pointed out any problems with the last update...
--
___
Python tracker
<http://bugs.python.org/issue14
Ethan Furman added the comment:
R. David Murray wrote:
> I rewrote the section a bit differently than you did in your patch...if you
> think my changes are not an improvement please let me know.
This line is incorrect:
A class which defines its own :meth:`__hash__` that explicitly ra
Ethan Furman added the comment:
Ethan Furman wrote:
> Ethan Furman added the comment:
>
> R. David Murray wrote:
>> I rewrote the section a bit differently than you did in your patch...if you
>> think my changes are not an improvement please let me know.
>
> Thi
Ethan Furman added the comment:
Can we also get this committed before 3.3.0 final?
--
___
Python tracker
<http://bugs.python.org/issue15209>
___
___
Python-bug
Changes by Ethan Furman :
--
nosy: +stoneleaf
___
Python tracker
<http://bugs.python.org/issue16131>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ethan Furman:
On Windows multiprocessing has a well known limitation: because there is no
fork() new shells must be invoked, and if the call that ultimately starts
multiprocessing is not guarded by an `if __name__ == '__main___'` check an
infinite loops resul
Ethan Furman added the comment:
I'm inclined to leave it open while I do the suggested research.
Thanks for the tips, Terry, and the numbers, Josh.
--
___
Python tracker
<http://bugs.python.org/is
Ethan Furman added the comment:
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
--> bytes(5)
'5
Ethan Furman added the comment:
No, apparently I am incapable of spelling pseudo correctly. I'll fix that
along with the better error message:
%x format: an integer is required, not float
(variable, obviously ;)
--
___
Python tracker
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue20145>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
Final status:
3.4 -> DeprecationWarning
3.5 -> TypeError
--
resolution: -> fixed
stage: commit review -> committed/rejected
status: open -> closed
___
Python tracker
<http://bugs.pyt
Changes by Ethan Furman :
--
versions: +Python 3.5 -Python 3.4
___
Python tracker
<http://bugs.python.org/issue8297>
___
___
Python-bugs-list mailing list
Unsub
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
Changes by Ethan Furman :
--
stage: needs patch -> test needed
versions: +Python 3.5 -Python 3.4
___
Python tracker
<http://bugs.python.org/issue1615>
___
_
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue21068>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
Mostly new patch against 3.5
--
Added file: http://bugs.python.org/file34634/issue8297.stoneleaf.01.patch
___
Python tracker
<http://bugs.python.org/issue8
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue21076>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
Results from the first two tests in my test script:
--
'WithOut' object has no attribute 'not_here'
looking up not_here
looking up huh
'With' object has no attribute 'not_h
Changes by Ethan Furman :
Removed file: http://bugs.python.org/file34647/issue1615.stoneleaf.01.patch
___
Python tracker
<http://bugs.python.org/issue1615>
___
___
Pytho
Changes by Ethan Furman :
Added file: http://bugs.python.org/file34648/issue1615.stoneleaf.01.patch
___
Python tracker
<http://bugs.python.org/issue1615>
___
___
Pytho
Ethan Furman added the comment:
PEP 461 has been accepted. I'll look over the code soon.
--
assignee: -> ethan.furman
___
Python tracker
<http://bugs.python.org
Ethan Furman added the comment:
Downside to this patch (stoneleaf.01) is that custom AttributeErrors raised in
__getattr__ are overridden, which is a pretty severe regression.
--
___
Python tracker
<http://bugs.python.org/issue1
Changes by Ethan Furman :
Removed file: http://bugs.python.org/file34648/issue1615.stoneleaf.01.patch
___
Python tracker
<http://bugs.python.org/issue1615>
___
___
Pytho
Changes by Ethan Furman :
--
Removed message: http://bugs.python.org/msg215091
___
Python tracker
<http://bugs.python.org/issue1615>
___
___
Python-bugs-list m
Ethan Furman added the comment:
Downside to this patch (stoneleaf.02) is that custom AttributeErrors raised in
__getattr__ are overridden, which is a pretty severe regression.
(Removed, renamed, and reloaded patch.)
--
Added file: http://bugs.python.org/file34657/issue1615.stoneleaf
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue10769>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
Looks good to me.
--
___
Python tracker
<http://bugs.python.org/issue21068>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
Sounds good to me.
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue20421>
___
___
Python-bugs-list mailin
Ethan Furman added the comment:
Yay, 'resolved' !
--
stage: patch review -> resolved
___
Python tracker
<http://bugs.python.org/issue8297>
___
_
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue6839>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
Actually, I haven't had this issue in quite a while now, so closing.
Thanks for taking a look at it, Jesús.
--
status: open -> closed
___
Python tracker
<http://bugs.python.org
Ethan Furman added the comment:
Adam, please stop deleting the files. It makes for a lot of noise to those on
the nosy list, and is unnecessary.
Just make sure you increment the version number on the files you upload and it
will be fine.
Thanks
Ethan Furman added the comment:
Adam Polkasnik said:
> Extraction works fine, the issue was that raise() was creating an exception,
> and
> stopping the whole extraction process.
That doesn't make sense. If an exception was "stopping the whole extrac
Ethan Furman added the comment:
Ah, so when you (Adam) said "extraction works fine", what you meant was
"extraction works fine *in other programs*". Okay.
--
___
Python tracker
<http://bu
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue21469>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue19979>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue17352>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue18334>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue17421>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue17422>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<http://bugs.python.org/issue17044>
___
___
Python-bugs-list mailing list
Unsubscribe:
801 - 900 of 1868 matches
Mail list logo