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
bfc88c2e
Commit
bfc88c2e
authored
Apr 07, 2002
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partial introduction of bools where appropriate.
parent
8efae3ac
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
96 additions
and
94 deletions
+96
-94
Lib/CGIHTTPServer.py
Lib/CGIHTTPServer.py
+1
-1
Lib/StringIO.py
Lib/StringIO.py
+1
-1
Lib/chunk.py
Lib/chunk.py
+10
-10
Lib/dospath.py
Lib/dospath.py
+1
-1
Lib/fileinput.py
Lib/fileinput.py
+4
-4
Lib/gzip.py
Lib/gzip.py
+11
-11
Lib/macpath.py
Lib/macpath.py
+2
-2
Lib/ntpath.py
Lib/ntpath.py
+3
-3
Lib/os2emxpath.py
Lib/os2emxpath.py
+3
-3
Lib/posixpath.py
Lib/posixpath.py
+4
-4
Lib/pprint.py
Lib/pprint.py
+21
-21
Lib/pydoc.py
Lib/pydoc.py
+5
-4
Lib/rfc822.py
Lib/rfc822.py
+1
-1
Lib/sre_parse.py
Lib/sre_parse.py
+3
-3
Lib/statcache.py
Lib/statcache.py
+1
-1
Lib/threading.py
Lib/threading.py
+19
-19
Lib/urllib2.py
Lib/urllib2.py
+4
-4
Lib/zipfile.py
Lib/zipfile.py
+2
-1
No files found.
Lib/CGIHTTPServer.py
View file @
bfc88c2e
...
...
@@ -307,7 +307,7 @@ def executable(path):
try
:
st
=
os
.
stat
(
path
)
except
os
.
error
:
return
0
return
False
return
st
[
0
]
&
0111
!=
0
...
...
Lib/StringIO.py
View file @
bfc88c2e
...
...
@@ -59,7 +59,7 @@ class StringIO:
def
isatty
(
self
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
return
0
return
False
def
seek
(
self
,
pos
,
mode
=
0
):
if
self
.
closed
:
...
...
Lib/chunk.py
View file @
bfc88c2e
...
...
@@ -25,13 +25,13 @@ of the file, creating a new instance will fail with a EOFError
exception.
Usage:
while
1
:
while
True
:
try:
chunk = Chunk(file)
except EOFError:
break
chunktype = chunk.getname()
while
1
:
while
True
:
data = chunk.read(nbytes)
if not data:
pass
...
...
@@ -49,9 +49,9 @@ default is 1, i.e. aligned.
"""
class
Chunk
:
def
__init__
(
self
,
file
,
align
=
1
,
bigendian
=
1
,
inclheader
=
0
):
def
__init__
(
self
,
file
,
align
=
True
,
bigendian
=
True
,
inclheader
=
False
):
import
struct
self
.
closed
=
0
self
.
closed
=
False
self
.
align
=
align
# whether to align to word (2-byte) boundaries
if
bigendian
:
strflag
=
'>'
...
...
@@ -71,9 +71,9 @@ class Chunk:
try
:
self
.
offset
=
self
.
file
.
tell
()
except
(
AttributeError
,
IOError
):
self
.
seekable
=
0
self
.
seekable
=
False
else
:
self
.
seekable
=
1
self
.
seekable
=
True
def
getname
(
self
):
"""Return the name (ID) of the current chunk."""
...
...
@@ -86,14 +86,14 @@ class Chunk:
def
close
(
self
):
if
not
self
.
closed
:
self
.
skip
()
self
.
closed
=
1
self
.
closed
=
True
def
isatty
(
self
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
return
0
return
False
def
seek
(
self
,
pos
,
whence
=
0
):
def
seek
(
self
,
pos
,
whence
=
0
):
"""Seek to specified position into the chunk.
Default position is 0 (start of chunk).
If the file is not seekable, this will result in an error.
...
...
@@ -117,7 +117,7 @@ class Chunk:
raise
ValueError
,
"I/O operation on closed file"
return
self
.
size_read
def
read
(
self
,
size
=
-
1
):
def
read
(
self
,
size
=
-
1
):
"""Read at most size bytes from the chunk.
If size is omitted or negative, read until the end
of the chunk.
...
...
Lib/dospath.py
View file @
bfc88c2e
...
...
@@ -141,7 +141,7 @@ def islink(path):
"""Is a path a symbolic link?
This will always return false on systems where posix.lstat doesn't exist."""
return
0
return
False
def
exists
(
path
):
...
...
Lib/fileinput.py
View file @
bfc88c2e
...
...
@@ -154,7 +154,7 @@ class FileInput:
self
.
_lineno
=
0
self
.
_filelineno
=
0
self
.
_file
=
None
self
.
_isstdin
=
0
self
.
_isstdin
=
False
self
.
_backupfilename
=
None
self
.
_buffer
=
[]
self
.
_bufindex
=
0
...
...
@@ -214,7 +214,7 @@ class FileInput:
try
:
os
.
unlink
(
backupfilename
)
except
:
pass
self
.
_isstdin
=
0
self
.
_isstdin
=
False
self
.
_buffer
=
[]
self
.
_bufindex
=
0
...
...
@@ -235,12 +235,12 @@ class FileInput:
self
.
_files
=
self
.
_files
[
1
:]
self
.
_filelineno
=
0
self
.
_file
=
None
self
.
_isstdin
=
0
self
.
_isstdin
=
False
self
.
_backupfilename
=
0
if
self
.
_filename
==
'-'
:
self
.
_filename
=
'<stdin>'
self
.
_file
=
sys
.
stdin
self
.
_isstdin
=
1
self
.
_isstdin
=
True
else
:
if
self
.
_inplace
:
self
.
_backupfilename
=
(
...
...
Lib/gzip.py
View file @
bfc88c2e
...
...
@@ -47,7 +47,7 @@ class GzipFile:
if
mode
[
0
:
1
]
==
'r'
:
self
.
mode
=
READ
# Set flag indicating start of a new member
self
.
_new_member
=
1
self
.
_new_member
=
True
self
.
extrabuf
=
""
self
.
extrasize
=
0
self
.
filename
=
filename
...
...
@@ -120,12 +120,12 @@ class GzipFile:
self
.
fileobj
.
read
(
xlen
)
if
flag
&
FNAME
:
# Read and discard a null-terminated string containing the filename
while
(
1
)
:
while
True
:
s
=
self
.
fileobj
.
read
(
1
)
if
not
s
or
s
==
'
\
000
'
:
break
if
flag
&
FCOMMENT
:
# Read and discard a null-terminated string containing a comment
while
(
1
)
:
while
True
:
s
=
self
.
fileobj
.
read
(
1
)
if
not
s
or
s
==
'
\
000
'
:
break
if
flag
&
FHCRC
:
...
...
@@ -156,7 +156,7 @@ class GzipFile:
readsize
=
1024
if
size
<
0
:
# get the whole thing
try
:
while
1
:
while
True
:
self
.
_read
(
readsize
)
readsize
=
readsize
*
2
except
EOFError
:
...
...
@@ -201,7 +201,7 @@ class GzipFile:
self
.
_init_read
()
self
.
_read_gzip_header
()
self
.
decompress
=
zlib
.
decompressobj
(
-
zlib
.
MAX_WBITS
)
self
.
_new_member
=
0
self
.
_new_member
=
False
# Read a chunk of data from the file
buf
=
self
.
fileobj
.
read
(
size
)
...
...
@@ -229,7 +229,7 @@ class GzipFile:
# Check the CRC and file size, and set the flag so we read
# a new member on the next call
self
.
_read_eof
()
self
.
_new_member
=
1
self
.
_new_member
=
True
def
_add_read_data
(
self
,
data
):
self
.
crc
=
zlib
.
crc32
(
data
,
self
.
crc
)
...
...
@@ -275,7 +275,7 @@ class GzipFile:
self
.
fileobj
.
flush
()
def
isatty
(
self
):
return
0
return
False
def
tell
(
self
):
return
self
.
offset
...
...
@@ -286,7 +286,7 @@ class GzipFile:
if
self
.
mode
!=
READ
:
raise
IOError
(
"Can't rewind in write mode"
)
self
.
fileobj
.
seek
(
0
)
self
.
_new_member
=
1
self
.
_new_member
=
True
self
.
extrabuf
=
""
self
.
extrasize
=
0
self
.
offset
=
0
...
...
@@ -311,7 +311,7 @@ class GzipFile:
if
size
<
0
:
size
=
sys
.
maxint
bufs
=
[]
readsize
=
min
(
100
,
size
)
# Read from the file in small chunks
while
1
:
while
True
:
if
size
==
0
:
return
""
.
join
(
bufs
)
# Return resulting line
...
...
@@ -342,7 +342,7 @@ class GzipFile:
while
sizehint
>
0
:
line
=
self
.
readline
()
if
line
==
""
:
break
L
.
append
(
line
)
L
.
append
(
line
)
sizehint
=
sizehint
-
len
(
line
)
return
L
...
...
@@ -390,7 +390,7 @@ def _test():
else
:
f
=
__builtin__
.
open
(
arg
,
"rb"
)
g
=
open
(
arg
+
".gz"
,
"wb"
)
while
1
:
while
True
:
chunk
=
f
.
read
(
1024
)
if
not
chunk
:
break
...
...
Lib/macpath.py
View file @
bfc88c2e
...
...
@@ -125,7 +125,7 @@ def islink(s):
"""Return true if the pathname refers to a symbolic link.
Always false on the Mac, until we understand Aliases.)"""
return
0
return
False
def
isfile
(
s
):
...
...
@@ -134,7 +134,7 @@ def isfile(s):
try
:
st
=
os
.
stat
(
s
)
except
os
.
error
:
return
0
return
False
return
S_ISREG
(
st
[
ST_MODE
])
...
...
Lib/ntpath.py
View file @
bfc88c2e
...
...
@@ -235,7 +235,7 @@ def getatime(filename):
def
islink
(
path
):
"""Test for symbolic link. On WindowsNT/95 always returns false"""
return
0
return
False
# Does a path exist?
...
...
@@ -259,7 +259,7 @@ def isdir(path):
try
:
st
=
os
.
stat
(
path
)
except
os
.
error
:
return
0
return
False
return
stat
.
S_ISDIR
(
st
[
stat
.
ST_MODE
])
...
...
@@ -272,7 +272,7 @@ def isfile(path):
try
:
st
=
os
.
stat
(
path
)
except
os
.
error
:
return
0
return
False
return
stat
.
S_ISREG
(
st
[
stat
.
ST_MODE
])
...
...
Lib/os2emxpath.py
View file @
bfc88c2e
...
...
@@ -194,7 +194,7 @@ def getatime(filename):
def
islink
(
path
):
"""Test for symbolic link. On OS/2 always returns false"""
return
0
return
False
# Does a path exist?
...
...
@@ -216,7 +216,7 @@ def isdir(path):
try
:
st
=
os
.
stat
(
path
)
except
os
.
error
:
return
0
return
False
return
stat
.
S_ISDIR
(
st
[
stat
.
ST_MODE
])
...
...
@@ -229,7 +229,7 @@ def isfile(path):
try
:
st
=
os
.
stat
(
path
)
except
os
.
error
:
return
0
return
False
return
stat
.
S_ISREG
(
st
[
stat
.
ST_MODE
])
...
...
Lib/posixpath.py
View file @
bfc88c2e
...
...
@@ -158,7 +158,7 @@ def islink(path):
try
:
st
=
os
.
lstat
(
path
)
except
(
os
.
error
,
AttributeError
):
return
0
return
False
return
stat
.
S_ISLNK
(
st
[
stat
.
ST_MODE
])
...
...
@@ -183,7 +183,7 @@ def isdir(path):
try
:
st
=
os
.
stat
(
path
)
except
os
.
error
:
return
0
return
False
return
stat
.
S_ISDIR
(
st
[
stat
.
ST_MODE
])
...
...
@@ -196,7 +196,7 @@ def isfile(path):
try
:
st
=
os
.
stat
(
path
)
except
os
.
error
:
return
0
return
False
return
stat
.
S_ISREG
(
st
[
stat
.
ST_MODE
])
...
...
@@ -335,7 +335,7 @@ def expandvars(path):
import
re
_varprog
=
re
.
compile
(
r'\
$(
\w+|\
{[^}]*
\})'
)
i
=
0
while
1
:
while
True
:
m
=
_varprog
.
search
(
path
,
i
)
if
not
m
:
break
...
...
Lib/pprint.py
View file @
bfc88c2e
...
...
@@ -126,8 +126,8 @@ class PrettyPrinter:
objid
=
_id
(
object
)
if
objid
in
context
:
stream
.
write
(
_recursion
(
object
))
self
.
__recursive
=
1
self
.
__readable
=
0
self
.
__recursive
=
True
self
.
__readable
=
False
return
rep
=
self
.
__repr
(
object
,
context
,
level
-
1
)
typ
=
_type
(
object
)
...
...
@@ -195,9 +195,9 @@ class PrettyPrinter:
repr
,
readable
,
recursive
=
self
.
format
(
object
,
context
.
copy
(),
self
.
__depth
,
level
)
if
not
readable
:
self
.
__readable
=
0
self
.
__readable
=
False
if
recursive
:
self
.
__recursive
=
1
self
.
__recursive
=
True
return
repr
def
format
(
self
,
object
,
context
,
maxlevels
,
level
):
...
...
@@ -214,7 +214,7 @@ def _safe_repr(object, context, maxlevels, level):
typ
=
_type
(
object
)
if
typ
is
StringType
:
if
'locale'
not
in
_sys_modules
:
return
`object`
,
1
,
0
return
`object`
,
True
,
False
if
"'"
in
object
and
'"'
not
in
object
:
closure
=
'"'
quotes
=
{
'"'
:
'
\
\
"'
}
...
...
@@ -229,19 +229,19 @@ def _safe_repr(object, context, maxlevels, level):
write
(
char
)
else
:
write
(
qget
(
char
,
`char`
[
1
:
-
1
]))
return
(
"%s%s%s"
%
(
closure
,
sio
.
getvalue
(),
closure
)),
1
,
0
return
(
"%s%s%s"
%
(
closure
,
sio
.
getvalue
(),
closure
)),
True
,
False
if
typ
is
DictType
:
if
not
object
:
return
"{}"
,
1
,
0
return
"{}"
,
True
,
False
objid
=
_id
(
object
)
if
maxlevels
and
level
>
maxlevels
:
return
"{...}"
,
0
,
objid
in
context
return
"{...}"
,
False
,
objid
in
context
if
objid
in
context
:
return
_recursion
(
object
),
0
,
1
return
_recursion
(
object
),
False
,
True
context
[
objid
]
=
1
readable
=
1
recursive
=
0
readable
=
True
recursive
=
False
components
=
[]
append
=
components
.
append
level
+=
1
...
...
@@ -252,29 +252,29 @@ def _safe_repr(object, context, maxlevels, level):
append
(
"%s: %s"
%
(
krepr
,
vrepr
))
readable
=
readable
and
kreadable
and
vreadable
if
krecur
or
vrecur
:
recursive
=
1
recursive
=
True
del
context
[
objid
]
return
"{%s}"
%
_commajoin
(
components
),
readable
,
recursive
if
typ
is
ListType
or
typ
is
TupleType
:
if
typ
is
ListType
:
if
not
object
:
return
"[]"
,
1
,
0
return
"[]"
,
True
,
False
format
=
"[%s]"
elif
_len
(
object
)
==
1
:
format
=
"(%s,)"
else
:
if
not
object
:
return
"()"
,
1
,
0
return
"()"
,
True
,
False
format
=
"(%s)"
objid
=
_id
(
object
)
if
maxlevels
and
level
>
maxlevels
:
return
format
%
"..."
,
0
,
objid
in
context
return
format
%
"..."
,
False
,
objid
in
context
if
objid
in
context
:
return
_recursion
(
object
),
0
,
1
return
_recursion
(
object
),
False
,
True
context
[
objid
]
=
1
readable
=
1
recursive
=
0
readable
=
True
recursive
=
False
components
=
[]
append
=
components
.
append
level
+=
1
...
...
@@ -282,14 +282,14 @@ def _safe_repr(object, context, maxlevels, level):
orepr
,
oreadable
,
orecur
=
_safe_repr
(
o
,
context
,
maxlevels
,
level
)
append
(
orepr
)
if
not
oreadable
:
readable
=
0
readable
=
False
if
orecur
:
recursive
=
1
recursive
=
True
del
context
[
objid
]
return
format
%
_commajoin
(
components
),
readable
,
recursive
rep
=
`object`
return
rep
,
(
rep
and
not
rep
.
startswith
(
'<'
)),
0
return
rep
,
(
rep
and
not
rep
.
startswith
(
'<'
)),
False
def
_recursion
(
object
):
...
...
Lib/pydoc.py
View file @
bfc88c2e
...
...
@@ -443,7 +443,7 @@ TT { font-family: lucidatypewriter, lucida console, courier }
r'RFC[- ]?(\
d+)|
'
r'
PEP
[
-
]
?
(
\
d
+
)
|
'
r'
(
self
\
.)
?
(
\
w
+
))
')
while
1
:
while
True
:
match = pattern.search(text, here)
if not match: break
start, end = match.span()
...
...
@@ -1521,7 +1521,7 @@ has the same effect as typing a particular string at the help> prompt.
def
interact
(
self
):
self
.
output
.
write
(
'
\
n
'
)
while
1
:
while
True
:
self
.
output
.
write
(
'help> '
)
self
.
output
.
flush
()
try
:
...
...
@@ -1710,10 +1710,11 @@ class ModuleScanner(Scanner):
if
not
(
os
.
path
.
islink
(
dir
)
and
inode
in
self
.
inodes
):
self
.
inodes
.
append
(
inode
)
# detect circular symbolic links
return
ispackage
(
dir
)
return
False
def
run
(
self
,
callback
,
key
=
None
,
completer
=
None
):
if
key
:
key
=
lower
(
key
)
self
.
quit
=
0
self
.
quit
=
False
seen
=
{}
for
modname
in
sys
.
builtin_module_names
:
...
...
@@ -1825,7 +1826,7 @@ pydoc</strong> by Ka-Ping Yee <ping@lfw.org></font>'''
def
serve_until_quit
(
self
):
import
select
self
.
quit
=
0
self
.
quit
=
False
while
not
self
.
quit
:
rd
,
wr
,
ex
=
select
.
select
([
self
.
socket
.
fileno
()],
[],
[],
1
)
if
rd
:
self
.
handle_request
()
...
...
Lib/rfc822.py
View file @
bfc88c2e
...
...
@@ -222,7 +222,7 @@ class Message:
data in RFC 2822-like formats that support embedded comments or
free-text data.
"""
return
Non
e
return
Fals
e
def
getallmatchingheaders
(
self
,
name
):
"""Find all header lines matching a given header name.
...
...
Lib/sre_parse.py
View file @
bfc88c2e
...
...
@@ -221,11 +221,11 @@ def isdigit(char):
def isname(name):
# check that group name is a valid string
if not isident(name[0]):
return
0
return
False
for char in name:
if not isident(char) and not isdigit(char):
return
0
return
1
return
False
return
True
def _group(escape, groups):
# check if the escape string represents a valid group
...
...
Lib/statcache.py
View file @
bfc88c2e
...
...
@@ -73,5 +73,5 @@ def isdir(path):
try
:
st
=
stat
(
path
)
except
_os
.
error
:
return
0
return
False
return
S_ISDIR
(
st
[
ST_MODE
])
Lib/threading.py
View file @
bfc88c2e
...
...
@@ -30,7 +30,7 @@ del StringIO
# Debug support (adapted from ihooks.py)
_VERBOSE
=
0
_VERBOSE
=
0
# XXX Bool or int?
if
__debug__
:
...
...
@@ -198,7 +198,7 @@ class _Condition(_Verbose):
# than 20 times per second (or the timeout time remaining).
endtime
=
_time
()
+
timeout
delay
=
0.0005
# 500 us -> initial delay of 1 ms
while
1
:
while
True
:
gotit
=
waiter
.
acquire
(
0
)
if
gotit
:
break
...
...
@@ -256,7 +256,7 @@ class _Semaphore(_Verbose):
self
.
__value
=
value
def
acquire
(
self
,
blocking
=
1
):
rc
=
0
rc
=
False
self
.
__cond
.
acquire
()
while
self
.
__value
==
0
:
if
not
blocking
:
...
...
@@ -270,7 +270,7 @@ class _Semaphore(_Verbose):
if
__debug__
:
self
.
_note
(
"%s.acquire: success, value=%s"
,
self
,
self
.
__value
)
rc
=
1
rc
=
True
self
.
__cond
.
release
()
return
rc
...
...
@@ -309,20 +309,20 @@ class _Event(_Verbose):
def
__init__
(
self
,
verbose
=
None
):
_Verbose
.
__init__
(
self
,
verbose
)
self
.
__cond
=
Condition
(
Lock
())
self
.
__flag
=
0
self
.
__flag
=
False
def
isSet
(
self
):
return
self
.
__flag
def
set
(
self
):
self
.
__cond
.
acquire
()
self
.
__flag
=
1
self
.
__flag
=
True
self
.
__cond
.
notifyAll
()
self
.
__cond
.
release
()
def
clear
(
self
):
self
.
__cond
.
acquire
()
self
.
__flag
=
0
self
.
__flag
=
False
self
.
__cond
.
release
()
def
wait
(
self
,
timeout
=
None
):
...
...
@@ -348,7 +348,7 @@ _limbo = {}
class
Thread
(
_Verbose
):
__initialized
=
0
__initialized
=
False
def
__init__
(
self
,
group
=
None
,
target
=
None
,
name
=
None
,
args
=
(),
kwargs
=
{},
verbose
=
None
):
...
...
@@ -359,10 +359,10 @@ class Thread(_Verbose):
self
.
__args
=
args
self
.
__kwargs
=
kwargs
self
.
__daemonic
=
self
.
_set_daemon
()
self
.
__started
=
0
self
.
__stopped
=
0
self
.
__started
=
False
self
.
__stopped
=
False
self
.
__block
=
Condition
(
Lock
())
self
.
__initialized
=
1
self
.
__initialized
=
True
def
_set_daemon
(
self
):
# Overridden in _MainThread and _DummyThread
...
...
@@ -388,7 +388,7 @@ class Thread(_Verbose):
_limbo
[
self
]
=
self
_active_limbo_lock
.
release
()
_start_new_thread
(
self
.
__bootstrap
,
())
self
.
__started
=
1
self
.
__started
=
True
_sleep
(
0.000001
)
# 1 usec, to let the thread run (Solaris hack)
def
run
(
self
):
...
...
@@ -397,7 +397,7 @@ class Thread(_Verbose):
def
__bootstrap
(
self
):
try
:
self
.
__started
=
1
self
.
__started
=
True
_active_limbo_lock
.
acquire
()
_active
[
_get_ident
()]
=
self
del
_limbo
[
self
]
...
...
@@ -428,7 +428,7 @@ class Thread(_Verbose):
def
__stop
(
self
):
self
.
__block
.
acquire
()
self
.
__stopped
=
1
self
.
__stopped
=
True
self
.
__block
.
notifyAll
()
self
.
__block
.
release
()
...
...
@@ -523,7 +523,7 @@ class _MainThread(Thread):
def
__init__
(
self
):
Thread
.
__init__
(
self
,
name
=
"MainThread"
)
self
.
_Thread__started
=
1
self
.
_Thread__started
=
True
_active_limbo_lock
.
acquire
()
_active
[
_get_ident
()]
=
self
_active_limbo_lock
.
release
()
...
...
@@ -531,7 +531,7 @@ class _MainThread(Thread):
atexit
.
register
(
self
.
__exitfunc
)
def
_set_daemon
(
self
):
return
0
return
False
def
__exitfunc
(
self
):
self
.
_Thread__stop
()
...
...
@@ -564,16 +564,16 @@ class _DummyThread(Thread):
def
__init__
(
self
):
Thread
.
__init__
(
self
,
name
=
_newname
(
"Dummy-%d"
))
self
.
_Thread__started
=
1
self
.
_Thread__started
=
True
_active_limbo_lock
.
acquire
()
_active
[
_get_ident
()]
=
self
_active_limbo_lock
.
release
()
def
_set_daemon
(
self
):
return
1
return
True
def
join
(
self
,
timeout
=
None
):
assert
0
,
"cannot join a dummy thread"
assert
False
,
"cannot join a dummy thread"
# Global API functions
...
...
Lib/urllib2.py
View file @
bfc88c2e
...
...
@@ -546,13 +546,13 @@ class HTTPPasswordMgr:
Both args must be URIs in reduced form.
"""
if
base
==
test
:
return
1
return
True
if
base
[
0
]
!=
test
[
0
]:
return
0
return
False
common
=
posixpath
.
commonprefix
((
base
[
1
],
test
[
1
]))
if
len
(
common
)
==
len
(
base
[
1
]):
return
1
return
0
return
True
return
False
class
HTTPPasswordMgrWithDefaultRealm
(
HTTPPasswordMgr
):
...
...
Lib/zipfile.py
View file @
bfc88c2e
...
...
@@ -83,9 +83,10 @@ def is_zipfile(filename):
endrec
=
fpin
.
read
()
fpin
.
close
()
if
endrec
[
0
:
4
]
==
"PK
\
005
\
006
"
and
endrec
[
-
2
:]
==
"
\
000
\
000
"
:
return
1
# file has correct magic number
return
True
# file has correct magic number
except
IOError
:
pass
return
False
class
ZipInfo
:
...
...
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