1. Bobby Impollonia
  2. pypy

Commits

Armin Rigo  committed 5a68578

os.makedev(), translation.

  • Participants
  • Parent commits 6354cd3
  • Branches default

Comments (0)

Files changed (2)

File pypy/rpython/module/ll_os.py

View file
  • Ignore whitespace
         return extdef([], (float, float, float),
                       "ll_os.ll_getloadavg", llimpl=getloadavg_llimpl)
 
+    @registering_if(os, 'makedev')
+    def register_os_makedev(self):
+        c_makedev = self.llexternal('makedev', [rffi.INT, rffi.INT], rffi.INT)
+        def makedev_llimpl(maj, min):
+            return c_makedev(maj, min)
+        return extdef([int, int], int,
+                      "ll_os.ll_makedev", llimpl=makedev_llimpl)
+
     @registering_if(os, 'major')
     def register_os_major(self):
         c_major = self.llexternal('major', [rffi.INT], rffi.INT)
         return extdef([int], int,
                       "ll_os.ll_major", llimpl=major_llimpl)
 
+
     @registering_if(os, 'minor')
     def register_os_minor(self):
         c_minor = self.llexternal('minor', [rffi.INT], rffi.INT)

File pypy/translator/c/test/test_extfunc.py

View file
  • Ignore whitespace
         def does_stuff(n):
             a = os.major(n)
             b = os.minor(n)
-            return '%d,%d' % (a, b)
+            x = os.makedev(a, b)
+            return '%d,%d,%d' % (a, b, x)
         f = compile(does_stuff, [int])
         res = f(12345)
-        assert res == '%d,%d' % (os.major(12345), os.minor(12345))
+        assert res == '%d,%d,12345' % (os.major(12345), os.minor(12345))
 
 if hasattr(os, 'fchdir'):
     def test_os_fchdir():