Show More
@@ -118,6 +118,11 b' class Config(dict):' | |||||
118 | return type(self)(copy.deepcopy(self.items())) |
|
118 | return type(self)(copy.deepcopy(self.items())) | |
119 |
|
119 | |||
120 | def __getitem__(self, key): |
|
120 | def __getitem__(self, key): | |
|
121 | # We cannot use directly self._is_section_key, because it triggers | |||
|
122 | # infinite recursion on top of PyPy. Instead, we manually fish the | |||
|
123 | # bound method. | |||
|
124 | is_section_key = self.__class__._is_section_key.__get__(self) | |||
|
125 | ||||
121 | # Because we use this for an exec namespace, we need to delegate |
|
126 | # Because we use this for an exec namespace, we need to delegate | |
122 | # the lookup of names in __builtin__ to itself. This means |
|
127 | # the lookup of names in __builtin__ to itself. This means | |
123 | # that you can't have section or attribute names that are |
|
128 | # that you can't have section or attribute names that are | |
@@ -126,7 +131,7 b' class Config(dict):' | |||||
126 | return getattr(__builtin__, key) |
|
131 | return getattr(__builtin__, key) | |
127 | except AttributeError: |
|
132 | except AttributeError: | |
128 | pass |
|
133 | pass | |
129 |
if |
|
134 | if is_section_key(key): | |
130 | try: |
|
135 | try: | |
131 | return dict.__getitem__(self, key) |
|
136 | return dict.__getitem__(self, key) | |
132 | except KeyError: |
|
137 | except KeyError: |
General Comments 0
You need to be logged in to leave comments.
Login now