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
2c60f7a1
Kaydet (Commit)
2c60f7a1
authored
Ock 29, 2003
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Whitespace normalization.
üst
c0c12b57
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
98 additions
and
98 deletions
+98
-98
SimpleXMLRPCServer.py
Lib/SimpleXMLRPCServer.py
+34
-34
_strptime.py
Lib/_strptime.py
+3
-3
dummy_thread.py
Lib/dummy_thread.py
+5
-5
macpath.py
Lib/macpath.py
+4
-4
modulefinder.py
Lib/modulefinder.py
+3
-3
os.py
Lib/os.py
+3
-3
pickletools.py
Lib/pickletools.py
+4
-4
pty.py
Lib/pty.py
+2
-2
py_compile.py
Lib/py_compile.py
+9
-9
tarfile.py
Lib/tarfile.py
+1
-1
setup.py
setup.py
+30
-30
No files found.
Lib/SimpleXMLRPCServer.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -32,7 +32,7 @@ class MyFuncs:
...
@@ -32,7 +32,7 @@ class MyFuncs:
['string.' + method for method in list_public_methods(self.string)]
['string.' + method for method in list_public_methods(self.string)]
def pow(self, x, y): return pow(x, y)
def pow(self, x, y): return pow(x, y)
def add(self, x, y) : return x + y
def add(self, x, y) : return x + y
server = SimpleXMLRPCServer(("localhost", 8000))
server = SimpleXMLRPCServer(("localhost", 8000))
server.register_introspection_functions()
server.register_introspection_functions()
server.register_instance(MyFuncs())
server.register_instance(MyFuncs())
...
@@ -137,7 +137,7 @@ def remove_duplicates(lst):
...
@@ -137,7 +137,7 @@ def remove_duplicates(lst):
Returns a copy of a list without duplicates. Every list
Returns a copy of a list without duplicates. Every list
item must be hashable and the order of the items in the
item must be hashable and the order of the items in the
resulting list is not defined.
resulting list is not defined.
"""
"""
u
=
{}
u
=
{}
for
x
in
lst
:
for
x
in
lst
:
u
[
x
]
=
1
u
[
x
]
=
1
...
@@ -151,7 +151,7 @@ class SimpleXMLRPCDispatcher:
...
@@ -151,7 +151,7 @@ class SimpleXMLRPCDispatcher:
and then to dispatch them. There should never be any
and then to dispatch them. There should never be any
reason to instantiate this class directly.
reason to instantiate this class directly.
"""
"""
def
__init__
(
self
):
def
__init__
(
self
):
self
.
funcs
=
{}
self
.
funcs
=
{}
self
.
instance
=
None
self
.
instance
=
None
...
@@ -195,7 +195,7 @@ class SimpleXMLRPCDispatcher:
...
@@ -195,7 +195,7 @@ class SimpleXMLRPCDispatcher:
see http://xmlrpc.usefulinc.com/doc/reserved.html
see http://xmlrpc.usefulinc.com/doc/reserved.html
"""
"""
self
.
funcs
.
update
({
'system.listMethods'
:
self
.
system_listMethods
,
self
.
funcs
.
update
({
'system.listMethods'
:
self
.
system_listMethods
,
'system.methodSignature'
:
self
.
system_methodSignature
,
'system.methodSignature'
:
self
.
system_methodSignature
,
'system.methodHelp'
:
self
.
system_methodHelp
})
'system.methodHelp'
:
self
.
system_methodHelp
})
...
@@ -205,28 +205,28 @@ class SimpleXMLRPCDispatcher:
...
@@ -205,28 +205,28 @@ class SimpleXMLRPCDispatcher:
namespace.
namespace.
see http://www.xmlrpc.com/discuss/msgReader$1208"""
see http://www.xmlrpc.com/discuss/msgReader$1208"""
self
.
funcs
.
update
({
'system.multicall'
:
self
.
system_multicall
})
self
.
funcs
.
update
({
'system.multicall'
:
self
.
system_multicall
})
def
_marshaled_dispatch
(
self
,
data
,
dispatch_method
=
None
):
def
_marshaled_dispatch
(
self
,
data
,
dispatch_method
=
None
):
"""Dispatches an XML-RPC method from marshalled (XML) data.
"""Dispatches an XML-RPC method from marshalled (XML) data.
XML-RPC methods are dispatched from the marshalled (XML) data
XML-RPC methods are dispatched from the marshalled (XML) data
using the _dispatch method and the result is returned as
using the _dispatch method and the result is returned as
marshalled data. For backwards compatibility, a dispatch
marshalled data. For backwards compatibility, a dispatch
function can be provided as an argument (see comment in
function can be provided as an argument (see comment in
SimpleXMLRPCRequestHandler.do_POST) but overriding the
SimpleXMLRPCRequestHandler.do_POST) but overriding the
existing method through subclassing is the prefered means
existing method through subclassing is the prefered means
of changing method dispatch behavior.
of changing method dispatch behavior.
"""
"""
params
,
method
=
xmlrpclib
.
loads
(
data
)
params
,
method
=
xmlrpclib
.
loads
(
data
)
# generate response
# generate response
try
:
try
:
if
dispatch_method
is
not
None
:
if
dispatch_method
is
not
None
:
response
=
dispatch_method
(
method
,
params
)
response
=
dispatch_method
(
method
,
params
)
else
:
else
:
response
=
self
.
_dispatch
(
method
,
params
)
response
=
self
.
_dispatch
(
method
,
params
)
# wrap response in a singleton tuple
# wrap response in a singleton tuple
response
=
(
response
,)
response
=
(
response
,)
...
@@ -245,7 +245,7 @@ class SimpleXMLRPCDispatcher:
...
@@ -245,7 +245,7 @@ class SimpleXMLRPCDispatcher:
"""system.listMethods() => ['add', 'subtract', 'multiple']
"""system.listMethods() => ['add', 'subtract', 'multiple']
Returns a list of the methods supported by the server."""
Returns a list of the methods supported by the server."""
methods
=
self
.
funcs
.
keys
()
methods
=
self
.
funcs
.
keys
()
if
self
.
instance
is
not
None
:
if
self
.
instance
is
not
None
:
# Instance can implement _listMethod to return a list of
# Instance can implement _listMethod to return a list of
...
@@ -263,7 +263,7 @@ class SimpleXMLRPCDispatcher:
...
@@ -263,7 +263,7 @@ class SimpleXMLRPCDispatcher:
)
)
methods
.
sort
()
methods
.
sort
()
return
methods
return
methods
def
system_methodSignature
(
self
,
method_name
):
def
system_methodSignature
(
self
,
method_name
):
"""system.methodSignature('add') => [double, int, int]
"""system.methodSignature('add') => [double, int, int]
...
@@ -274,14 +274,14 @@ class SimpleXMLRPCDispatcher:
...
@@ -274,14 +274,14 @@ class SimpleXMLRPCDispatcher:
This server does NOT support system.methodSignature."""
This server does NOT support system.methodSignature."""
# See http://xmlrpc.usefulinc.com/doc/sysmethodsig.html
# See http://xmlrpc.usefulinc.com/doc/sysmethodsig.html
return
'signatures not supported'
return
'signatures not supported'
def
system_methodHelp
(
self
,
method_name
):
def
system_methodHelp
(
self
,
method_name
):
"""system.methodHelp('add') => "Adds two integers together"
"""system.methodHelp('add') => "Adds two integers together"
Returns a string containing documentation for the specified method."""
Returns a string containing documentation for the specified method."""
method
=
None
method
=
None
if
self
.
funcs
.
has_key
(
method_name
):
if
self
.
funcs
.
has_key
(
method_name
):
method
=
self
.
funcs
[
method_name
]
method
=
self
.
funcs
[
method_name
]
...
@@ -314,9 +314,9 @@ class SimpleXMLRPCDispatcher:
...
@@ -314,9 +314,9 @@ class SimpleXMLRPCDispatcher:
Allows the caller to package multiple XML-RPC calls into a single
Allows the caller to package multiple XML-RPC calls into a single
request.
request.
See http://www.xmlrpc.com/discuss/msgReader$1208
See http://www.xmlrpc.com/discuss/msgReader$1208
"""
"""
results
=
[]
results
=
[]
for
call
in
call_list
:
for
call
in
call_list
:
method_name
=
call
[
'methodName'
]
method_name
=
call
[
'methodName'
]
...
@@ -337,7 +337,7 @@ class SimpleXMLRPCDispatcher:
...
@@ -337,7 +337,7 @@ class SimpleXMLRPCDispatcher:
'faultString'
:
"
%
s:
%
s"
%
(
sys
.
exc_type
,
sys
.
exc_value
)}
'faultString'
:
"
%
s:
%
s"
%
(
sys
.
exc_type
,
sys
.
exc_value
)}
)
)
return
results
return
results
def
_dispatch
(
self
,
method
,
params
):
def
_dispatch
(
self
,
method
,
params
):
"""Dispatches the XML-RPC method.
"""Dispatches the XML-RPC method.
...
@@ -382,7 +382,7 @@ class SimpleXMLRPCDispatcher:
...
@@ -382,7 +382,7 @@ class SimpleXMLRPCDispatcher:
return
func
(
*
params
)
return
func
(
*
params
)
else
:
else
:
raise
Exception
(
'method "
%
s" is not supported'
%
method
)
raise
Exception
(
'method "
%
s" is not supported'
%
method
)
class
SimpleXMLRPCRequestHandler
(
BaseHTTPServer
.
BaseHTTPRequestHandler
):
class
SimpleXMLRPCRequestHandler
(
BaseHTTPServer
.
BaseHTTPRequestHandler
):
"""Simple XML-RPC request handler class.
"""Simple XML-RPC request handler class.
...
@@ -396,7 +396,7 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
...
@@ -396,7 +396,7 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
Attempts to interpret all HTTP POST requests as XML-RPC calls,
Attempts to interpret all HTTP POST requests as XML-RPC calls,
which are forwarded to the server's _dispatch method for handling.
which are forwarded to the server's _dispatch method for handling.
"""
"""
try
:
try
:
# get arguments
# get arguments
data
=
self
.
rfile
.
read
(
int
(
self
.
headers
[
"content-length"
]))
data
=
self
.
rfile
.
read
(
int
(
self
.
headers
[
"content-length"
]))
...
@@ -423,14 +423,14 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
...
@@ -423,14 +423,14 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
# shut down the connection
# shut down the connection
self
.
wfile
.
flush
()
self
.
wfile
.
flush
()
self
.
connection
.
shutdown
(
1
)
self
.
connection
.
shutdown
(
1
)
def
log_request
(
self
,
code
=
'-'
,
size
=
'-'
):
def
log_request
(
self
,
code
=
'-'
,
size
=
'-'
):
"""Selectively log an accepted request."""
"""Selectively log an accepted request."""
if
self
.
server
.
logRequests
:
if
self
.
server
.
logRequests
:
BaseHTTPServer
.
BaseHTTPRequestHandler
.
log_request
(
self
,
code
,
size
)
BaseHTTPServer
.
BaseHTTPRequestHandler
.
log_request
(
self
,
code
,
size
)
class
SimpleXMLRPCServer
(
SocketServer
.
TCPServer
,
class
SimpleXMLRPCServer
(
SocketServer
.
TCPServer
,
SimpleXMLRPCDispatcher
):
SimpleXMLRPCDispatcher
):
"""Simple XML-RPC server.
"""Simple XML-RPC server.
...
@@ -444,21 +444,21 @@ class SimpleXMLRPCServer(SocketServer.TCPServer,
...
@@ -444,21 +444,21 @@ class SimpleXMLRPCServer(SocketServer.TCPServer,
def
__init__
(
self
,
addr
,
requestHandler
=
SimpleXMLRPCRequestHandler
,
def
__init__
(
self
,
addr
,
requestHandler
=
SimpleXMLRPCRequestHandler
,
logRequests
=
1
):
logRequests
=
1
):
self
.
logRequests
=
logRequests
self
.
logRequests
=
logRequests
SimpleXMLRPCDispatcher
.
__init__
(
self
)
SimpleXMLRPCDispatcher
.
__init__
(
self
)
SocketServer
.
TCPServer
.
__init__
(
self
,
addr
,
requestHandler
)
SocketServer
.
TCPServer
.
__init__
(
self
,
addr
,
requestHandler
)
class
CGIXMLRPCRequestHandler
(
SimpleXMLRPCDispatcher
):
class
CGIXMLRPCRequestHandler
(
SimpleXMLRPCDispatcher
):
"""Simple handler for XML-RPC data passed through CGI."""
"""Simple handler for XML-RPC data passed through CGI."""
def
__init__
(
self
):
def
__init__
(
self
):
SimpleXMLRPCDispatcher
.
__init__
(
self
)
SimpleXMLRPCDispatcher
.
__init__
(
self
)
def
handle_xmlrpc
(
self
,
request_text
):
def
handle_xmlrpc
(
self
,
request_text
):
"""Handle a single XML-RPC request"""
"""Handle a single XML-RPC request"""
response
=
self
.
_marshaled_dispatch
(
request_text
)
response
=
self
.
_marshaled_dispatch
(
request_text
)
print
'Content-Type: text/xml'
print
'Content-Type: text/xml'
print
'Content-Length:
%
d'
%
len
(
response
)
print
'Content-Length:
%
d'
%
len
(
response
)
print
print
...
@@ -474,11 +474,11 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
...
@@ -474,11 +474,11 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
code
=
400
code
=
400
message
,
explain
=
\
message
,
explain
=
\
BaseHTTPServer
.
BaseHTTPRequestHandler
.
responses
[
code
]
BaseHTTPServer
.
BaseHTTPRequestHandler
.
responses
[
code
]
response
=
BaseHTTPServer
.
DEFAULT_ERROR_MESSAGE
%
\
response
=
BaseHTTPServer
.
DEFAULT_ERROR_MESSAGE
%
\
{
{
'code'
:
code
,
'code'
:
code
,
'message'
:
message
,
'message'
:
message
,
'explain'
:
explain
'explain'
:
explain
}
}
print
'Status:
%
d
%
s'
%
(
code
,
message
)
print
'Status:
%
d
%
s'
%
(
code
,
message
)
...
@@ -486,25 +486,25 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
...
@@ -486,25 +486,25 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
print
'Content-Length:
%
d'
%
len
(
response
)
print
'Content-Length:
%
d'
%
len
(
response
)
print
print
print
response
print
response
def
handle_request
(
self
,
request_text
=
None
):
def
handle_request
(
self
,
request_text
=
None
):
"""Handle a single XML-RPC request passed through a CGI post method.
"""Handle a single XML-RPC request passed through a CGI post method.
If no XML data is given then it is read from stdin. The resulting
If no XML data is given then it is read from stdin. The resulting
XML-RPC response is printed to stdout along with the correct HTTP
XML-RPC response is printed to stdout along with the correct HTTP
headers.
headers.
"""
"""
if
request_text
is
None
and
\
if
request_text
is
None
and
\
os
.
environ
.
get
(
'REQUEST_METHOD'
,
None
)
==
'GET'
:
os
.
environ
.
get
(
'REQUEST_METHOD'
,
None
)
==
'GET'
:
self
.
handle_get
()
self
.
handle_get
()
else
:
else
:
# POST data is normally available through stdin
# POST data is normally available through stdin
if
request_text
is
None
:
if
request_text
is
None
:
request_text
=
sys
.
stdin
.
read
()
request_text
=
sys
.
stdin
.
read
()
self
.
handle_xmlrpc
(
request_text
)
self
.
handle_xmlrpc
(
request_text
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
server
=
SimpleXMLRPCServer
((
"localhost"
,
8000
))
server
=
SimpleXMLRPCServer
((
"localhost"
,
8000
))
server
.
register_function
(
pow
)
server
.
register_function
(
pow
)
...
...
Lib/_strptime.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -499,12 +499,12 @@ def strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
...
@@ -499,12 +499,12 @@ def strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
#populous then just inline calculations. Also might be able to use
#populous then just inline calculations. Also might be able to use
#``datetime`` and the methods it provides.
#``datetime`` and the methods it provides.
if
julian
==
-
1
:
if
julian
==
-
1
:
julian
=
julianday
(
year
,
month
,
day
)
julian
=
julianday
(
year
,
month
,
day
)
else
:
# Assuming that if they bothered to include Julian day it will
else
:
# Assuming that if they bothered to include Julian day it will
#be accurate
#be accurate
year
,
month
,
day
=
gregorian
(
julian
,
year
)
year
,
month
,
day
=
gregorian
(
julian
,
year
)
if
weekday
==
-
1
:
if
weekday
==
-
1
:
weekday
=
dayofweek
(
year
,
month
,
day
)
weekday
=
dayofweek
(
year
,
month
,
day
)
return
time
.
struct_time
((
year
,
month
,
day
,
return
time
.
struct_time
((
year
,
month
,
day
,
hour
,
minute
,
second
,
hour
,
minute
,
second
,
weekday
,
julian
,
tz
))
weekday
,
julian
,
tz
))
...
...
Lib/dummy_thread.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -4,7 +4,7 @@ Meant to be used as a brain-dead substitute so that threaded code does
...
@@ -4,7 +4,7 @@ Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.
not need to be rewritten for when the thread module is not present.
Suggested usage is::
Suggested usage is::
try:
try:
import thread
import thread
except ImportError:
except ImportError:
...
@@ -67,7 +67,7 @@ def allocate_lock():
...
@@ -67,7 +67,7 @@ def allocate_lock():
class
LockType
(
object
):
class
LockType
(
object
):
"""Class implementing dummy implementation of thread.LockType.
"""Class implementing dummy implementation of thread.LockType.
Compatibility is maintained by maintaining self.locked_status
Compatibility is maintained by maintaining self.locked_status
which is a boolean that stores the state of the lock. Pickling of
which is a boolean that stores the state of the lock. Pickling of
the lock, though, should not be done since if the thread module is
the lock, though, should not be done since if the thread module is
...
@@ -78,7 +78,7 @@ class LockType(object):
...
@@ -78,7 +78,7 @@ class LockType(object):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
locked_status
=
False
self
.
locked_status
=
False
def
acquire
(
self
,
waitflag
=
None
):
def
acquire
(
self
,
waitflag
=
None
):
"""Dummy implementation of acquire().
"""Dummy implementation of acquire().
...
@@ -92,7 +92,7 @@ class LockType(object):
...
@@ -92,7 +92,7 @@ class LockType(object):
"""
"""
if
waitflag
is
None
:
if
waitflag
is
None
:
self
.
locked_status
=
True
self
.
locked_status
=
True
return
None
return
None
elif
not
waitflag
:
elif
not
waitflag
:
if
not
self
.
locked_status
:
if
not
self
.
locked_status
:
self
.
locked_status
=
True
self
.
locked_status
=
True
...
@@ -101,7 +101,7 @@ class LockType(object):
...
@@ -101,7 +101,7 @@ class LockType(object):
return
False
return
False
else
:
else
:
self
.
locked_status
=
True
self
.
locked_status
=
True
return
True
return
True
def
release
(
self
):
def
release
(
self
):
"""Release the dummy lock."""
"""Release the dummy lock."""
...
...
Lib/macpath.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -85,10 +85,10 @@ def dirname(s): return split(s)[0]
...
@@ -85,10 +85,10 @@ def dirname(s): return split(s)[0]
def
basename
(
s
):
return
split
(
s
)[
1
]
def
basename
(
s
):
return
split
(
s
)[
1
]
def
ismount
(
s
):
def
ismount
(
s
):
if
not
isabs
(
s
):
if
not
isabs
(
s
):
return
False
return
False
components
=
split
(
s
)
components
=
split
(
s
)
return
len
(
components
)
==
2
and
components
[
1
]
==
''
return
len
(
components
)
==
2
and
components
[
1
]
==
''
def
isdir
(
s
):
def
isdir
(
s
):
"""Return true if the pathname refers to an existing directory."""
"""Return true if the pathname refers to an existing directory."""
...
...
Lib/modulefinder.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -514,9 +514,9 @@ class ModuleFinder:
...
@@ -514,9 +514,9 @@ class ModuleFinder:
if
isinstance
(
consts
[
i
],
type
(
co
)):
if
isinstance
(
consts
[
i
],
type
(
co
)):
consts
[
i
]
=
self
.
replace_paths_in_code
(
consts
[
i
])
consts
[
i
]
=
self
.
replace_paths_in_code
(
consts
[
i
])
return
new
.
code
(
co
.
co_argcount
,
co
.
co_nlocals
,
co
.
co_stacksize
,
return
new
.
code
(
co
.
co_argcount
,
co
.
co_nlocals
,
co
.
co_stacksize
,
co
.
co_flags
,
co
.
co_code
,
tuple
(
consts
),
co
.
co_names
,
co
.
co_flags
,
co
.
co_code
,
tuple
(
consts
),
co
.
co_names
,
co
.
co_varnames
,
new_filename
,
co
.
co_name
,
co
.
co_varnames
,
new_filename
,
co
.
co_name
,
co
.
co_firstlineno
,
co
.
co_lnotab
,
co
.
co_firstlineno
,
co
.
co_lnotab
,
co
.
co_freevars
,
co
.
co_cellvars
)
co
.
co_freevars
,
co
.
co_cellvars
)
...
...
Lib/os.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -415,9 +415,9 @@ else:
...
@@ -415,9 +415,9 @@ else:
environ
=
_Environ
(
environ
)
environ
=
_Environ
(
environ
)
def
getenv
(
key
,
default
=
None
):
def
getenv
(
key
,
default
=
None
):
"""Get an environment variable, return None if it doesn't exist.
"""Get an environment variable, return None if it doesn't exist.
The optional second argument can specify an alternate default."""
The optional second argument can specify an alternate default."""
return
environ
.
get
(
key
,
default
)
return
environ
.
get
(
key
,
default
)
__all__
.
append
(
"getenv"
)
__all__
.
append
(
"getenv"
)
def
_exists
(
name
):
def
_exists
(
name
):
...
...
Lib/pickletools.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -1859,10 +1859,10 @@ def dis(pickle, out=None, indentlevel=4):
...
@@ -1859,10 +1859,10 @@ def dis(pickle, out=None, indentlevel=4):
markmsg
=
None
markmsg
=
None
if
markstack
and
markobject
in
opcode
.
stack_before
:
if
markstack
and
markobject
in
opcode
.
stack_before
:
assert
markobject
not
in
opcode
.
stack_after
assert
markobject
not
in
opcode
.
stack_after
markpos
=
markstack
.
pop
()
markpos
=
markstack
.
pop
()
if
markpos
is
not
None
:
if
markpos
is
not
None
:
markmsg
=
"(MARK at
%
d)"
%
markpos
markmsg
=
"(MARK at
%
d)"
%
markpos
if
arg
is
not
None
or
markmsg
:
if
arg
is
not
None
or
markmsg
:
# make a mild effort to align arguments
# make a mild effort to align arguments
...
...
Lib/pty.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -92,8 +92,8 @@ def slave_open(tty_name):
...
@@ -92,8 +92,8 @@ def slave_open(tty_name):
except
ImportError
:
except
ImportError
:
return
result
return
result
try
:
try
:
ioctl
(
result
,
I_PUSH
,
"ptem"
)
ioctl
(
result
,
I_PUSH
,
"ptem"
)
ioctl
(
result
,
I_PUSH
,
"ldterm"
)
ioctl
(
result
,
I_PUSH
,
"ldterm"
)
except
IOError
:
except
IOError
:
pass
pass
return
result
return
result
...
...
Lib/py_compile.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -24,24 +24,24 @@ class PyCompileError(Exception):
...
@@ -24,24 +24,24 @@ class PyCompileError(Exception):
raise PyCompileError(exc_type,exc_value,file[,msg])
raise PyCompileError(exc_type,exc_value,file[,msg])
where
where
exc_type: exception type to be used in error message
exc_type: exception type to be used in error message
type name can be accesses as class variable
type name can be accesses as class variable
'exc_type_name'
'exc_type_name'
exc_value: exception value to be used in error message
exc_value: exception value to be used in error message
can be accesses as class variable 'exc_value'
can be accesses as class variable 'exc_value'
file: name of file being compiled to be used in error message
file: name of file being compiled to be used in error message
can be accesses as class variable 'file'
can be accesses as class variable 'file'
msg: string message to be written as error message
msg: string message to be written as error message
If no value is given, a default exception message will be given,
If no value is given, a default exception message will be given,
consistent with 'standard' py_compile output.
consistent with 'standard' py_compile output.
message (or default) can be accesses as class variable 'msg'
message (or default) can be accesses as class variable 'msg'
"""
"""
def
__init__
(
self
,
exc_type
,
exc_value
,
file
,
msg
=
''
):
def
__init__
(
self
,
exc_type
,
exc_value
,
file
,
msg
=
''
):
exc_type_name
=
exc_type
.
__name__
exc_type_name
=
exc_type
.
__name__
if
exc_type
is
SyntaxError
:
if
exc_type
is
SyntaxError
:
...
@@ -49,7 +49,7 @@ class PyCompileError(Exception):
...
@@ -49,7 +49,7 @@ class PyCompileError(Exception):
errmsg
=
tbtext
.
replace
(
'File "<string>"'
,
'File "
%
s"'
%
file
)
errmsg
=
tbtext
.
replace
(
'File "<string>"'
,
'File "
%
s"'
%
file
)
else
:
else
:
errmsg
=
"Sorry:
%
s:
%
s"
%
(
exc_type_name
,
exc_value
)
errmsg
=
"Sorry:
%
s:
%
s"
%
(
exc_type_name
,
exc_value
)
Exception
.
__init__
(
self
,
msg
or
errmsg
,
exc_type_name
,
exc_value
,
file
)
Exception
.
__init__
(
self
,
msg
or
errmsg
,
exc_type_name
,
exc_value
,
file
)
self
.
exc_type_name
=
exc_type_name
self
.
exc_type_name
=
exc_type_name
...
@@ -94,7 +94,7 @@ def compile(file, cfile=None, dfile=None, doraise=False):
...
@@ -94,7 +94,7 @@ def compile(file, cfile=None, dfile=None, doraise=False):
and the function will return to the caller. If an
and the function will return to the caller. If an
exception occurs and this flag is set to True, a
exception occurs and this flag is set to True, a
PyCompileError exception will be raised.
PyCompileError exception will be raised.
Note that it isn't necessary to byte-compile Python modules for
Note that it isn't necessary to byte-compile Python modules for
execution efficiency -- Python itself byte-compiles a module when
execution efficiency -- Python itself byte-compiles a module when
it is loaded, and if it can, writes out the bytecode to the
it is loaded, and if it can, writes out the bytecode to the
...
@@ -159,6 +159,6 @@ def main(args=None):
...
@@ -159,6 +159,6 @@ def main(args=None):
compile
(
filename
,
doraise
=
True
)
compile
(
filename
,
doraise
=
True
)
except
PyCompileError
,
err
:
except
PyCompileError
,
err
:
sys
.
stderr
.
write
(
err
.
msg
)
sys
.
stderr
.
write
(
err
.
msg
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
main
()
main
()
Lib/tarfile.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -1249,7 +1249,7 @@ class TarFile(object):
...
@@ -1249,7 +1249,7 @@ class TarFile(object):
if
self
.
posix
:
if
self
.
posix
:
prefix
=
tarinfo
.
name
[:
LENGTH_PREFIX
+
1
]
prefix
=
tarinfo
.
name
[:
LENGTH_PREFIX
+
1
]
while
prefix
and
prefix
[
-
1
]
!=
"/"
:
while
prefix
and
prefix
[
-
1
]
!=
"/"
:
prefix
=
prefix
[:
-
1
]
prefix
=
prefix
[:
-
1
]
name
=
tarinfo
.
name
[
len
(
prefix
):]
name
=
tarinfo
.
name
[
len
(
prefix
):]
prefix
=
prefix
[:
-
1
]
prefix
=
prefix
[:
-
1
]
...
...
setup.py
Dosyayı görüntüle @
2c60f7a1
...
@@ -74,7 +74,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
...
@@ -74,7 +74,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
return
[
p
]
return
[
p
]
else
:
else
:
assert
False
,
"Internal error: Path not found in std_dirs or paths"
assert
False
,
"Internal error: Path not found in std_dirs or paths"
def
module_enabled
(
extlist
,
modname
):
def
module_enabled
(
extlist
,
modname
):
"""Returns whether the module 'modname' is present in the list
"""Returns whether the module 'modname' is present in the list
of extensions 'extlist'."""
of extensions 'extlist'."""
...
@@ -159,7 +159,7 @@ class PyBuildExt(build_ext):
...
@@ -159,7 +159,7 @@ class PyBuildExt(build_ext):
line
=
line
.
split
()
line
=
line
.
split
()
remove_modules
.
append
(
line
[
0
]
)
remove_modules
.
append
(
line
[
0
]
)
input
.
close
()
input
.
close
()
for
ext
in
self
.
extensions
[:]:
for
ext
in
self
.
extensions
[:]:
if
ext
.
name
in
remove_modules
:
if
ext
.
name
in
remove_modules
:
self
.
extensions
.
remove
(
ext
)
self
.
extensions
.
remove
(
ext
)
...
@@ -323,7 +323,7 @@ class PyBuildExt(build_ext):
...
@@ -323,7 +323,7 @@ class PyBuildExt(build_ext):
exts
.
append
(
Extension
(
'datetime'
,
[
'datetimemodule.c'
],
exts
.
append
(
Extension
(
'datetime'
,
[
'datetimemodule.c'
],
libraries
=
math_libs
)
)
libraries
=
math_libs
)
)
# random number generator implemented in C
# random number generator implemented in C
exts
.
append
(
Extension
(
"_random"
,
[
"_randommodule.c"
])
)
exts
.
append
(
Extension
(
"_random"
,
[
"_randommodule.c"
])
)
# operator.add() and similar goodies
# operator.add() and similar goodies
exts
.
append
(
Extension
(
'operator'
,
[
'operator.c'
])
)
exts
.
append
(
Extension
(
'operator'
,
[
'operator.c'
])
)
# Python C API test module
# Python C API test module
...
@@ -347,9 +347,9 @@ class PyBuildExt(build_ext):
...
@@ -347,9 +347,9 @@ class PyBuildExt(build_ext):
exts
.
append
(
Extension
(
'fcntl'
,
[
'fcntlmodule.c'
])
)
exts
.
append
(
Extension
(
'fcntl'
,
[
'fcntlmodule.c'
])
)
if
platform
not
in
[
'mac'
]:
if
platform
not
in
[
'mac'
]:
# pwd(3)
# pwd(3)
exts
.
append
(
Extension
(
'pwd'
,
[
'pwdmodule.c'
])
)
exts
.
append
(
Extension
(
'pwd'
,
[
'pwdmodule.c'
])
)
# grp(3)
# grp(3)
exts
.
append
(
Extension
(
'grp'
,
[
'grpmodule.c'
])
)
exts
.
append
(
Extension
(
'grp'
,
[
'grpmodule.c'
])
)
# select(2); not on ancient System V
# select(2); not on ancient System V
exts
.
append
(
Extension
(
'select'
,
[
'selectmodule.c'
])
)
exts
.
append
(
Extension
(
'select'
,
[
'selectmodule.c'
])
)
...
@@ -380,8 +380,8 @@ class PyBuildExt(build_ext):
...
@@ -380,8 +380,8 @@ class PyBuildExt(build_ext):
# enigma-inspired encryption
# enigma-inspired encryption
exts
.
append
(
Extension
(
'rotor'
,
[
'rotormodule.c'
])
)
exts
.
append
(
Extension
(
'rotor'
,
[
'rotormodule.c'
])
)
if
platform
not
in
[
'mac'
]:
if
platform
not
in
[
'mac'
]:
# syslog daemon interface
# syslog daemon interface
exts
.
append
(
Extension
(
'syslog'
,
[
'syslogmodule.c'
])
)
exts
.
append
(
Extension
(
'syslog'
,
[
'syslogmodule.c'
])
)
# George Neville-Neil's timing module:
# George Neville-Neil's timing module:
exts
.
append
(
Extension
(
'timing'
,
[
'timingmodule.c'
])
)
exts
.
append
(
Extension
(
'timing'
,
[
'timingmodule.c'
])
)
...
@@ -419,12 +419,12 @@ class PyBuildExt(build_ext):
...
@@ -419,12 +419,12 @@ class PyBuildExt(build_ext):
libraries
=
readline_libs
)
)
libraries
=
readline_libs
)
)
if
platform
not
in
[
'mac'
]:
if
platform
not
in
[
'mac'
]:
# crypt module.
# crypt module.
if
self
.
compiler
.
find_library_file
(
lib_dirs
,
'crypt'
):
if
self
.
compiler
.
find_library_file
(
lib_dirs
,
'crypt'
):
libs
=
[
'crypt'
]
libs
=
[
'crypt'
]
else
:
else
:
libs
=
[]
libs
=
[]
exts
.
append
(
Extension
(
'crypt'
,
[
'cryptmodule.c'
],
libraries
=
libs
)
)
exts
.
append
(
Extension
(
'crypt'
,
[
'cryptmodule.c'
],
libraries
=
libs
)
)
# socket(2)
# socket(2)
exts
.
append
(
Extension
(
'_socket'
,
[
'socketmodule.c'
],
exts
.
append
(
Extension
(
'_socket'
,
[
'socketmodule.c'
],
...
@@ -501,7 +501,7 @@ class PyBuildExt(build_ext):
...
@@ -501,7 +501,7 @@ class PyBuildExt(build_ext):
db_search_order
=
db_try_this
.
keys
()
db_search_order
=
db_try_this
.
keys
()
db_search_order
.
sort
()
db_search_order
.
sort
()
db_search_order
.
reverse
()
db_search_order
.
reverse
()
class
found
(
Exception
):
pass
class
found
(
Exception
):
pass
try
:
try
:
# See whether there is a Sleepycat header in the standard
# See whether there is a Sleepycat header in the standard
...
@@ -602,7 +602,7 @@ class PyBuildExt(build_ext):
...
@@ -602,7 +602,7 @@ class PyBuildExt(build_ext):
# Steen Lumholt's termios module
# Steen Lumholt's termios module
exts
.
append
(
Extension
(
'termios'
,
[
'termios.c'
])
)
exts
.
append
(
Extension
(
'termios'
,
[
'termios.c'
])
)
# Jeremy Hylton's rlimit interface
# Jeremy Hylton's rlimit interface
if
platform
not
in
[
'atheos'
]:
if
platform
not
in
[
'atheos'
]:
exts
.
append
(
Extension
(
'resource'
,
[
'resource.c'
])
)
exts
.
append
(
Extension
(
'resource'
,
[
'resource.c'
])
)
# Sun yellow pages. Some systems have the functions in libc.
# Sun yellow pages. Some systems have the functions in libc.
...
@@ -625,7 +625,7 @@ class PyBuildExt(build_ext):
...
@@ -625,7 +625,7 @@ class PyBuildExt(build_ext):
iconv_libraries
=
[
'iconv'
]
iconv_libraries
=
[
'iconv'
]
else
:
else
:
iconv_libraries
=
[]
# in libc
iconv_libraries
=
[]
# in libc
exts
.
append
(
Extension
(
'_iconv_codec'
,
exts
.
append
(
Extension
(
'_iconv_codec'
,
[
'_iconv_codec.c'
],
[
'_iconv_codec.c'
],
include_dirs
=
iconv_incs
,
include_dirs
=
iconv_incs
,
...
@@ -726,7 +726,7 @@ class PyBuildExt(build_ext):
...
@@ -726,7 +726,7 @@ class PyBuildExt(build_ext):
(
'XML_CONTEXT_BYTES'
,
'1024'
),
(
'XML_CONTEXT_BYTES'
,
'1024'
),
],
],
include_dirs
=
[
expatinc
]
include_dirs
=
[
expatinc
]
))
))
# Dynamic loading module
# Dynamic loading module
if
sys
.
maxint
==
0x7fffffff
:
if
sys
.
maxint
==
0x7fffffff
:
...
@@ -821,7 +821,7 @@ class PyBuildExt(build_ext):
...
@@ -821,7 +821,7 @@ class PyBuildExt(build_ext):
# should put a symlink to your Waste installation in the
# should put a symlink to your Waste installation in the
# same folder as your python source tree. Or modify the
# same folder as your python source tree. Or modify the
# next few lines:-)
# next few lines:-)
waste_incs
=
find_file
(
"WASTE.h"
,
[],
waste_incs
=
find_file
(
"WASTE.h"
,
[],
[
'../'
*
n
+
'waste/C_C++ Headers'
for
n
in
(
0
,
1
,
2
,
3
,
4
)])
[
'../'
*
n
+
'waste/C_C++ Headers'
for
n
in
(
0
,
1
,
2
,
3
,
4
)])
waste_libs
=
find_library_file
(
self
.
compiler
,
"WASTE"
,
[],
waste_libs
=
find_library_file
(
self
.
compiler
,
"WASTE"
,
[],
[
"../"
*
n
+
"waste/Static Libraries"
for
n
in
(
0
,
1
,
2
,
3
,
4
)])
[
"../"
*
n
+
"waste/Static Libraries"
for
n
in
(
0
,
1
,
2
,
3
,
4
)])
...
@@ -829,7 +829,7 @@ class PyBuildExt(build_ext):
...
@@ -829,7 +829,7 @@ class PyBuildExt(build_ext):
(
srcdir
,)
=
sysconfig
.
get_config_vars
(
'srcdir'
)
(
srcdir
,)
=
sysconfig
.
get_config_vars
(
'srcdir'
)
exts
.
append
(
Extension
(
'waste'
,
exts
.
append
(
Extension
(
'waste'
,
[
'waste/wastemodule.c'
]
+
[
[
'waste/wastemodule.c'
]
+
[
os
.
path
.
join
(
srcdir
,
d
)
for
d
in
os
.
path
.
join
(
srcdir
,
d
)
for
d
in
'Mac/Wastemods/WEObjectHandlers.c'
,
'Mac/Wastemods/WEObjectHandlers.c'
,
'Mac/Wastemods/WETabHooks.c'
,
'Mac/Wastemods/WETabHooks.c'
,
'Mac/Wastemods/WETabs.c'
'Mac/Wastemods/WETabs.c'
...
@@ -852,8 +852,8 @@ class PyBuildExt(build_ext):
...
@@ -852,8 +852,8 @@ class PyBuildExt(build_ext):
# different the UNIX search logic is not sharable.
# different the UNIX search logic is not sharable.
from
os.path
import
join
,
exists
from
os.path
import
join
,
exists
framework_dirs
=
[
framework_dirs
=
[
'/System/Library/Frameworks/'
,
'/System/Library/Frameworks/'
,
'/Library/Frameworks'
,
'/Library/Frameworks'
,
join
(
os
.
getenv
(
'HOME'
),
'/Library/Frameworks'
)
join
(
os
.
getenv
(
'HOME'
),
'/Library/Frameworks'
)
]
]
...
@@ -861,9 +861,9 @@ class PyBuildExt(build_ext):
...
@@ -861,9 +861,9 @@ class PyBuildExt(build_ext):
# bundles.
# bundles.
# XXX distutils should support -F!
# XXX distutils should support -F!
for
F
in
framework_dirs
:
for
F
in
framework_dirs
:
# both Tcl.framework and Tk.framework should be present
# both Tcl.framework and Tk.framework should be present
for
fw
in
'Tcl'
,
'Tk'
:
for
fw
in
'Tcl'
,
'Tk'
:
if
not
exists
(
join
(
F
,
fw
+
'.framework'
)):
if
not
exists
(
join
(
F
,
fw
+
'.framework'
)):
break
break
else
:
else
:
# ok, F is now directory with both frameworks. Continure
# ok, F is now directory with both frameworks. Continure
...
@@ -873,18 +873,18 @@ class PyBuildExt(build_ext):
...
@@ -873,18 +873,18 @@ class PyBuildExt(build_ext):
# Tk and Tcl frameworks not found. Normal "unix" tkinter search
# Tk and Tcl frameworks not found. Normal "unix" tkinter search
# will now resume.
# will now resume.
return
0
return
0
# For 8.4a2, we must add -I options that point inside the Tcl and Tk
# For 8.4a2, we must add -I options that point inside the Tcl and Tk
# frameworks. In later release we should hopefully be able to pass
# frameworks. In later release we should hopefully be able to pass
# the -F option to gcc, which specifies a framework lookup path.
# the -F option to gcc, which specifies a framework lookup path.
#
#
include_dirs
=
[
include_dirs
=
[
join
(
F
,
fw
+
'.framework'
,
H
)
join
(
F
,
fw
+
'.framework'
,
H
)
for
fw
in
'Tcl'
,
'Tk'
for
fw
in
'Tcl'
,
'Tk'
for
H
in
'Headers'
,
'Versions/Current/PrivateHeaders'
for
H
in
'Headers'
,
'Versions/Current/PrivateHeaders'
]
]
# For 8.4a2, the X11 headers are not included. Rather than include a
# For 8.4a2, the X11 headers are not included. Rather than include a
# complicated search, this is a hard-coded path. It could bail out
# complicated search, this is a hard-coded path. It could bail out
# if X11 libs are not found...
# if X11 libs are not found...
include_dirs
.
append
(
'/usr/X11R6/include'
)
include_dirs
.
append
(
'/usr/X11R6/include'
)
...
@@ -900,7 +900,7 @@ class PyBuildExt(build_ext):
...
@@ -900,7 +900,7 @@ class PyBuildExt(build_ext):
self
.
extensions
.
append
(
ext
)
self
.
extensions
.
append
(
ext
)
return
1
return
1
def
detect_tkinter
(
self
,
inc_dirs
,
lib_dirs
):
def
detect_tkinter
(
self
,
inc_dirs
,
lib_dirs
):
# The _tkinter module.
# The _tkinter module.
...
@@ -910,7 +910,7 @@ class PyBuildExt(build_ext):
...
@@ -910,7 +910,7 @@ class PyBuildExt(build_ext):
platform
=
self
.
get_platform
()
platform
=
self
.
get_platform
()
if
platform
==
'darwin'
and
\
if
platform
==
'darwin'
and
\
self
.
detect_tkinter_darwin
(
inc_dirs
,
lib_dirs
):
self
.
detect_tkinter_darwin
(
inc_dirs
,
lib_dirs
):
return
return
# Set platform specific library prefix, if any
# Set platform specific library prefix, if any
if
platform
==
'cygwin'
:
if
platform
==
'cygwin'
:
...
...
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