Commits

Philip Jenvey committed eeddf44

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

  • Participants
  • Parent commits 85478a2
  • Branches py3k

Comments (0)

Files changed (5)

File pypy/config/pypyoption.py

     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",

File pypy/doc/config/objspace.lonepycfiles.txt

-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.

File pypy/module/imp/importing.py

         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

File pypy/module/imp/test/test_import.py

 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):
         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
     }
 
 

File pypy/translator/goal/targetpypystandalone.py

         #    config.translation.backend == "cli"
 
         if config.translation.sandbox:
-            config.objspace.lonepycfiles = False
             config.objspace.usepycfiles = False
 
         config.translating = True