Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r59853:eeddf44bbf34
Date: 2013-01-07 12:36 -0800
http://bitbucket.org/pypy/pypy/changeset/eeddf44bbf34/

Log:    kill the lonepycfiles option entirely, it's not so useful now that
        there's __pycache__ dirs

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -171,10 +171,6 @@
     BoolOption("usepycfiles", "Write and read pyc files when importing",
                default=True),
 
-    BoolOption("lonepycfiles", "Import pyc files with no matching py file",
-               default=False,
-               requires=[("objspace.usepycfiles", True)]),
-
     StrOption("soabi",
               "Tag to differentiate extension modules built for different 
Python interpreters",
               cmdline="--soabi",
diff --git a/pypy/doc/config/objspace.lonepycfiles.txt 
b/pypy/doc/config/objspace.lonepycfiles.txt
deleted file mode 100644
--- a/pypy/doc/config/objspace.lonepycfiles.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-If turned on, PyPy accepts to import a module ``x`` if it finds a
-file ``x.pyc`` even if there is no file ``x.py``.
-
-This is the way that CPython behaves, but it is disabled by
-default for PyPy because it is a common cause of issues: most
-typically, the ``x.py`` file is removed (manually or by a
-version control system) but the ``x`` module remains
-accidentally importable because the ``x.pyc`` file stays
-around.
-
-The usual reason for wanting this feature is to distribute
-non-open-source Python programs by distributing ``pyc`` files
-only, but this use case is not practical for PyPy at the
-moment because multiple versions of PyPy compiled with various
-optimizations might be unable to load each other's ``pyc``
-files.
diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -73,13 +73,8 @@
         if file_exists(pyfile):
             return PY_SOURCE, ".pyw", "U"
 
-    # The .py file does not exist.  By default on PyPy, lonepycfiles
-    # is False: if a .py file does not exist, we don't even try to
-    # look for a lone .pyc file.
-    # The "imp" module does not respect this, and is allowed to find
-    # lone .pyc files.
-    # check the .pyc file
-    if space.config.objspace.usepycfiles and 
space.config.objspace.lonepycfiles:
+    # The .py file does not exist, check the .pyc file
+    if space.config.objspace.usepycfiles:
         pycfile = filepart + ".pyc"
         if file_exists(pycfile):
             # existing .pyc file
diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -1283,13 +1283,10 @@
 class AppTestNoPycFile(object):
     spaceconfig = {
         "objspace.usepycfiles": False,
-        "objspace.lonepycfiles": False
     }
     def setup_class(cls):
         usepycfiles = cls.spaceconfig['objspace.usepycfiles']
-        lonepycfiles = cls.spaceconfig['objspace.lonepycfiles']
         cls.w_usepycfiles = cls.space.wrap(usepycfiles)
-        cls.w_lonepycfiles = cls.space.wrap(lonepycfiles)
         cls.saved_modules = _setup(cls.space)
 
     def teardown_class(cls):
@@ -1301,21 +1298,13 @@
         try:
             from compiled import lone
         except ImportError:
-            assert not self.lonepycfiles, "should have found 'lone.pyc'"
+            assert not self.usepycfiles
         else:
-            assert self.lonepycfiles, "should not have found 'lone.pyc'"
             assert lone.__cached__.endswith('.pyc')
 
 class AppTestNoLonePycFile(AppTestNoPycFile):
     spaceconfig = {
         "objspace.usepycfiles": True,
-        "objspace.lonepycfiles": False
-    }
-
-class AppTestLonePycFile(AppTestNoPycFile):
-    spaceconfig = {
-        "objspace.usepycfiles": True,
-        "objspace.lonepycfiles": True
     }
 
 
diff --git a/pypy/translator/goal/targetpypystandalone.py 
b/pypy/translator/goal/targetpypystandalone.py
--- a/pypy/translator/goal/targetpypystandalone.py
+++ b/pypy/translator/goal/targetpypystandalone.py
@@ -194,7 +194,6 @@
         #    config.translation.backend == "cli"
 
         if config.translation.sandbox:
-            config.objspace.lonepycfiles = False
             config.objspace.usepycfiles = False
 
         config.translating = True
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to