Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: third_party/psyco_win32/psyco/classes.py

Issue 6778017: Add use of Psyco to GYP on Windows. On my z600 with 12 GB of RAM, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for non-Windows platforms. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 ###########################################################################
2 #
3 # Psyco class support module.
4 # Copyright (C) 2001-2002 Armin Rigo et.al.
5
6 """Psyco class support module.
7
8 'psyco.classes.psyobj' is an alternate Psyco-optimized root for classes.
9 Any class inheriting from it or using the metaclass '__metaclass__' might
10 get optimized specifically for Psyco. It is equivalent to call
11 psyco.bind() on the class object after its creation.
12
13 Importing everything from psyco.classes in a module will import the
14 '__metaclass__' name, so all classes defined after a
15
16 from psyco.classes import *
17
18 will automatically use the Psyco-optimized metaclass.
19 """
20 ###########################################################################
21
22 __all__ = ['psyobj', 'psymetaclass', '__metaclass__']
23
24
25 from _psyco import compacttype
26 import core
27 from types import FunctionType
28
29 class psymetaclass(compacttype):
30 "Psyco-optimized meta-class. Turns all methods into Psyco proxies."
31
32 def __new__(cls, name, bases, dict):
33 bindlist = dict.get('__psyco__bind__')
34 if bindlist is None:
35 bindlist = [key for key, value in dict.items()
36 if isinstance(value, FunctionType)]
37 for attr in bindlist:
38 dict[attr] = core.proxy(dict[attr])
39 return super(psymetaclass, cls).__new__(cls, name, bases, dict)
40
41 psyobj = psymetaclass("psyobj", (), {})
42 __metaclass__ = psymetaclass
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698