[Python-checkins] r50582 - python/trunk/Lib/ctypes/__init__.py
thomas.heller
python-checkins at python.org
Tue Jul 11 20:28:35 CEST 2006
Author: thomas.heller
Date: Tue Jul 11 20:28:35 2006
New Revision: 50582
Modified:
python/trunk/Lib/ctypes/__init__.py
Log:
When a foreign function is retrived by calling __getitem__ on a ctypes
library instance, do not set it as attribute.
Modified: python/trunk/Lib/ctypes/__init__.py
==============================================================================
--- python/trunk/Lib/ctypes/__init__.py (original)
+++ python/trunk/Lib/ctypes/__init__.py Tue Jul 11 20:28:35 2006
@@ -300,13 +300,14 @@
def __getattr__(self, name):
if name.startswith('__') and name.endswith('__'):
raise AttributeError, name
- return self.__getitem__(name)
+ func = self.__getitem__(name)
+ setattr(self, name, func)
+ return func
def __getitem__(self, name_or_ordinal):
func = self._FuncPtr((name_or_ordinal, self))
if not isinstance(name_or_ordinal, (int, long)):
func.__name__ = name_or_ordinal
- setattr(self, name_or_ordinal, func)
return func
class PyDLL(CDLL):
More information about the Python-checkins
mailing list