diff options
author | Brett Cannon <brett@python.org> | 2013-05-04 17:56:58 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-05-04 17:56:58 (GMT) |
commit | 4c14b5de1cf372e963a4378fc6cb2bca36d24eb8 (patch) | |
tree | c3d96e142fa3166f582414beeb53fd9792599345 /Lib/ctypes | |
parent | 4cfc0b5411354323433031b5e03862def2f00234 (diff) | |
download | cpython-4c14b5de1cf372e963a4378fc6cb2bca36d24eb8.zip cpython-4c14b5de1cf372e963a4378fc6cb2bca36d24eb8.tar.gz cpython-4c14b5de1cf372e963a4378fc6cb2bca36d24eb8.tar.bz2 |
#17115,17116: Have modules initialize the __package__ and __loader__
attributes to None.
The long-term goal is for people to be able to rely on these
attributes existing and checking for None to see if they have been
set. Since import itself sets these attributes when a loader does not
the only instances when the attributes are None are from someone
overloading __import__() and not using a loader or someone creating a
module from scratch.
This patch also unifies module initialization. Before you could have
different attributes with default values depending on how the module
object was created. Now the only way to not get the same default set
of attributes is to circumvent initialization by calling
ModuleType.__new__() directly.
Diffstat (limited to 'Lib/ctypes')
-rw-r--r-- | Lib/ctypes/test/__init__.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/ctypes/test/__init__.py b/Lib/ctypes/test/__init__.py index cc5fe02..7c72210 100644 --- a/Lib/ctypes/test/__init__.py +++ b/Lib/ctypes/test/__init__.py @@ -37,7 +37,7 @@ def requires(resource, msg=None): def find_package_modules(package, mask): import fnmatch - if (hasattr(package, "__loader__") and + if (package.__loader__ is not None and hasattr(package.__loader__, '_files')): path = package.__name__.replace(".", os.path.sep) mask = os.path.join(path, mask) |