]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Some minute changes.
authorGuido van Rossum <guido@python.org>
Wed, 29 Dec 1993 15:33:08 +0000 (15:33 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 29 Dec 1993 15:33:08 +0000 (15:33 +0000)
Lib/Queue.py
Lib/calendar.py
Lib/os.py
Lib/test/test_grammar.py

index 0d69777b447e0434feb4a6faae4544cd0bc86f3d..5125fd5dd2c0b262d708d53b3027b228c5628313 100644 (file)
@@ -7,6 +7,7 @@ class Queue:
        # Initialize a queue object with a given maximum size
        # (If maxsize is <= 0, the maximum size is infinite)
        def __init__(self, maxsize):
+               import thread
                self._init(maxsize)
                self.mutex = thread.allocate_lock()
                self.esema = thread.allocate_lock()
index b4e3aaddbfa7a2a368cac4b9178df7750613aae9..4dfcf0c8f5d1a205f5997b9a51b134cde7c5db97 100644 (file)
@@ -6,7 +6,6 @@
 
 # Import functions and variables from time module
 from time import gmtime, localtime, mktime, asctime, ctime
-from time import timezone, altzone, daylight, tzname
 
 # Exception raised for bad input (with string parameter for details)
 error = 'calendar.error'
index 7322fa56f93f5221580a42f176285cbbcb215c1f..bb90f2eed59fe0609e1d634392f773f3496f166f 100644 (file)
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -1,4 +1,4 @@
-# os.py -- either mac or posix depending on what system we're on.
+# os.py -- either mac, dos or posix depending on what system we're on.
 
 # This exports:
 # - all functions from either posix or mac, e.g., os.unlink, os.stat, etc.
@@ -14,7 +14,7 @@
 # and opendir), and leave all pathname manipulation to os.path
 # (e.g., split and join).
 
-# XXX This will need to distinguish between real posix and MS-DOS emulation
+# XXX This is incorrect if the import *path fails...
 
 try:
        from posix import *
@@ -30,14 +30,24 @@ try:
        path = posixpath
        del posixpath
 except ImportError:
-       from mac import *
-       name = 'mac'
-       curdir = ':'
-       pardir = '::'
-       sep = ':'
-       import macpath
-       path = macpath
-       del macpath
+       try:
+               from mac import *
+               name = 'mac'
+               curdir = ':'
+               pardir = '::'
+               sep = ':'
+               import macpath
+               path = macpath
+               del macpath
+       except ImportError:
+               from dos import *
+               name = 'dos'
+               curdir = '.'            # XXX doesn't always work
+               pardir = '..'           # XXX doesn't always work
+               sep = '/'               # XXX or '\\' ???
+               import dospath
+               path = dospath
+               del dospath
 
 def execl(file, *args):
        execv(file, args)
index 742477f9b4c01171b8f0c51738eba35255a3580d..0988574029b2c42c952aea1c5d807a42577d9ad3 100644 (file)
@@ -23,9 +23,12 @@ print '1.1.2 Numeric literals'
 print '1.1.2.1 Plain integers'
 if 0xff <> 255: raise TestFailed, 'hex int'
 if 0377 <> 255: raise TestFailed, 'octal int'
-if  2147483647   != 017777777777: raise TestFailed, 'max positive int'
-# Change the following line to "if 0:" if you have 64-bit integers
-if 1:
+if  2147483647   != 017777777777: raise TestFailed, 'large positive int'
+try:
+       from sys import maxint
+except ImportError:
+       maxint = 2147483647
+if maxint == 2147483647:
        if -2147483647-1 != 020000000000: raise TestFailed, 'max negative int'
        # XXX -2147483648
        if 037777777777 != -1: raise TestFailed, 'oct -1'
@@ -37,6 +40,21 @@ if 1:
                        continue
                raise TestFailed, \
                          'No OverflowError on huge integer literal ' + `s`
+elif eval('maxint == 9223372036854775807'):
+       if eval('9223372036854775807-1 != -01000000000000000000000'):
+               raise TestFailed, 'max negative int'
+       if eval('01777777777777777777777') != -1: raise TestFailed, 'oct -1'
+       if eval('0xffffffffffffffff') != -1: raise TestFailed, 'hex -1'
+       for s in '9223372036854775808', '02000000000000000000000', \
+                '0x10000000000000000':
+               try:
+                       x = eval(s)
+               except OverflowError:
+                       continue
+               raise TestFailed, \
+                         'No OverflowError on huge integer literal ' + `s`
+else:
+       print 'Weird maxint value', maxint
 
 print '1.1.2.2 Long integers'
 x = 0L