Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
f7a94e4b
Kaydet (Commit)
f7a94e4b
authored
Tem 27, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF patch# 1761465 by Jeffrey Yasskin.
Fix test_aepack and test_applesingle.
üst
67feb09d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
31 deletions
+39
-31
AppleEvents.py
Lib/plat-mac/Carbon/AppleEvents.py
+1
-1
aepack.py
Lib/plat-mac/aepack.py
+0
-0
aetypes.py
Lib/plat-mac/aetypes.py
+24
-16
test_aepack.py
Lib/test/test_aepack.py
+7
-7
test_applesingle.py
Lib/test/test_applesingle.py
+3
-3
_AEmodule.c
Mac/Modules/ae/_AEmodule.c
+2
-2
mactoolboxglue.c
Python/mactoolboxglue.c
+2
-2
No files found.
Lib/plat-mac/Carbon/AppleEvents.py
Dosyayı görüntüle @
f7a94e4b
# Generated from 'AEDataModel.h'
def
FOUR_CHAR_CODE
(
x
):
return
x
def
FOUR_CHAR_CODE
(
x
):
return
bytes
(
x
)
typeBoolean
=
FOUR_CHAR_CODE
(
'bool'
)
typeChar
=
FOUR_CHAR_CODE
(
'TEXT'
)
typeSInt16
=
FOUR_CHAR_CODE
(
'shor'
)
...
...
Lib/plat-mac/aepack.py
Dosyayı görüntüle @
f7a94e4b
This diff is collapsed.
Click to expand it.
Lib/plat-mac/aetypes.py
Dosyayı görüntüle @
f7a94e4b
...
...
@@ -16,6 +16,14 @@ def nice(s):
if
isinstance
(
s
,
str
):
return
repr
(
s
)
else
:
return
str
(
s
)
def
_four_char_code
(
four_chars
):
"""Convert a str or bytes object into a 4-byte array.
four_chars must contain only ASCII characters.
"""
return
bytes
(
"
%-4.4
s"
%
str
(
four_chars
))
class
Unknown
:
"""An uninterpreted AE object"""
...
...
@@ -33,13 +41,13 @@ class Enum:
"""An AE enumeration value"""
def
__init__
(
self
,
enum
):
self
.
enum
=
"
%-4.4
s"
%
str
(
enum
)
self
.
enum
=
_four_char_code
(
enum
)
def
__repr__
(
self
):
return
"Enum(
%
r)"
%
(
self
.
enum
,)
def
__str__
(
self
):
return
self
.
enum
.
strip
()
return
self
.
enum
.
strip
(
b
' '
)
def
__aepack__
(
self
):
return
pack
(
self
.
enum
,
typeEnumeration
)
...
...
@@ -100,7 +108,7 @@ class Type:
"""An AE 4-char typename object"""
def
__init__
(
self
,
type
):
self
.
type
=
"
%-4.4
s"
%
str
(
type
)
self
.
type
=
_four_char_code
(
type
)
def
__repr__
(
self
):
return
"Type(
%
r)"
%
(
self
.
type
,)
...
...
@@ -123,7 +131,7 @@ class Keyword:
"""An AE 4-char keyword object"""
def
__init__
(
self
,
keyword
):
self
.
keyword
=
"
%-4.4
s"
%
str
(
keyword
)
self
.
keyword
=
_four_char_code
(
keyword
)
def
__repr__
(
self
):
return
"Keyword(
%
r)"
%
self
.
keyword
...
...
@@ -161,7 +169,7 @@ class Comparison:
def
__init__
(
self
,
obj1
,
relo
,
obj2
):
self
.
obj1
=
obj1
self
.
relo
=
"
%-4.4
s"
%
str
(
relo
)
self
.
relo
=
_four_char_code
(
relo
)
self
.
obj2
=
obj2
def
__repr__
(
self
):
...
...
@@ -190,7 +198,7 @@ class Ordinal:
def
__init__
(
self
,
abso
):
# self.obj1 = obj1
self
.
abso
=
"
%-4.4
s"
%
str
(
abso
)
self
.
abso
=
_four_char_code
(
abso
)
def
__repr__
(
self
):
return
"Ordinal(
%
r)"
%
(
self
.
abso
,)
...
...
@@ -214,7 +222,7 @@ class Logical:
"""An AE logical expression object"""
def
__init__
(
self
,
logc
,
term
):
self
.
logc
=
"
%-4.4
s"
%
str
(
logc
)
self
.
logc
=
_four_char_code
(
logc
)
self
.
term
=
term
def
__repr__
(
self
):
...
...
@@ -554,12 +562,12 @@ template = """
class
%
s(ComponentItem): want = '
%
s'
"""
exec
(
template
%
(
"Text"
,
'text'
))
exec
(
template
%
(
"Character"
,
'cha '
))
exec
(
template
%
(
"Word"
,
'cwor'
))
exec
(
template
%
(
"Line"
,
'clin'
))
exec
(
template
%
(
"paragraph"
,
'cpar'
))
exec
(
template
%
(
"Window"
,
'cwin'
))
exec
(
template
%
(
"Document"
,
'docu'
))
exec
(
template
%
(
"File"
,
'file'
))
exec
(
template
%
(
"InsertionPoint"
,
'cins'
))
exec
(
template
%
(
"Text"
,
b
'text'
))
exec
(
template
%
(
"Character"
,
b
'cha '
))
exec
(
template
%
(
"Word"
,
b
'cwor'
))
exec
(
template
%
(
"Line"
,
b
'clin'
))
exec
(
template
%
(
"paragraph"
,
b
'cpar'
))
exec
(
template
%
(
"Window"
,
b
'cwin'
))
exec
(
template
%
(
"Document"
,
b
'docu'
))
exec
(
template
%
(
"File"
,
b
'file'
))
exec
(
template
%
(
"InsertionPoint"
,
b
'cins'
))
Lib/test/test_aepack.py
Dosyayı görüntüle @
f7a94e4b
...
...
@@ -8,18 +8,18 @@ from test import test_support
class
TestAepack
(
unittest
.
TestCase
):
OBJECTS
=
[
aetypes
.
Enum
(
'enum'
),
aetypes
.
Type
(
'type'
),
aetypes
.
Keyword
(
'kwrd'
),
aetypes
.
Enum
(
b
'enum'
),
aetypes
.
Type
(
b
'type'
),
aetypes
.
Keyword
(
b
'kwrd'
),
aetypes
.
Range
(
1
,
10
),
aetypes
.
Comparison
(
1
,
'< '
,
10
),
aetypes
.
Logical
(
'not '
,
1
),
aetypes
.
IntlText
(
0
,
0
,
'international text'
),
aetypes
.
Comparison
(
1
,
b
'< '
,
10
),
aetypes
.
Logical
(
b
'not '
,
1
),
aetypes
.
IntlText
(
0
,
0
,
b
'international text'
),
aetypes
.
IntlWritingCode
(
0
,
0
),
aetypes
.
QDPoint
(
50
,
100
),
aetypes
.
QDRectangle
(
50
,
100
,
150
,
200
),
aetypes
.
RGBColor
(
0x7000
,
0x6000
,
0x5000
),
aetypes
.
Unknown
(
'xxxx'
,
'unknown type data'
),
aetypes
.
Unknown
(
b
'xxxx'
,
b
'unknown type data'
),
aetypes
.
Character
(
1
),
aetypes
.
Character
(
2
,
aetypes
.
Line
(
2
)),
]
...
...
Lib/test/test_applesingle.py
Dosyayı görüntüle @
f7a94e4b
...
...
@@ -12,8 +12,8 @@ import applesingle
AS_MAGIC
=
0x00051600
AS_VERSION
=
0x00020000
dataforkdata
=
'hello
\r\0
world
\n
'
resourceforkdata
=
'goodbye
\n
cruel
\0
world
\r
'
dataforkdata
=
b
'hello
\r\0
world
\n
'
resourceforkdata
=
b
'goodbye
\n
cruel
\0
world
\r
'
applesingledata
=
struct
.
pack
(
">ll16sh"
,
AS_MAGIC
,
AS_VERSION
,
"foo"
,
2
)
+
\
struct
.
pack
(
">llllll"
,
1
,
50
,
len
(
dataforkdata
),
...
...
@@ -25,7 +25,7 @@ TESTFN2 = test_support.TESTFN + '2'
class
TestApplesingle
(
unittest
.
TestCase
):
def
setUp
(
self
):
fp
=
open
(
test_support
.
TESTFN
,
'w'
)
fp
=
open
(
test_support
.
TESTFN
,
'w
b
'
)
fp
.
write
(
applesingledata
)
fp
.
close
()
...
...
Mac/Modules/ae/_AEmodule.c
Dosyayı görüntüle @
f7a94e4b
...
...
@@ -835,9 +835,9 @@ static PyObject *AEDesc_get_data(AEDescObject *self, void *closure)
OSErr
err
;
size
=
AEGetDescDataSize
(
&
self
->
ob_itself
);
if
(
(
res
=
Py
String
_FromStringAndSize
(
NULL
,
size
))
==
NULL
)
if
(
(
res
=
Py
Bytes
_FromStringAndSize
(
NULL
,
size
))
==
NULL
)
return
NULL
;
if
(
(
ptr
=
Py
String
_AsString
(
res
))
==
NULL
)
if
(
(
ptr
=
Py
Bytes
_AsString
(
res
))
==
NULL
)
return
NULL
;
if
(
(
err
=
AEGetDescData
(
&
self
->
ob_itself
,
ptr
,
size
))
<
0
)
return
PyMac_Error
(
err
);
...
...
Python/mactoolboxglue.c
Dosyayı görüntüle @
f7a94e4b
...
...
@@ -194,7 +194,7 @@ PyObject *
PyMac_BuildOSType
(
OSType
t
)
{
uint32_t
tmp
=
htonl
((
uint32_t
)
t
);
return
Py
String
_FromStringAndSize
((
char
*
)
&
tmp
,
4
);
return
Py
Bytes
_FromStringAndSize
((
char
*
)
&
tmp
,
4
);
}
/* Convert an NumVersion value to a 4-element tuple */
...
...
@@ -215,7 +215,7 @@ PyMac_GetStr255(PyObject *v, Str255 pbuf)
if
(
PyUnicode_Check
(
v
))
{
v
=
_PyUnicode_AsDefaultEncodedString
(
v
,
NULL
);
if
(
v
==
NULL
)
return
NULL
;
return
0
;
}
if
(
PyString_Check
(
v
))
{
ptr
=
PyString_AS_STRING
(
v
);
...
...
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