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
af3d6270
Commit
af3d6270
authored
Jan 28, 2007
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the thread lock's context manager instead of a try/finally statement.
parent
7a28447d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
4 deletions
+1
-4
Lib/_strptime.py
Lib/_strptime.py
+1
-4
No files found.
Lib/_strptime.py
View file @
af3d6270
...
...
@@ -294,8 +294,7 @@ def _calc_julian_from_U_or_W(year, week_of_year, day_of_week, week_starts_Mon):
def
strptime
(
data_string
,
format
=
"%a %b %d %H:%M:%S %Y"
):
"""Return a time struct based on the input string and the format string."""
global
_TimeRE_cache
,
_regex_cache
_cache_lock
.
acquire
()
try
:
with
_cache_lock
:
time_re
=
_TimeRE_cache
locale_time
=
time_re
.
locale_time
if
_getlang
()
!=
locale_time
.
lang
:
...
...
@@ -320,8 +319,6 @@ def strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
except
IndexError
:
raise
ValueError
(
"stray %% in format '%s'"
%
format
)
_regex_cache
[
format
]
=
format_regex
finally
:
_cache_lock
.
release
()
found
=
format_regex
.
match
(
data_string
)
if
not
found
:
raise
ValueError
(
"time data %r does not match format %r"
%
...
...
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