Message176429
| Author |
daniel.urban |
| Recipients |
Arfrever, Mark.Shannon, alex, barry, benjamin.peterson, carsten.klein@axn-software.de, cvrebert, daniel.urban, eric.snow, meador.inge, michael.foord, ncoghlan, python-dev |
| Date |
2012年11月26日.17:20:34 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1353950438.62.0.699340135179.issue12370@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I tried to implement Nick's idea with the separate scope for __class__. It seems to work, I'm attaching a patch. The patch basically causes the following class statement:
class C(A, B, metaclass=meta):
def f(self):
return __class__
To be compiled approximately like this:
def _outer_C(*__args__, **__kw__):
class _inner_C(*__args__, **__kw__):
def f(self):
return __class__
__class__ = _inner_C
return _inner_C
C = _outer_C(A, B, metaclass=meta)
It also includes some tests.
(The patch also changes the magic number in Lib/importlib/_bootstrap.py. This caused Python/importlib.h to be regenerated, but I didn't included those changes in the patch, because its a lot, and not very human-readable. Please tell me if I need to include them.) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年11月26日 17:20:40 | daniel.urban | set | recipients:
+ daniel.urban, barry, ncoghlan, benjamin.peterson, Arfrever, alex, michael.foord, cvrebert, meador.inge, carsten.klein@axn-software.de, Mark.Shannon, python-dev, eric.snow |
| 2012年11月26日 17:20:38 | daniel.urban | set | messageid: <1353950438.62.0.699340135179.issue12370@psf.upfronthosting.co.za> |
| 2012年11月26日 17:20:38 | daniel.urban | link | issue12370 messages |
| 2012年11月26日 17:20:37 | daniel.urban | create |
|