Issue2272
Created on 2015-02-23.01:31:02 by jfroco, last changed 2015-03-17.13:50:52 by zyasoft.
File name |
Uploaded |
Description |
Edit |
Remove |
werkzeug-failures.txt
|
zyasoft,
2015-02-24.13:23:39
|
Werkzeug failures running py.test with less strict __slots__ patch |
|
|
msg9548 (view) |
Author: Juan Francisco Roco (jfroco) |
Date: 2015-02-23.01:31:01 |
|
Flask App used to work with 2.7-b3, but now it doesn't with 2.7-b4
The issue can be reproduced from the shell just importing flask:
In 2.7-b3: No errors:
$ java -jar jython-standalone-2.7-b3.jar
Jython 2.7b3 (default:e81256215fb0, Aug 4 2014, 02:39:51)
[OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.7.0_75
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
>>> quit()
In 2.7-b4: Errors:
$ java -jar jython-standalone-2.7-b4.jar
Jython 2.7b4 (default:3672e624962a, Feb 13 2015, 04:59:14)
[OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.7.0_75
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "flask/__init__.py", line 21, in <module>
from .app import Flask, Request, Response
File "flask/app.py", line 24, in <module>
from .helpers import _PackageBoundObject, url_for, get_flashed_messages, \
File "flask/helpers.py", line 40, in <module>
from .globals import session, _request_ctx_stack, _app_ctx_stack, \
File "flask/globals.py", line 14, in <module>
from werkzeug.local import LocalStack, LocalProxy
File "werkzeug/local.py", line 249, in <module>
@implements_bool
TypeError: Error when calling the metaclass bases
__dict__ slot disallowed: we already got one
>>>
|
msg9555 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-02-24.13:23:39 |
|
Werkzeug failures
|
msg9556 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-02-24.13:31:17 |
|
A minor change allows the import of Flask, and its dependent library, Werkzeug:
$ hg diff src/org/python/core/PyType.java
diff -r e909a4641731 src/org/python/core/PyType.java
--- a/src/org/python/core/PyType.java Sun Feb 22 10:40:10 2015 -0700
+++ b/src/org/python/core/PyType.java Tue Feb 24 07:19:16 2015 -0600
@@ -254,9 +254,9 @@
String slotName = confirmIdentifier(slot);
if (slotName.equals("__dict__")) {
- if (!mayAddDict || wantDict) {
- throw Py.TypeError("__dict__ slot disallowed: we already got one");
- }
+// if (!mayAddDict || wantDict) {
+// throw Py.TypeError("__dict__ slot disallowed: we already got one");
+// }
wantDict = true;
} else if (slotName.equals("__weakref__")) {
if (!mayAddWeak || wantWeak) {
Testing the current Werkzeug trunk (https://github.com/mitsuhiko/werkzeug) with the above patch, I get 6 failed, 407 passed, 12 skipped (http://bugs.jython.org/file1492/werkzeug-failures.txt). Some of these failures are due to bad test setup: Werkzeug should be using sys.executabe, not python in for example test_monkeypached_sleep. The rest should be looked at on Jython's end, especially:
TypeError: encode(): 1st arg can't be coerced to org.python.core.PyUnicode
My reading of https://docs.python.org/2/reference/datamodel.html#slots suggests that we are too strict and this is a correct change, and should also be applied to __weakref__. Also all the unit tests continue to work, so there's nothing actually requiring this strictness. But we need to think this change through. Adding pjenvey in case he has an opinion. I'm pretty sure this code has not changed since Phil's commit in 2009 (5921:c1b82fcfd3eb).
Blocker for RC1
|
msg9605 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-03-10.17:11:42 |
|
Fixed as of https://hg.python.org/jython/rev/4d28c47997de
|
|
Date |
User |
Action |
Args |
2015-03-17 13:50:52 | zyasoft | set | status: pending -> closed |
2015-03-10 17:11:42 | zyasoft | set | status: open -> pending assignee: zyasoft resolution: accepted -> fixed messages:
+ msg9605 |
2015-02-24 13:31:18 | zyasoft | set | priority: urgent nosy:
+ pjenvey resolution: accepted messages:
+ msg9556 |
2015-02-24 13:23:41 | zyasoft | set | files:
+ werkzeug-failures.txt nosy:
+ zyasoft messages:
+ msg9555 |
2015-02-23 01:31:02 | jfroco | create | |
|