[Jython-checkins] jython: Let getattr(types.TypeType, '__abstractmethods__') raise AttributeError like

stefan.richthofer jython-checkins at python.org
Mon Jan 9 03:28:36 EST 2017


https://hg.python.org/jython/rev/5e27a3634428
changeset:   7993:5e27a3634428
user:        Stefan Richthofer <stefan.richthofer at gmx.de>
date:        Mon Jan 09 09:28:29 2017 +0100
summary:
  Let getattr(types.TypeType, '__abstractmethods__') raise AttributeError like CPython would do. So far Jython returned the getset_descriptor, which causes trouble in abc.py, because __abstractmethods__ is expected to be iterable or raise AttributeError. Partial fix for issue 2515, see http://bugs.jython.org/issue2515 for details.

files:
  src/org/python/core/PyType.java |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/src/org/python/core/PyType.java b/src/org/python/core/PyType.java
--- a/src/org/python/core/PyType.java
+++ b/src/org/python/core/PyType.java
@@ -1824,7 +1824,7 @@
     @ExposedGet(name = "__abstractmethods__")
     public PyObject getAbstractmethods() {
         PyObject result = dict.__finditem__("__abstractmethods__");
-        if (result == null) {
+        if (result == null || result instanceof PyDataDescr) {
             noAttributeError("__abstractmethods__");
         }
         return result;

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list