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
6db15d73
Kaydet (Commit)
6db15d73
authored
Agu 04, 2004
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Whitespace normalization.
üst
cea2cc4a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
52 deletions
+52
-52
ast.py
Lib/compiler/ast.py
+2
-2
pycodegen.py
Lib/compiler/pycodegen.py
+2
-2
transformer.py
Lib/compiler/transformer.py
+5
-5
cygwinccompiler.py
Lib/distutils/cygwinccompiler.py
+22
-22
pyclbr_input.py
Lib/test/pyclbr_input.py
+4
-4
test_decorators.py
Lib/test/test_decorators.py
+8
-8
test_pyclbr.py
Lib/test/test_pyclbr.py
+1
-1
test_threadsignals.py
Lib/test/test_threadsignals.py
+8
-8
No files found.
Lib/compiler/ast.py
Dosyayı görüntüle @
6db15d73
...
@@ -607,7 +607,7 @@ class GenExpr(Node):
...
@@ -607,7 +607,7 @@ class GenExpr(Node):
self
.
code
=
code
self
.
code
=
code
self
.
argnames
=
[
'[outmost-iterable]'
]
self
.
argnames
=
[
'[outmost-iterable]'
]
self
.
varargs
=
self
.
kwargs
=
None
self
.
varargs
=
self
.
kwargs
=
None
def
getChildren
(
self
):
def
getChildren
(
self
):
...
@@ -785,7 +785,7 @@ class Lambda(Node):
...
@@ -785,7 +785,7 @@ class Lambda(Node):
self
.
varargs
=
1
self
.
varargs
=
1
if
flags
&
CO_VARKEYWORDS
:
if
flags
&
CO_VARKEYWORDS
:
self
.
kwargs
=
1
self
.
kwargs
=
1
def
getChildren
(
self
):
def
getChildren
(
self
):
...
...
Lib/compiler/pycodegen.py
Dosyayı görüntüle @
6db15d73
...
@@ -372,7 +372,7 @@ class CodeGenerator:
...
@@ -372,7 +372,7 @@ class CodeGenerator:
ndecorators
=
len
(
node
.
decorators
.
nodes
)
ndecorators
=
len
(
node
.
decorators
.
nodes
)
else
:
else
:
ndecorators
=
0
ndecorators
=
0
gen
=
self
.
FunctionGen
(
node
,
self
.
scopes
,
isLambda
,
gen
=
self
.
FunctionGen
(
node
,
self
.
scopes
,
isLambda
,
self
.
class_name
,
self
.
get_module
())
self
.
class_name
,
self
.
get_module
())
walk
(
node
.
code
,
gen
)
walk
(
node
.
code
,
gen
)
...
@@ -389,7 +389,7 @@ class CodeGenerator:
...
@@ -389,7 +389,7 @@ class CodeGenerator:
else
:
else
:
self
.
emit
(
'LOAD_CONST'
,
gen
)
self
.
emit
(
'LOAD_CONST'
,
gen
)
self
.
emit
(
'MAKE_FUNCTION'
,
len
(
node
.
defaults
))
self
.
emit
(
'MAKE_FUNCTION'
,
len
(
node
.
defaults
))
for
i
in
range
(
ndecorators
):
for
i
in
range
(
ndecorators
):
self
.
emit
(
'CALL_FUNCTION'
,
1
)
self
.
emit
(
'CALL_FUNCTION'
,
1
)
...
...
Lib/compiler/transformer.py
Dosyayı görüntüle @
6db15d73
...
@@ -198,7 +198,7 @@ class Transformer:
...
@@ -198,7 +198,7 @@ class Transformer:
i
+=
2
i
+=
2
return
item
return
item
def
decorator
(
self
,
nodelist
):
def
decorator
(
self
,
nodelist
):
# '@' dotted_name [ '(' [arglist] ')' ]
# '@' dotted_name [ '(' [arglist] ')' ]
assert
len
(
nodelist
)
in
(
2
,
4
,
5
)
assert
len
(
nodelist
)
in
(
2
,
4
,
5
)
...
@@ -212,9 +212,9 @@ class Transformer:
...
@@ -212,9 +212,9 @@ class Transformer:
expr
=
self
.
com_call_function
(
funcname
,
nodelist
[
3
])
expr
=
self
.
com_call_function
(
funcname
,
nodelist
[
3
])
else
:
else
:
expr
=
funcname
expr
=
funcname
return
expr
return
expr
def
decorators
(
self
,
nodelist
):
def
decorators
(
self
,
nodelist
):
# decorators: decorator ([NEWLINE] decorator)* NEWLINE
# decorators: decorator ([NEWLINE] decorator)* NEWLINE
listlen
=
len
(
nodelist
)
listlen
=
len
(
nodelist
)
...
@@ -228,7 +228,7 @@ class Transformer:
...
@@ -228,7 +228,7 @@ class Transformer:
if
i
<
listlen
and
nodelist
[
i
][
0
]
==
token
.
NEWLINE
:
if
i
<
listlen
and
nodelist
[
i
][
0
]
==
token
.
NEWLINE
:
i
+=
1
i
+=
1
return
Decorators
(
items
)
return
Decorators
(
items
)
def
funcdef
(
self
,
nodelist
):
def
funcdef
(
self
,
nodelist
):
# -6 -5 -4 -3 -2 -1
# -6 -5 -4 -3 -2 -1
# funcdef: [decorators] 'def' NAME parameters ':' suite
# funcdef: [decorators] 'def' NAME parameters ':' suite
...
@@ -240,7 +240,7 @@ class Transformer:
...
@@ -240,7 +240,7 @@ class Transformer:
else
:
else
:
assert
len
(
nodelist
)
==
5
assert
len
(
nodelist
)
==
5
decorators
=
None
decorators
=
None
lineno
=
nodelist
[
-
4
][
2
]
lineno
=
nodelist
[
-
4
][
2
]
name
=
nodelist
[
-
4
][
1
]
name
=
nodelist
[
-
4
][
1
]
args
=
nodelist
[
-
3
][
2
]
args
=
nodelist
[
-
3
][
2
]
...
...
Lib/distutils/cygwinccompiler.py
Dosyayı görüntüle @
6db15d73
...
@@ -122,17 +122,17 @@ class CygwinCCompiler (UnixCCompiler):
...
@@ -122,17 +122,17 @@ class CygwinCCompiler (UnixCCompiler):
"Consider upgrading to a newer version of gcc"
)
"Consider upgrading to a newer version of gcc"
)
else
:
else
:
self
.
dll_libraries
=
[]
self
.
dll_libraries
=
[]
# Include the appropriate MSVC runtime library if Python was built
# Include the appropriate MSVC runtime library if Python was built
# with MSVC 7.0 or 7.1.
# with MSVC 7.0 or 7.1.
msc_pos
=
sys
.
version
.
find
(
'MSC v.'
)
msc_pos
=
sys
.
version
.
find
(
'MSC v.'
)
if
msc_pos
!=
-
1
:
if
msc_pos
!=
-
1
:
msc_ver
=
sys
.
version
[
msc_pos
+
6
:
msc_pos
+
10
]
msc_ver
=
sys
.
version
[
msc_pos
+
6
:
msc_pos
+
10
]
if
msc_ver
==
'1300'
:
if
msc_ver
==
'1300'
:
# MSVC 7.0
# MSVC 7.0
self
.
dll_libraries
=
[
'msvcr70'
]
self
.
dll_libraries
=
[
'msvcr70'
]
elif
msc_ver
==
'1310'
:
elif
msc_ver
==
'1310'
:
# MSVC 7.1
# MSVC 7.1
self
.
dll_libraries
=
[
'msvcr71'
]
self
.
dll_libraries
=
[
'msvcr71'
]
# __init__ ()
# __init__ ()
...
@@ -319,17 +319,17 @@ class Mingw32CCompiler (CygwinCCompiler):
...
@@ -319,17 +319,17 @@ class Mingw32CCompiler (CygwinCCompiler):
# no additional libraries needed
# no additional libraries needed
self
.
dll_libraries
=
[]
self
.
dll_libraries
=
[]
# Include the appropriate MSVC runtime library if Python was built
# Include the appropriate MSVC runtime library if Python was built
# with MSVC 7.0 or 7.1.
# with MSVC 7.0 or 7.1.
msc_pos
=
sys
.
version
.
find
(
'MSC v.'
)
msc_pos
=
sys
.
version
.
find
(
'MSC v.'
)
if
msc_pos
!=
-
1
:
if
msc_pos
!=
-
1
:
msc_ver
=
sys
.
version
[
msc_pos
+
6
:
msc_pos
+
10
]
msc_ver
=
sys
.
version
[
msc_pos
+
6
:
msc_pos
+
10
]
if
msc_ver
==
'1300'
:
if
msc_ver
==
'1300'
:
# MSVC 7.0
# MSVC 7.0
self
.
dll_libraries
=
[
'msvcr70'
]
self
.
dll_libraries
=
[
'msvcr70'
]
elif
msc_ver
==
'1310'
:
elif
msc_ver
==
'1310'
:
# MSVC 7.1
# MSVC 7.1
self
.
dll_libraries
=
[
'msvcr71'
]
self
.
dll_libraries
=
[
'msvcr71'
]
# __init__ ()
# __init__ ()
...
...
Lib/test/pyclbr_input.py
Dosyayı görüntüle @
6db15d73
...
@@ -10,11 +10,11 @@ class Other(object):
...
@@ -10,11 +10,11 @@ class Other(object):
class
B
(
object
):
class
B
(
object
):
def
bm
(
self
):
pass
def
bm
(
self
):
pass
class
C
(
B
):
class
C
(
B
):
foo
=
Other
()
.
foo
foo
=
Other
()
.
foo
om
=
Other
.
om
om
=
Other
.
om
d
=
10
d
=
10
# XXX: This causes test_pyclbr.py to fail, but only because the
# XXX: This causes test_pyclbr.py to fail, but only because the
...
@@ -23,9 +23,9 @@ class C (B):
...
@@ -23,9 +23,9 @@ class C (B):
# The pyclbr.py module gets this right as it parses the text.
# The pyclbr.py module gets this right as it parses the text.
#
#
#f = f
#f = f
def
m
(
self
):
pass
def
m
(
self
):
pass
@staticmethod
@staticmethod
def
sm
(
self
):
pass
def
sm
(
self
):
pass
...
...
Lib/test/test_decorators.py
Dosyayı görüntüle @
6db15d73
...
@@ -22,8 +22,8 @@ class DbcheckError (Exception):
...
@@ -22,8 +22,8 @@ class DbcheckError (Exception):
# A real version of this would set attributes here
# A real version of this would set attributes here
Exception
.
__init__
(
self
,
"dbcheck
%
r failed (func=
%
s args=
%
s kwds=
%
s)"
%
Exception
.
__init__
(
self
,
"dbcheck
%
r failed (func=
%
s args=
%
s kwds=
%
s)"
%
(
exprstr
,
func
,
args
,
kwds
))
(
exprstr
,
func
,
args
,
kwds
))
def
dbcheck
(
exprstr
,
globals
=
None
,
locals
=
None
):
def
dbcheck
(
exprstr
,
globals
=
None
,
locals
=
None
):
"Decorator to implement debugging assertions"
"Decorator to implement debugging assertions"
def
decorate
(
func
):
def
decorate
(
func
):
...
@@ -66,7 +66,7 @@ def memoize(func):
...
@@ -66,7 +66,7 @@ def memoize(func):
# Unhashable argument
# Unhashable argument
return
func
(
*
args
)
return
func
(
*
args
)
return
call
return
call
# -----------------------------------------------
# -----------------------------------------------
class
TestDecorators
(
unittest
.
TestCase
):
class
TestDecorators
(
unittest
.
TestCase
):
...
@@ -80,7 +80,7 @@ class TestDecorators(unittest.TestCase):
...
@@ -80,7 +80,7 @@ class TestDecorators(unittest.TestCase):
def
test_staticmethod_function
(
self
):
def
test_staticmethod_function
(
self
):
@staticmethod
@staticmethod
def
notamethod
(
x
):
def
notamethod
(
x
):
return
x
return
x
self
.
assertRaises
(
TypeError
,
notamethod
,
1
)
self
.
assertRaises
(
TypeError
,
notamethod
,
1
)
...
@@ -94,7 +94,7 @@ class TestDecorators(unittest.TestCase):
...
@@ -94,7 +94,7 @@ class TestDecorators(unittest.TestCase):
def
test_argforms
(
self
):
def
test_argforms
(
self
):
# A few tests of argument passing, as we use restricted form
# A few tests of argument passing, as we use restricted form
# of expressions for decorators.
# of expressions for decorators.
def
noteargs
(
*
args
,
**
kwds
):
def
noteargs
(
*
args
,
**
kwds
):
def
decorate
(
func
):
def
decorate
(
func
):
setattr
(
func
,
'dbval'
,
(
args
,
kwds
))
setattr
(
func
,
'dbval'
,
(
args
,
kwds
))
...
@@ -129,7 +129,7 @@ class TestDecorators(unittest.TestCase):
...
@@ -129,7 +129,7 @@ class TestDecorators(unittest.TestCase):
# XXX: This doesn't work unless memoize is the last decorator -
# XXX: This doesn't work unless memoize is the last decorator -
# see the comment in countcalls.
# see the comment in countcalls.
counts
=
{}
counts
=
{}
@countcalls
(
counts
)
@memoize
@countcalls
(
counts
)
@memoize
def
double
(
x
):
def
double
(
x
):
return
x
*
2
return
x
*
2
...
@@ -157,7 +157,7 @@ class TestDecorators(unittest.TestCase):
...
@@ -157,7 +157,7 @@ class TestDecorators(unittest.TestCase):
for
expr
in
[
"1+2"
,
"x[3]"
,
"(1, 2)"
]:
for
expr
in
[
"1+2"
,
"x[3]"
,
"(1, 2)"
]:
# Sanity check: is expr is a valid expression by itself?
# Sanity check: is expr is a valid expression by itself?
compile
(
expr
,
"testexpr"
,
"exec"
)
compile
(
expr
,
"testexpr"
,
"exec"
)
codestr
=
"@
%
s
\n
def f(): pass"
%
expr
codestr
=
"@
%
s
\n
def f(): pass"
%
expr
self
.
assertRaises
(
SyntaxError
,
compile
,
codestr
,
"test"
,
"exec"
)
self
.
assertRaises
(
SyntaxError
,
compile
,
codestr
,
"test"
,
"exec"
)
...
@@ -166,7 +166,7 @@ class TestDecorators(unittest.TestCase):
...
@@ -166,7 +166,7 @@ class TestDecorators(unittest.TestCase):
def
unimp
(
func
):
def
unimp
(
func
):
raise
NotImplementedError
raise
NotImplementedError
context
=
dict
(
nullval
=
None
,
unimp
=
unimp
)
context
=
dict
(
nullval
=
None
,
unimp
=
unimp
)
for
expr
,
exc
in
[
(
"undef"
,
NameError
),
for
expr
,
exc
in
[
(
"undef"
,
NameError
),
(
"nullval"
,
TypeError
),
(
"nullval"
,
TypeError
),
(
"nullval.attr"
,
AttributeError
),
(
"nullval.attr"
,
AttributeError
),
...
...
Lib/test/test_pyclbr.py
Dosyayı görüntüle @
6db15d73
...
@@ -151,7 +151,7 @@ class PyclbrTest(TestCase):
...
@@ -151,7 +151,7 @@ class PyclbrTest(TestCase):
# if it were not commented out.
# if it were not commented out.
#
#
self
.
checkModule
(
'test.pyclbr_input'
)
self
.
checkModule
(
'test.pyclbr_input'
)
def
test_others
(
self
):
def
test_others
(
self
):
cm
=
self
.
checkModule
cm
=
self
.
checkModule
...
...
Lib/test/test_threadsignals.py
Dosyayı görüntüle @
6db15d73
...
@@ -10,7 +10,7 @@ from test import test_support, TestSkipped
...
@@ -10,7 +10,7 @@ from test import test_support, TestSkipped
if
sys
.
platform
[:
3
]
in
(
'win'
,
'os2'
)
or
sys
.
platform
==
'riscos'
:
if
sys
.
platform
[:
3
]
in
(
'win'
,
'os2'
)
or
sys
.
platform
==
'riscos'
:
raise
TestSkipped
,
"Can't test signal on
%
s"
%
sys
.
platform
raise
TestSkipped
,
"Can't test signal on
%
s"
%
sys
.
platform
signal_blackboard
=
{
signal
.
SIGUSR1
:
{
'tripped'
:
0
,
'tripped_by'
:
0
},
signal_blackboard
=
{
signal
.
SIGUSR1
:
{
'tripped'
:
0
,
'tripped_by'
:
0
},
signal
.
SIGUSR2
:
{
'tripped'
:
0
,
'tripped_by'
:
0
},
signal
.
SIGUSR2
:
{
'tripped'
:
0
,
'tripped_by'
:
0
},
signal
.
SIGALRM
:
{
'tripped'
:
0
,
'tripped_by'
:
0
}
}
signal
.
SIGALRM
:
{
'tripped'
:
0
,
'tripped_by'
:
0
}
}
...
@@ -28,7 +28,7 @@ def registerSignals((for_usr1, for_usr2, for_alrm)):
...
@@ -28,7 +28,7 @@ def registerSignals((for_usr1, for_usr2, for_alrm)):
# The signal handler. Just note that the signal occured and
# The signal handler. Just note that the signal occured and
# from who.
# from who.
def
handle_signals
(
sig
,
frame
):
def
handle_signals
(
sig
,
frame
):
signal_blackboard
[
sig
][
'tripped'
]
+=
1
signal_blackboard
[
sig
][
'tripped'
]
+=
1
signal_blackboard
[
sig
][
'tripped_by'
]
=
thread
.
get_ident
()
signal_blackboard
[
sig
][
'tripped_by'
]
=
thread
.
get_ident
()
# a function that will be spawned as a separate thread.
# a function that will be spawned as a separate thread.
...
@@ -55,20 +55,20 @@ class ThreadSignals(unittest.TestCase):
...
@@ -55,20 +55,20 @@ class ThreadSignals(unittest.TestCase):
# wait for it return.
# wait for it return.
if
signal_blackboard
[
signal
.
SIGUSR2
][
'tripped'
]
==
0
\
if
signal_blackboard
[
signal
.
SIGUSR2
][
'tripped'
]
==
0
\
or
signal_blackboard
[
signal
.
SIGUSR2
][
'tripped'
]
==
0
:
or
signal_blackboard
[
signal
.
SIGUSR2
][
'tripped'
]
==
0
:
signal
.
alarm
(
1
)
signal
.
alarm
(
1
)
signal
.
pause
()
signal
.
pause
()
signal
.
alarm
(
0
)
signal
.
alarm
(
0
)
self
.
assertEqual
(
signal_blackboard
[
signal
.
SIGUSR1
][
'tripped'
],
1
)
self
.
assertEqual
(
signal_blackboard
[
signal
.
SIGUSR1
][
'tripped'
],
1
)
self
.
assertEqual
(
signal_blackboard
[
signal
.
SIGUSR1
][
'tripped_by'
],
self
.
assertEqual
(
signal_blackboard
[
signal
.
SIGUSR1
][
'tripped_by'
],
thread
.
get_ident
())
thread
.
get_ident
())
self
.
assertEqual
(
signal_blackboard
[
signal
.
SIGUSR2
][
'tripped'
],
1
)
self
.
assertEqual
(
signal_blackboard
[
signal
.
SIGUSR2
][
'tripped'
],
1
)
self
.
assertEqual
(
signal_blackboard
[
signal
.
SIGUSR2
][
'tripped_by'
],
self
.
assertEqual
(
signal_blackboard
[
signal
.
SIGUSR2
][
'tripped_by'
],
thread
.
get_ident
())
thread
.
get_ident
())
def
spawnSignallingThread
(
self
):
def
spawnSignallingThread
(
self
):
thread
.
start_new_thread
(
send_signals
,
())
thread
.
start_new_thread
(
send_signals
,
())
def
test_main
():
def
test_main
():
oldsigs
=
registerSignals
((
handle_signals
,
handle_signals
,
handle_signals
))
oldsigs
=
registerSignals
((
handle_signals
,
handle_signals
,
handle_signals
))
...
...
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