This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author DasIch
Recipients DasIch
Date 2011-01-17.02:10:12
SpamBayes Score 5.945244e-14
Marked as misclassified No
Message-id <1295230218.02.0.641570555776.issue10922@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-01-17 02:10:18DasIchsetrecipients: + DasIch
2011-01-17 02:10:18DasIchsetmessageid: <1295230218.02.0.641570555776.issue10922@psf.upfronthosting.co.za>
2011-01-17 02:10:12DasIchlinkissue10922 messages
2011-01-17 02:10:12DasIchcreate