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
d505cab5
Commit
d505cab5
authored
Mar 03, 2003
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept only the system default encoding when converting Python
strings to CF strings. Fixes 682215.
parent
f0089986
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
Mac/Modules/cf/_CFmodule.c
Mac/Modules/cf/_CFmodule.c
+4
-4
Mac/Modules/cf/cfsupport.py
Mac/Modules/cf/cfsupport.py
+4
-2
Mac/Modules/cf/pycfbridge.c
Mac/Modules/cf/pycfbridge.c
+3
-2
No files found.
Mac/Modules/cf/_CFmodule.c
View file @
d505cab5
...
...
@@ -14,9 +14,9 @@
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
PyErr_SetString(PyExc_NotImplementedError, \
"Not available in this shared library/OS version"); \
return NULL; \
PyErr_SetString(PyExc_NotImplementedError, \
"Not available in this shared library/OS version"); \
return NULL; \
}} while(0)
...
...
@@ -1458,7 +1458,7 @@ int CFStringRefObj_Convert(PyObject *v, CFStringRef *p_itself)
if
(
v
==
Py_None
)
{
*
p_itself
=
NULL
;
return
1
;
}
if
(
PyString_Check
(
v
))
{
char
*
cStr
=
PyString_AsString
(
v
);
*
p_itself
=
CFStringCreateWithCString
((
CFAllocatorRef
)
NULL
,
cStr
,
0
);
*
p_itself
=
CFStringCreateWithCString
((
CFAllocatorRef
)
NULL
,
cStr
,
kCFStringEncodingASCII
);
return
1
;
}
if
(
PyUnicode_Check
(
v
))
{
...
...
Mac/Modules/cf/cfsupport.py
View file @
d505cab5
...
...
@@ -359,8 +359,10 @@ class CFStringRefObjectDefinition(MyGlobalObjectDefinition):
Out
(
"""
if (v == Py_None) { *p_itself = NULL; return 1; }
if (PyString_Check(v)) {
char *cStr = PyString_AsString(v);
*p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, 0);
char *cStr;
if (!PyArg_Parse(v, "et", "ascii", &cStr))
return NULL;
*p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
return 1;
}
if (PyUnicode_Check(v)) {
...
...
Mac/Modules/cf/pycfbridge.c
View file @
d505cab5
...
...
@@ -292,8 +292,9 @@ PyCF_Python2CF_string(PyObject *src, CFStringRef *dst) {
UniChar
*
unichars
;
if
(
PyString_Check
(
src
))
{
if
((
chars
=
PyString_AsString
(
src
))
==
NULL
)
goto
err
;
*
dst
=
CFStringCreateWithCString
((
CFAllocatorRef
)
NULL
,
chars
,
0
);
if
(
!
PyArg_Parse
(
src
,
"es"
,
NULL
,
&
chars
))
return
NULL
;
/* This error is more descriptive than the general one below */
*
dst
=
CFStringCreateWithCString
((
CFAllocatorRef
)
NULL
,
chars
,
kCFStringEncodingASCII
);
return
1
;
}
if
(
PyUnicode_Check
(
src
))
{
...
...
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