holger krekel committed f8afd5a

drop py.path.local.__new__ in favour of a simpler __init__

Comments (0)

Files changed (5)

 Changes between 1.4.12 and
+- drop py.path.local.__new__ in favour of a simpler __init__
 - iniconfig: allow "name:value" settings in config files, no space after
   "name" required
 (c) Holger Krekel and others, 2004-2010
-__version__ = '1.4.13.dev2'
+__version__ = '1.4.13.dev3'
 from py import _apipkg


             st = self.path.lstat()
             return stat.S_ISLNK(st.mode)
-    def __new__(cls, path=None):
+    def __init__(self, path=None):
         """ Initialize and return a local Path instance.
         Path can be relative to the current directory.
         Note also that passing in a local path object will simply return
         the exact same path object. Use new() to get a new copy.
-        if isinstance(path, common.PathBase):
-            if path.__class__ == cls:
-                return path
-            path = path.strpath
-        # initialize the path
-        self = object.__new__(cls)
-        if not path:
+        if path is None:
             self.strpath = os.getcwd()
+        elif isinstance(path, common.PathBase):
+            self.strpath = path.strpath
         elif isinstance(path, py.builtin._basestring):
             self.strpath = os.path.abspath(os.path.normpath(str(path)))
             raise ValueError("can only pass None, Path instances "
                              "or non-empty strings to LocalPath")
         assert isinstance(self.strpath, str)
-        return self
     def __hash__(self):
         return hash(self.strpath)
         description='library with cross-python path, ini-parsing, io, code, log facilities',
         long_description = open('README.txt').read(),
-        version='1.4.13.dev2',
+        version='1.4.13.dev3',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],


     def test_init_from_path(self, tmpdir):
         l = local()
         l2 = local(l)
-        assert l2 is l
+        assert l2 == l
         wc = py.path.svnwc('.')
         l3 = local(wc)