Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8982cf54
Commit
8982cf54
authored
Feb 21, 2008
by
Thomas Heller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace 'has_key()' with 'in'.
Replace 'raise Error, stuff' with 'raise Error(stuff)'.
parent
981f3186
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
13 deletions
+11
-13
Lib/ctypes/__init__.py
Lib/ctypes/__init__.py
+7
-9
Lib/ctypes/macholib/dyld.py
Lib/ctypes/macholib/dyld.py
+1
-1
Lib/ctypes/test/test_cfuncs.py
Lib/ctypes/test/test_cfuncs.py
+1
-1
Lib/ctypes/test/test_macholib.py
Lib/ctypes/test/test_macholib.py
+1
-1
Lib/ctypes/test/test_random_things.py
Lib/ctypes/test/test_random_things.py
+1
-1
No files found.
Lib/ctypes/__init__.py
View file @
8982cf54
...
...
@@ -17,7 +17,7 @@ from _ctypes import ArgumentError
from
struct
import
calcsize
as
_calcsize
if
__version__
!=
_ctypes_version
:
raise
Exception
,
(
"Version number mismatch"
,
__version__
,
_ctypes_version
)
raise
Exception
(
"Version number mismatch"
,
__version__
,
_ctypes_version
)
if
_os
.
name
in
(
"nt"
,
"ce"
):
from
_ctypes
import
FormatError
...
...
@@ -63,7 +63,7 @@ def create_string_buffer(init, size=None):
buftype
=
c_char
*
init
buf
=
buftype
()
return
buf
raise
TypeError
,
init
raise
TypeError
(
init
)
def
c_buffer
(
init
,
size
=
None
):
## "deprecated, use create_string_buffer instead"
...
...
@@ -298,18 +298,16 @@ else:
buftype
=
c_wchar
*
init
buf
=
buftype
()
return
buf
raise
TypeError
,
init
raise
TypeError
(
init
)
POINTER
(
c_char
).
from_param
=
c_char_p
.
from_param
#_SimpleCData.c_char_p_from_param
# XXX Deprecated
def
SetPointerType
(
pointer
,
cls
):
if
_pointer_type_cache
.
get
(
cls
,
None
)
is
not
None
:
raise
RuntimeError
,
\
"This type already exists in the cache"
if
not
_pointer_type_cache
.
has_key
(
id
(
pointer
)):
raise
RuntimeError
,
\
"What's this???"
raise
RuntimeError
(
"This type already exists in the cache"
)
if
id
(
pointer
)
not
in
_pointer_type_cache
:
raise
RuntimeError
(
"What's this???"
)
pointer
.
set_type
(
cls
)
_pointer_type_cache
[
cls
]
=
pointer
del
_pointer_type_cache
[
id
(
pointer
)]
...
...
@@ -358,7 +356,7 @@ class CDLL(object):
def
__getattr__
(
self
,
name
):
if
name
.
startswith
(
'__'
)
and
name
.
endswith
(
'__'
):
raise
AttributeError
,
name
raise
AttributeError
(
name
)
func
=
self
.
__getitem__
(
name
)
setattr
(
self
,
name
,
func
)
return
func
...
...
Lib/ctypes/macholib/dyld.py
View file @
8982cf54
...
...
@@ -135,7 +135,7 @@ def dyld_find(name, executable_path=None, env=None):
),
env
):
if
os
.
path
.
isfile
(
path
):
return
path
raise
ValueError
,
"dylib %s could not be found"
%
(
name
,
)
raise
ValueError
(
"dylib %s could not be found"
%
(
name
,)
)
def
framework_find
(
fn
,
executable_path
=
None
,
env
=
None
):
"""
...
...
Lib/ctypes/test/test_cfuncs.py
View file @
8982cf54
...
...
@@ -198,7 +198,7 @@ else:
class
stdcall_dll
(
WinDLL
):
def
__getattr__
(
self
,
name
):
if
name
[:
2
]
==
'__'
and
name
[
-
2
:]
==
'__'
:
raise
AttributeError
,
name
raise
AttributeError
(
name
)
func
=
self
.
_FuncPtr
((
"s_"
+
name
,
self
))
setattr
(
self
,
name
,
func
)
return
func
...
...
Lib/ctypes/test/test_macholib.py
View file @
8982cf54
...
...
@@ -42,7 +42,7 @@ def find_lib(name):
return
os
.
path
.
realpath
(
dyld_find
(
dylib
))
except
ValueError
:
pass
raise
ValueError
,
"%s not found"
%
(
name
,
)
raise
ValueError
(
"%s not found"
%
(
name
,)
)
class
MachOTest
(
unittest
.
TestCase
):
if
sys
.
platform
==
"darwin"
:
...
...
Lib/ctypes/test/test_random_things.py
View file @
8982cf54
...
...
@@ -3,7 +3,7 @@ import unittest, sys
def
callback_func
(
arg
):
42
/
arg
raise
ValueError
,
arg
raise
ValueError
(
arg
)
if
sys
.
platform
==
"win32"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment