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
0f70a1e7
Commit
0f70a1e7
authored
Jul 15, 2004
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make CF module PEP253 based (finally).
parent
a6675ddc
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
669 additions
and
110 deletions
+669
-110
Mac/Modules/cf/_CFmodule.c
Mac/Modules/cf/_CFmodule.c
+631
-100
Mac/Modules/cf/cfsupport.py
Mac/Modules/cf/cfsupport.py
+38
-10
No files found.
Mac/Modules/cf/_CFmodule.c
View file @
0f70a1e7
This diff is collapsed.
Click to expand it.
Mac/Modules/cf/cfsupport.py
View file @
0f70a1e7
...
...
@@ -250,7 +250,7 @@ OptionalCFURLRef = OpaqueByValueType("CFURLRef", "OptionalCFURLRefObj")
# Our (opaque) objects
class
MyGlobalObjectDefinition
(
GlobalObjectDefinition
):
class
MyGlobalObjectDefinition
(
PEP253Mixin
,
GlobalObjectDefinition
):
def
outputCheckNewArg
(
self
):
Output
(
'if (itself == NULL)'
)
OutLbrace
()
...
...
@@ -302,11 +302,39 @@ class MyGlobalObjectDefinition(GlobalObjectDefinition):
Output
(
"return PyString_FromString(buf);"
)
OutRbrace
()
def
output_tp_newBody
(
self
):
Output
(
"PyObject *self;"
)
Output
Output
(
"if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;"
)
Output
(
"((%s *)self)->ob_itself = NULL;"
,
self
.
objecttype
)
Output
(
"((%s *)self)->ob_freeit = CFRelease;"
,
self
.
objecttype
)
Output
(
"return self;"
)
def
output_tp_initBody
(
self
):
Output
(
"%s itself;"
,
self
.
itselftype
)
Output
(
"char *kw[] = {
\
"
itself
\
"
, 0};"
)
Output
()
Output
(
"if (PyArg_ParseTupleAndKeywords(args, kwds,
\
"
O&
\
"
, kw, %s_Convert, &itself))"
,
self
.
prefix
)
OutLbrace
()
Output
(
"((%s *)self)->ob_itself = itself;"
,
self
.
objecttype
)
Output
(
"return 0;"
)
OutRbrace
()
if
self
.
prefix
!=
'CFTypeRefObj'
:
Output
()
Output
(
"/* Any CFTypeRef descendent is allowed as initializer too */"
)
Output
(
"if (PyArg_ParseTupleAndKeywords(args, kwds,
\
"
O&
\
"
, kw, CFTypeRefObj_Convert, &itself))"
)
OutLbrace
()
Output
(
"((%s *)self)->ob_itself = itself;"
,
self
.
objecttype
)
Output
(
"return 0;"
)
OutRbrace
()
Output
(
"return -1;"
)
class
CFTypeRefObjectDefinition
(
MyGlobalObjectDefinition
):
pass
class
CFArrayRefObjectDefinition
(
MyGlobalObjectDefinition
):
base
chain
=
"&CFTypeRefObj_chain
"
base
type
=
"CFTypeRef_Type
"
def
outputRepr
(
self
):
Output
()
...
...
@@ -318,7 +346,7 @@ class CFArrayRefObjectDefinition(MyGlobalObjectDefinition):
OutRbrace
()
class
CFMutableArrayRefObjectDefinition
(
MyGlobalObjectDefinition
):
base
chain
=
"&CFArrayRefObj_chain
"
base
type
=
"CFArrayRef_Type
"
def
outputRepr
(
self
):
Output
()
...
...
@@ -330,7 +358,7 @@ class CFMutableArrayRefObjectDefinition(MyGlobalObjectDefinition):
OutRbrace
()
class
CFDictionaryRefObjectDefinition
(
MyGlobalObjectDefinition
):
base
chain
=
"&CFTypeRefObj_chain
"
base
type
=
"CFTypeRef_Type
"
def
outputRepr
(
self
):
Output
()
...
...
@@ -342,7 +370,7 @@ class CFDictionaryRefObjectDefinition(MyGlobalObjectDefinition):
OutRbrace
()
class
CFMutableDictionaryRefObjectDefinition
(
MyGlobalObjectDefinition
):
base
chain
=
"&CFDictionaryRefObj_chain
"
base
type
=
"CFDictionaryRef_Type
"
def
outputRepr
(
self
):
Output
()
...
...
@@ -354,7 +382,7 @@ class CFMutableDictionaryRefObjectDefinition(MyGlobalObjectDefinition):
OutRbrace
()
class
CFDataRefObjectDefinition
(
MyGlobalObjectDefinition
):
base
chain
=
"&CFTypeRefObj_chain
"
base
type
=
"CFTypeRef_Type
"
def
outputCheckConvertArg
(
self
):
Out
(
"""
...
...
@@ -378,7 +406,7 @@ class CFDataRefObjectDefinition(MyGlobalObjectDefinition):
OutRbrace
()
class
CFMutableDataRefObjectDefinition
(
MyGlobalObjectDefinition
):
base
chain
=
"&CFDataRefObj_chain
"
base
type
=
"CFDataRef_Type
"
def
outputRepr
(
self
):
Output
()
...
...
@@ -390,7 +418,7 @@ class CFMutableDataRefObjectDefinition(MyGlobalObjectDefinition):
OutRbrace
()
class
CFStringRefObjectDefinition
(
MyGlobalObjectDefinition
):
base
chain
=
"&CFTypeRefObj_chain
"
base
type
=
"CFTypeRef_Type
"
def
outputCheckConvertArg
(
self
):
Out
(
"""
...
...
@@ -423,7 +451,7 @@ class CFStringRefObjectDefinition(MyGlobalObjectDefinition):
OutRbrace
()
class
CFMutableStringRefObjectDefinition
(
CFStringRefObjectDefinition
):
base
chain
=
"&CFStringRefObj_chain
"
base
type
=
"CFStringRef_Type
"
def
outputCheckConvertArg
(
self
):
# Mutable, don't allow Python strings
...
...
@@ -439,7 +467,7 @@ class CFMutableStringRefObjectDefinition(CFStringRefObjectDefinition):
OutRbrace
()
class
CFURLRefObjectDefinition
(
MyGlobalObjectDefinition
):
base
chain
=
"&CFTypeRefObj_chain
"
base
type
=
"CFTypeRef_Type
"
def
outputRepr
(
self
):
Output
()
...
...
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