Linux server1.dn-server.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
LiteSpeed
Server IP : 195.201.204.189 & Your IP : 216.73.216.198
Domains :
Cant Read [ /etc/named.conf ]
User : beriska1
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib64 /
python2.7 /
ctypes /
test /
Delete
Unzip
Name
Size
Permission
Date
Action
__init__.py
7.16
KB
-rw-r--r--
2024-04-10 08:28
__init__.pyc
7.85
KB
-rw-r--r--
2024-04-10 08:28
__init__.pyo
7.85
KB
-rw-r--r--
2024-04-10 08:28
runtests.py
682
B
-rw-r--r--
2024-04-10 08:28
runtests.pyc
895
B
-rw-r--r--
2024-04-10 08:28
runtests.pyo
895
B
-rw-r--r--
2024-04-10 08:28
test_anon.py
2.49
KB
-rw-r--r--
2024-04-10 08:28
test_anon.pyc
3.55
KB
-rw-r--r--
2024-04-10 08:28
test_anon.pyo
3.55
KB
-rw-r--r--
2024-04-10 08:28
test_array_in_pointer.py
1.69
KB
-rw-r--r--
2024-04-10 08:28
test_array_in_pointer.pyc
2.21
KB
-rw-r--r--
2024-04-10 08:28
test_array_in_pointer.pyo
2.21
KB
-rw-r--r--
2024-04-10 08:28
test_arrays.py
5.19
KB
-rw-r--r--
2024-04-10 08:28
test_arrays.pyc
5.88
KB
-rw-r--r--
2024-04-10 08:28
test_arrays.pyo
5.88
KB
-rw-r--r--
2024-04-10 08:28
test_as_parameter.py
6.62
KB
-rw-r--r--
2024-04-10 08:28
test_as_parameter.pyc
8.73
KB
-rw-r--r--
2024-04-10 08:28
test_as_parameter.pyo
8.73
KB
-rw-r--r--
2024-04-10 08:28
test_bitfields.py
9.85
KB
-rw-r--r--
2024-04-10 08:28
test_bitfields.pyc
13.87
KB
-rw-r--r--
2024-04-10 08:28
test_bitfields.pyo
13.87
KB
-rw-r--r--
2024-04-10 08:28
test_buffers.py
2.56
KB
-rw-r--r--
2024-04-10 08:28
test_buffers.pyc
3.24
KB
-rw-r--r--
2024-04-10 08:28
test_buffers.pyo
3.24
KB
-rw-r--r--
2024-04-10 08:28
test_byteswap.py
10.57
KB
-rw-r--r--
2024-04-10 08:28
test_byteswap.pyc
9.56
KB
-rw-r--r--
2024-04-10 08:28
test_byteswap.pyo
9.56
KB
-rw-r--r--
2024-04-10 08:28
test_callbacks.py
9.65
KB
-rw-r--r--
2024-04-10 08:28
test_callbacks.pyc
12.6
KB
-rw-r--r--
2024-04-10 08:28
test_callbacks.pyo
12.6
KB
-rw-r--r--
2024-04-10 08:28
test_cast.py
3.1
KB
-rw-r--r--
2024-04-10 08:28
test_cast.pyc
3.58
KB
-rw-r--r--
2024-04-10 08:28
test_cast.pyo
3.58
KB
-rw-r--r--
2024-04-10 08:28
test_cfuncs.py
7.5
KB
-rw-r--r--
2024-04-10 08:28
test_cfuncs.pyc
10.67
KB
-rw-r--r--
2024-04-10 08:28
test_cfuncs.pyo
10.67
KB
-rw-r--r--
2024-04-10 08:28
test_checkretval.py
973
B
-rw-r--r--
2024-04-10 08:28
test_checkretval.pyc
1.66
KB
-rw-r--r--
2024-04-10 08:28
test_checkretval.pyo
1.66
KB
-rw-r--r--
2024-04-10 08:28
test_delattr.py
533
B
-rw-r--r--
2024-04-10 08:28
test_delattr.pyc
1.33
KB
-rw-r--r--
2024-04-10 08:28
test_delattr.pyo
1.33
KB
-rw-r--r--
2024-04-10 08:28
test_errno.py
2.28
KB
-rw-r--r--
2024-04-10 08:28
test_errno.pyc
2.84
KB
-rw-r--r--
2024-04-10 08:28
test_errno.pyo
2.84
KB
-rw-r--r--
2024-04-10 08:28
test_find.py
2.07
KB
-rw-r--r--
2024-04-10 08:28
test_find.pyc
2.79
KB
-rw-r--r--
2024-04-10 08:28
test_find.pyo
2.79
KB
-rw-r--r--
2024-04-10 08:28
test_frombuffer.py
3.35
KB
-rw-r--r--
2024-04-10 08:28
test_frombuffer.pyc
4.17
KB
-rw-r--r--
2024-04-10 08:28
test_frombuffer.pyo
4.17
KB
-rw-r--r--
2024-04-10 08:28
test_funcptr.py
3.94
KB
-rw-r--r--
2024-04-10 08:28
test_funcptr.pyc
4.27
KB
-rw-r--r--
2024-04-10 08:28
test_funcptr.pyo
4.27
KB
-rw-r--r--
2024-04-10 08:28
test_functions.py
12.27
KB
-rw-r--r--
2024-04-10 08:28
test_functions.pyc
14.72
KB
-rw-r--r--
2024-04-10 08:28
test_functions.pyo
14.72
KB
-rw-r--r--
2024-04-10 08:28
test_incomplete.py
1019
B
-rw-r--r--
2024-04-10 08:28
test_incomplete.pyc
1.33
KB
-rw-r--r--
2024-04-10 08:28
test_incomplete.pyo
1.33
KB
-rw-r--r--
2024-04-10 08:28
test_init.py
1.02
KB
-rw-r--r--
2024-04-10 08:28
test_init.pyc
1.79
KB
-rw-r--r--
2024-04-10 08:28
test_init.pyo
1.79
KB
-rw-r--r--
2024-04-10 08:28
test_internals.py
2.56
KB
-rw-r--r--
2024-04-10 08:28
test_internals.pyc
4.03
KB
-rw-r--r--
2024-04-10 08:28
test_internals.pyo
4.03
KB
-rw-r--r--
2024-04-10 08:28
test_keeprefs.py
3.95
KB
-rw-r--r--
2024-04-10 08:28
test_keeprefs.pyc
6.57
KB
-rw-r--r--
2024-04-10 08:28
test_keeprefs.pyo
6.57
KB
-rw-r--r--
2024-04-10 08:28
test_libc.py
881
B
-rw-r--r--
2024-04-10 08:28
test_libc.pyc
1.6
KB
-rw-r--r--
2024-04-10 08:28
test_libc.pyo
1.6
KB
-rw-r--r--
2024-04-10 08:28
test_loading.py
4.56
KB
-rw-r--r--
2024-04-10 08:28
test_loading.pyc
4.46
KB
-rw-r--r--
2024-04-10 08:28
test_loading.pyo
4.46
KB
-rw-r--r--
2024-04-10 08:28
test_macholib.py
1.76
KB
-rw-r--r--
2024-04-10 08:28
test_macholib.pyc
1.46
KB
-rw-r--r--
2024-04-10 08:28
test_macholib.pyo
1.46
KB
-rw-r--r--
2024-04-10 08:28
test_memfunctions.py
3.15
KB
-rw-r--r--
2024-04-10 08:28
test_memfunctions.pyc
3.68
KB
-rw-r--r--
2024-04-10 08:28
test_memfunctions.pyo
3.68
KB
-rw-r--r--
2024-04-10 08:28
test_numbers.py
9.05
KB
-rw-r--r--
2024-04-10 08:28
test_numbers.pyc
10.27
KB
-rw-r--r--
2024-04-10 08:28
test_numbers.pyo
10.27
KB
-rw-r--r--
2024-04-10 08:28
test_objects.py
1.63
KB
-rw-r--r--
2024-04-10 08:28
test_objects.pyc
2.15
KB
-rw-r--r--
2024-04-10 08:28
test_objects.pyo
2.15
KB
-rw-r--r--
2024-04-10 08:28
test_parameters.py
9.7
KB
-rw-r--r--
2024-04-10 08:28
test_parameters.pyc
11.38
KB
-rw-r--r--
2024-04-10 08:28
test_parameters.pyo
11.38
KB
-rw-r--r--
2024-04-10 08:28
test_pep3118.py
8.29
KB
-rw-r--r--
2024-04-10 08:28
test_pep3118.pyc
6.64
KB
-rw-r--r--
2024-04-10 08:28
test_pep3118.pyo
6.64
KB
-rw-r--r--
2024-04-10 08:28
test_pickling.py
2.17
KB
-rw-r--r--
2024-04-10 08:28
test_pickling.pyc
3.65
KB
-rw-r--r--
2024-04-10 08:28
test_pickling.pyo
3.65
KB
-rw-r--r--
2024-04-10 08:28
test_pointers.py
6.97
KB
-rw-r--r--
2024-04-10 08:28
test_pointers.pyc
7.49
KB
-rw-r--r--
2024-04-10 08:28
test_pointers.pyo
7.45
KB
-rw-r--r--
2024-04-10 08:28
test_prototypes.py
6.54
KB
-rw-r--r--
2024-04-10 08:28
test_prototypes.pyc
7.05
KB
-rw-r--r--
2024-04-10 08:28
test_prototypes.pyo
7.02
KB
-rw-r--r--
2024-04-10 08:28
test_python_api.py
2.89
KB
-rw-r--r--
2024-04-10 08:28
test_python_api.pyc
3.23
KB
-rw-r--r--
2024-04-10 08:28
test_python_api.pyo
3.23
KB
-rw-r--r--
2024-04-10 08:28
test_random_things.py
2.77
KB
-rw-r--r--
2024-04-10 08:28
test_random_things.pyc
3.21
KB
-rw-r--r--
2024-04-10 08:28
test_random_things.pyo
3.21
KB
-rw-r--r--
2024-04-10 08:28
test_refcounts.py
2.44
KB
-rw-r--r--
2024-04-10 08:28
test_refcounts.pyc
3.05
KB
-rw-r--r--
2024-04-10 08:28
test_refcounts.pyo
3.05
KB
-rw-r--r--
2024-04-10 08:28
test_repr.py
839
B
-rw-r--r--
2024-04-10 08:28
test_repr.pyc
1.71
KB
-rw-r--r--
2024-04-10 08:28
test_repr.pyo
1.71
KB
-rw-r--r--
2024-04-10 08:28
test_returnfuncptrs.py
2.71
KB
-rw-r--r--
2024-04-10 08:28
test_returnfuncptrs.pyc
2.82
KB
-rw-r--r--
2024-04-10 08:28
test_returnfuncptrs.pyo
2.82
KB
-rw-r--r--
2024-04-10 08:28
test_simplesubclasses.py
1.32
KB
-rw-r--r--
2024-04-10 08:28
test_simplesubclasses.pyc
2.83
KB
-rw-r--r--
2024-04-10 08:28
test_simplesubclasses.pyo
2.83
KB
-rw-r--r--
2024-04-10 08:28
test_sizes.py
815
B
-rw-r--r--
2024-04-10 08:28
test_sizes.pyc
1.82
KB
-rw-r--r--
2024-04-10 08:28
test_sizes.pyo
1.82
KB
-rw-r--r--
2024-04-10 08:28
test_slicing.py
6.3
KB
-rw-r--r--
2024-04-10 08:28
test_slicing.pyc
6.36
KB
-rw-r--r--
2024-04-10 08:28
test_slicing.pyo
6.36
KB
-rw-r--r--
2024-04-10 08:28
test_stringptr.py
2.4
KB
-rw-r--r--
2024-04-10 08:28
test_stringptr.pyc
2.62
KB
-rw-r--r--
2024-04-10 08:28
test_stringptr.pyo
2.62
KB
-rw-r--r--
2024-04-10 08:28
test_strings.py
7.18
KB
-rw-r--r--
2024-04-10 08:28
test_strings.pyc
7.63
KB
-rw-r--r--
2024-04-10 08:28
test_strings.pyo
7.63
KB
-rw-r--r--
2024-04-10 08:28
test_struct_fields.py
2.36
KB
-rw-r--r--
2024-04-10 08:28
test_struct_fields.pyc
4.28
KB
-rw-r--r--
2024-04-10 08:28
test_struct_fields.pyo
4.28
KB
-rw-r--r--
2024-04-10 08:28
test_structures.py
16.52
KB
-rw-r--r--
2024-04-10 08:28
test_structures.pyc
23.23
KB
-rw-r--r--
2024-04-10 08:28
test_structures.pyo
23.23
KB
-rw-r--r--
2024-04-10 08:28
test_unaligned_structures.py
1.19
KB
-rw-r--r--
2024-04-10 08:28
test_unaligned_structures.pyc
2.03
KB
-rw-r--r--
2024-04-10 08:28
test_unaligned_structures.pyo
2.03
KB
-rw-r--r--
2024-04-10 08:28
test_unicode.py
5
KB
-rw-r--r--
2024-04-10 08:28
test_unicode.pyc
6.04
KB
-rw-r--r--
2024-04-10 08:28
test_unicode.pyo
6.04
KB
-rw-r--r--
2024-04-10 08:28
test_values.py
2.86
KB
-rw-r--r--
2024-04-10 08:28
test_values.pyc
2.89
KB
-rw-r--r--
2024-04-10 08:28
test_values.pyo
2.95
KB
-rw-r--r--
2024-04-10 08:28
test_varsize_struct.py
1.8
KB
-rw-r--r--
2024-04-10 08:28
test_varsize_struct.pyc
2.36
KB
-rw-r--r--
2024-04-10 08:28
test_varsize_struct.pyo
2.36
KB
-rw-r--r--
2024-04-10 08:28
test_win32.py
5.02
KB
-rw-r--r--
2024-04-10 08:28
test_win32.pyc
6.06
KB
-rw-r--r--
2024-04-10 08:28
test_win32.pyo
6.06
KB
-rw-r--r--
2024-04-10 08:28
test_wintypes.py
1.43
KB
-rw-r--r--
2024-04-10 08:28
test_wintypes.pyc
1.6
KB
-rw-r--r--
2024-04-10 08:28
test_wintypes.pyo
1.6
KB
-rw-r--r--
2024-04-10 08:28
Save
Rename
from ctypes import * import unittest import struct def valid_ranges(*types): # given a sequence of numeric types, collect their _type_ # attribute, which is a single format character compatible with # the struct module, use the struct module to calculate the # minimum and maximum value allowed for this format. # Returns a list of (min, max) values. result = [] for t in types: fmt = t._type_ size = struct.calcsize(fmt) a = struct.unpack(fmt, ("\x00"*32)[:size])[0] b = struct.unpack(fmt, ("\xFF"*32)[:size])[0] c = struct.unpack(fmt, ("\x7F"+"\x00"*32)[:size])[0] d = struct.unpack(fmt, ("\x80"+"\xFF"*32)[:size])[0] result.append((min(a, b, c, d), max(a, b, c, d))) return result ArgType = type(byref(c_int(0))) unsigned_types = [c_ubyte, c_ushort, c_uint, c_ulong] signed_types = [c_byte, c_short, c_int, c_long, c_longlong] bool_types = [] float_types = [c_double, c_float] try: c_ulonglong c_longlong except NameError: pass else: unsigned_types.append(c_ulonglong) signed_types.append(c_longlong) try: c_bool except NameError: pass else: bool_types.append(c_bool) unsigned_ranges = valid_ranges(*unsigned_types) signed_ranges = valid_ranges(*signed_types) bool_values = [True, False, 0, 1, -1, 5000, 'test', [], [1]] ################################################################ class NumberTestCase(unittest.TestCase): def test_default_init(self): # default values are set to zero for t in signed_types + unsigned_types + float_types: self.assertEqual(t().value, 0) def test_unsigned_values(self): # the value given to the constructor is available # as the 'value' attribute for t, (l, h) in zip(unsigned_types, unsigned_ranges): self.assertEqual(t(l).value, l) self.assertEqual(t(h).value, h) def test_signed_values(self): # see above for t, (l, h) in zip(signed_types, signed_ranges): self.assertEqual(t(l).value, l) self.assertEqual(t(h).value, h) def test_bool_values(self): from operator import truth for t, v in zip(bool_types, bool_values): self.assertEqual(t(v).value, truth(v)) def test_typeerror(self): # Only numbers are allowed in the constructor, # otherwise TypeError is raised for t in signed_types + unsigned_types + float_types: self.assertRaises(TypeError, t, "") self.assertRaises(TypeError, t, None) @unittest.skip('test disabled') def test_valid_ranges(self): # invalid values of the correct type # raise ValueError (not OverflowError) for t, (l, h) in zip(unsigned_types, unsigned_ranges): self.assertRaises(ValueError, t, l-1) self.assertRaises(ValueError, t, h+1) def test_from_param(self): # the from_param class method attribute always # returns PyCArgObject instances for t in signed_types + unsigned_types + float_types: self.assertEqual(ArgType, type(t.from_param(0))) def test_byref(self): # calling byref returns also a PyCArgObject instance for t in signed_types + unsigned_types + float_types + bool_types: parm = byref(t()) self.assertEqual(ArgType, type(parm)) def test_floats(self): # c_float and c_double can be created from # Python int, long and float class FloatLike(object): def __float__(self): return 2.0 f = FloatLike() for t in float_types: self.assertEqual(t(2.0).value, 2.0) self.assertEqual(t(2).value, 2.0) self.assertEqual(t(2L).value, 2.0) self.assertEqual(t(f).value, 2.0) def test_integers(self): class FloatLike(object): def __float__(self): return 2.0 f = FloatLike() class IntLike(object): def __int__(self): return 2 i = IntLike() # integers cannot be constructed from floats, # but from integer-like objects for t in signed_types + unsigned_types: self.assertRaises(TypeError, t, 3.14) self.assertRaises(TypeError, t, f) self.assertEqual(t(i).value, 2) def test_sizes(self): for t in signed_types + unsigned_types + float_types + bool_types: try: size = struct.calcsize(t._type_) except struct.error: continue # sizeof of the type... self.assertEqual(sizeof(t), size) # and sizeof of an instance self.assertEqual(sizeof(t()), size) def test_alignments(self): for t in signed_types + unsigned_types + float_types: code = t._type_ # the typecode align = struct.calcsize("c%c" % code) - struct.calcsize(code) # alignment of the type... self.assertEqual((code, alignment(t)), (code, align)) # and alignment of an instance self.assertEqual((code, alignment(t())), (code, align)) def test_int_from_address(self): from array import array for t in signed_types + unsigned_types: # the array module doesn't support all format codes # (no 'q' or 'Q') try: array(t._type_) except ValueError: continue a = array(t._type_, [100]) # v now is an integer at an 'external' memory location v = t.from_address(a.buffer_info()[0]) self.assertEqual(v.value, a[0]) self.assertEqual(type(v), t) # changing the value at the memory location changes v's value also a[0] = 42 self.assertEqual(v.value, a[0]) def test_float_from_address(self): from array import array for t in float_types: a = array(t._type_, [3.14]) v = t.from_address(a.buffer_info()[0]) self.assertEqual(v.value, a[0]) self.assertIs(type(v), t) a[0] = 2.3456e17 self.assertEqual(v.value, a[0]) self.assertIs(type(v), t) def test_char_from_address(self): from ctypes import c_char from array import array a = array('c', 'x') v = c_char.from_address(a.buffer_info()[0]) self.assertEqual(v.value, a[0]) self.assertIs(type(v), c_char) a[0] = '?' self.assertEqual(v.value, a[0]) # array does not support c_bool / 't' @unittest.skip('test disabled') def test_bool_from_address(self): from ctypes import c_bool from array import array a = array(c_bool._type_, [True]) v = t.from_address(a.buffer_info()[0]) self.assertEqual(v.value, a[0]) self.assertEqual(type(v) is t) a[0] = False self.assertEqual(v.value, a[0]) self.assertEqual(type(v) is t) def test_init(self): # c_int() can be initialized from Python's int, and c_int. # Not from c_long or so, which seems strange, abc should # probably be changed: self.assertRaises(TypeError, c_int, c_long(42)) def test_float_overflow(self): import sys big_int = int(sys.float_info.max) * 2 for t in float_types + [c_longdouble]: self.assertRaises(OverflowError, t, big_int) if (hasattr(t, "__ctype_be__")): self.assertRaises(OverflowError, t.__ctype_be__, big_int) if (hasattr(t, "__ctype_le__")): self.assertRaises(OverflowError, t.__ctype_le__, big_int) @unittest.skip('test disabled') def test_perf(self): check_perf() from ctypes import _SimpleCData class c_int_S(_SimpleCData): _type_ = "i" __slots__ = [] def run_test(rep, msg, func, arg=None): ## items = [None] * rep items = range(rep) from time import clock if arg is not None: start = clock() for i in items: func(arg); func(arg); func(arg); func(arg); func(arg) stop = clock() else: start = clock() for i in items: func(); func(); func(); func(); func() stop = clock() print "%15s: %.2f us" % (msg, ((stop-start)*1e6/5/rep)) def check_perf(): # Construct 5 objects from ctypes import c_int REP = 200000 run_test(REP, "int()", int) run_test(REP, "int(999)", int) run_test(REP, "c_int()", c_int) run_test(REP, "c_int(999)", c_int) run_test(REP, "c_int_S()", c_int_S) run_test(REP, "c_int_S(999)", c_int_S) # Python 2.3 -OO, win2k, P4 700 MHz: # # int(): 0.87 us # int(999): 0.87 us # c_int(): 3.35 us # c_int(999): 3.34 us # c_int_S(): 3.23 us # c_int_S(999): 3.24 us # Python 2.2 -OO, win2k, P4 700 MHz: # # int(): 0.89 us # int(999): 0.89 us # c_int(): 9.99 us # c_int(999): 10.02 us # c_int_S(): 9.87 us # c_int_S(999): 9.85 us if __name__ == '__main__': ## check_perf() unittest.main()