Issue2581
Created on 2017-04-27.01:38:07 by jaraco, last changed 2018-03-23.20:11:01 by jeff.allen.
msg11326 (view) |
Author: Jason R. Coombs (jaraco) |
Date: 2017-04-27.01:38:06 |
|
As discovered in https://github.com/pypa/setuptools/issues/1024#issuecomment-297586140, invoking inspect.getmro on a class whose bases include two or more classes with the same __name__ will return only the first one encountered. This script demonstrates the issue:
class OtherNamespace:
class Y:
pass
class Y:
pass
class Z(OtherNamespace.Y, Y):
pass
import inspect
print(inspect.getmro(Z))
|
msg11385 (view) |
Author: Jim Baker (zyasoft) |
Date: 2017-05-19.03:08:16 |
|
Very interesting. Likely an easy fix by being more precise - identity vs name.
|
msg11732 (view) |
Author: Jeff Allen (jeff.allen) |
Date: 2018-03-02.08:10:21 |
|
>>> OtherNamespace.Y == Y
True
Oops. The problem is PyClass.__cmp__.
We definitely want == (and !=) to be based on object identity, but it's not obvious what < should be. We can't have a<b and b<a both false and yet not have a==b which would be so if we still based it on name. If I've understood CPython correctly it compares by memory address.
Not sure this is a showstopper for 2.7.2 but leaving it so marked.
|
msg11850 (view) |
Author: Jeff Allen (jeff.allen) |
Date: 2018-03-23.20:11:01 |
|
Not a *showstopper* for 2.7.2, but a fix is welcome.
|
|
Date |
User |
Action |
Args |
2018-03-23 20:11:01 | jeff.allen | set | messages:
+ msg11850 milestone: Jython 2.7.2 -> |
2018-03-02 08:10:33 | jeff.allen | set | components:
+ Core, - Library |
2018-03-02 08:10:22 | jeff.allen | set | priority: normal resolution: accepted messages:
+ msg11732 nosy:
+ jeff.allen |
2017-09-13 21:15:37 | zyasoft | set | milestone: Jython 2.7.2 |
2017-05-19 03:08:17 | zyasoft | set | nosy:
+ zyasoft messages:
+ msg11385 |
2017-04-27 01:38:07 | jaraco | create | |
|