Message126389
Upon trying to create a proxy I stumbled upon this exception:
Traceback (most recent call last):
File "foo.py", line 11, in <module>
p.__class__.__call__(p)
SystemError: PyEval_EvalCodeEx: NULL globals
Investigating further led me to this code which reproduces the exception:
class Proxy(object):
def __init__(self, proxied):
self.proxied = proxied
@property
def __class__(self):
return self.proxied.__class__
def __call__(self):
return self.proxied.__call__()
p = Proxy(lambda: 1)
p.__class__.__call__(p)
I understand that `p.__class__.__call__()` expects an argument of a different type however this is not obvious from the exception itself. PyPy on the other hand raises this exception:
Traceback (most recent call last):
File "app_main.py", line 53, in run_toplevel
File "foo.py", line 11, in <module>
p.__class__.__call__(p)
TypeError: 'function' object expected, got 'Proxy' instead
Which explains the issue and is expected (at least by me) and apparently Jython raises an exception at least similar to PyPy's. |
|
Date |
User |
Action |
Args |
2011-01-17 02:10:18 | DasIch | set | recipients:
+ DasIch |
2011-01-17 02:10:18 | DasIch | set | messageid: <1295230218.02.0.641570555776.issue10922@psf.upfronthosting.co.za> |
2011-01-17 02:10:12 | DasIch | link | issue10922 messages |
2011-01-17 02:10:12 | DasIch | create | |
|