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
cefa9172
Commit
cefa9172
authored
Jun 14, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #27238: Got rid of bare excepts in the turtle module. Original patch
by Jelle Zijlstra.
parent
fcbe337f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
Lib/turtle.py
Lib/turtle.py
+9
-9
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/turtle.py
View file @
cefa9172
...
@@ -179,7 +179,7 @@ def config_dict(filename):
...
@@ -179,7 +179,7 @@ def config_dict(filename):
continue
continue
try
:
try
:
key
,
value
=
line
.
split
(
"="
)
key
,
value
=
line
.
split
(
"="
)
except
:
except
ValueError
:
print
(
"Bad line in config-file %s:
\
n
%s"
%
(
filename
,
line
))
print
(
"Bad line in config-file %s:
\
n
%s"
%
(
filename
,
line
))
continue
continue
key
=
key
.
strip
()
key
=
key
.
strip
()
...
@@ -192,7 +192,7 @@ def config_dict(filename):
...
@@ -192,7 +192,7 @@ def config_dict(filename):
value
=
float
(
value
)
value
=
float
(
value
)
else
:
else
:
value
=
int
(
value
)
value
=
int
(
value
)
except
:
except
ValueError
:
pass
# value need not be converted
pass
# value need not be converted
cfgdict
[
key
]
=
value
cfgdict
[
key
]
=
value
return
cfgdict
return
cfgdict
...
@@ -220,7 +220,7 @@ def readconfig(cfgdict):
...
@@ -220,7 +220,7 @@ def readconfig(cfgdict):
try
:
try
:
head
,
tail
=
split
(
__file__
)
head
,
tail
=
split
(
__file__
)
cfg_file2
=
join
(
head
,
default_cfg
)
cfg_file2
=
join
(
head
,
default_cfg
)
except
:
except
Exception
:
cfg_file2
=
""
cfg_file2
=
""
if
isfile
(
cfg_file2
):
if
isfile
(
cfg_file2
):
cfgdict2
=
config_dict
(
cfg_file2
)
cfgdict2
=
config_dict
(
cfg_file2
)
...
@@ -229,7 +229,7 @@ def readconfig(cfgdict):
...
@@ -229,7 +229,7 @@ def readconfig(cfgdict):
try
:
try
:
readconfig
(
_CFG
)
readconfig
(
_CFG
)
except
:
except
Exception
:
print
(
"No configfile read, reason unknown"
)
print
(
"No configfile read, reason unknown"
)
...
@@ -653,7 +653,7 @@ class TurtleScreenBase(object):
...
@@ -653,7 +653,7 @@ class TurtleScreenBase(object):
x
,
y
=
(
self
.
cv
.
canvasx
(
event
.
x
)
/
self
.
xscale
,
x
,
y
=
(
self
.
cv
.
canvasx
(
event
.
x
)
/
self
.
xscale
,
-
self
.
cv
.
canvasy
(
event
.
y
)
/
self
.
yscale
)
-
self
.
cv
.
canvasy
(
event
.
y
)
/
self
.
yscale
)
fun
(
x
,
y
)
fun
(
x
,
y
)
except
:
except
Exception
:
pass
pass
self
.
cv
.
tag_bind
(
item
,
"<Button%s-Motion>"
%
num
,
eventfun
,
add
)
self
.
cv
.
tag_bind
(
item
,
"<Button%s-Motion>"
%
num
,
eventfun
,
add
)
...
@@ -1158,7 +1158,7 @@ class TurtleScreen(TurtleScreenBase):
...
@@ -1158,7 +1158,7 @@ class TurtleScreen(TurtleScreenBase):
raise
TurtleGraphicsError
(
"bad color string: %s"
%
str
(
color
))
raise
TurtleGraphicsError
(
"bad color string: %s"
%
str
(
color
))
try
:
try
:
r
,
g
,
b
=
color
r
,
g
,
b
=
color
except
:
except
(
TypeError
,
ValueError
)
:
raise
TurtleGraphicsError
(
"bad color arguments: %s"
%
str
(
color
))
raise
TurtleGraphicsError
(
"bad color arguments: %s"
%
str
(
color
))
if
self
.
_colormode
==
1.0
:
if
self
.
_colormode
==
1.0
:
r
,
g
,
b
=
[
round
(
255.0
*
x
)
for
x
in
(
r
,
g
,
b
)]
r
,
g
,
b
=
[
round
(
255.0
*
x
)
for
x
in
(
r
,
g
,
b
)]
...
@@ -2702,7 +2702,7 @@ class RawTurtle(TPen, TNavigator):
...
@@ -2702,7 +2702,7 @@ class RawTurtle(TPen, TNavigator):
return
args
return
args
try
:
try
:
r
,
g
,
b
=
args
r
,
g
,
b
=
args
except
:
except
(
TypeError
,
ValueError
)
:
raise
TurtleGraphicsError
(
"bad color arguments: %s"
%
str
(
args
))
raise
TurtleGraphicsError
(
"bad color arguments: %s"
%
str
(
args
))
if
self
.
screen
.
_colormode
==
1.0
:
if
self
.
screen
.
_colormode
==
1.0
:
r
,
g
,
b
=
[
round
(
255.0
*
x
)
for
x
in
(
r
,
g
,
b
)]
r
,
g
,
b
=
[
round
(
255.0
*
x
)
for
x
in
(
r
,
g
,
b
)]
...
@@ -3865,7 +3865,7 @@ def read_docstrings(lang):
...
@@ -3865,7 +3865,7 @@ def read_docstrings(lang):
try
:
try
:
# eval(key).im_func.__doc__ = docsdict[key]
# eval(key).im_func.__doc__ = docsdict[key]
eval
(
key
).
__doc__
=
docsdict
[
key
]
eval
(
key
).
__doc__
=
docsdict
[
key
]
except
:
except
Exception
:
print
(
"Bad docstring-entry: %s"
%
key
)
print
(
"Bad docstring-entry: %s"
%
key
)
_LANGUAGE
=
_CFG
[
"language"
]
_LANGUAGE
=
_CFG
[
"language"
]
...
@@ -3875,7 +3875,7 @@ try:
...
@@ -3875,7 +3875,7 @@ try:
read_docstrings
(
_LANGUAGE
)
read_docstrings
(
_LANGUAGE
)
except
ImportError
:
except
ImportError
:
print
(
"Cannot find docsdict for"
,
_LANGUAGE
)
print
(
"Cannot find docsdict for"
,
_LANGUAGE
)
except
:
except
Exception
:
print
(
"Unknown Error when trying to import %s-docstring-dictionary"
%
print
(
"Unknown Error when trying to import %s-docstring-dictionary"
%
_LANGUAGE
)
_LANGUAGE
)
...
...
Misc/ACKS
View file @
cefa9172
...
@@ -1655,6 +1655,7 @@ Uwe Zessin
...
@@ -1655,6 +1655,7 @@ Uwe Zessin
Cheng Zhang
Cheng Zhang
Kai Zhu
Kai Zhu
Tarek Ziadé
Tarek Ziadé
Jelle Zijlstra
Gennadiy Zlobin
Gennadiy Zlobin
Doug Zongker
Doug Zongker
Peter Åstrand
Peter Åstrand
...
...
Misc/NEWS
View file @
cefa9172
...
@@ -13,6 +13,9 @@ Core and Builtins
...
@@ -13,6 +13,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #27238: Got rid of bare excepts in the turtle module. Original patch
by Jelle Zijlstra.
- Issue #27122: When an exception is raised within the context being managed
- Issue #27122: When an exception is raised within the context being managed
by a contextlib.ExitStack() and one of the exit stack generators
by a contextlib.ExitStack() and one of the exit stack generators
catches and raises it in a chain, do not re-raise the original exception
catches and raises it in a chain, do not re-raise the original exception
...
...
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