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
2eb33a0f
Commit
2eb33a0f
authored
Sep 08, 2012
by
Christian Heimes
Browse files
Options
Browse Files
Download
Plain Diff
Fix for fcc629208842
BSD's make doesn't support some of the features.
parents
e2a95c64
801d07c4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
2 deletions
+27
-2
Lib/argparse.py
Lib/argparse.py
+4
-1
Lib/test/test_argparse.py
Lib/test/test_argparse.py
+18
-0
Misc/NEWS
Misc/NEWS
+3
-0
Python/random.c
Python/random.c
+2
-1
No files found.
Lib/argparse.py
View file @
2eb33a0f
...
...
@@ -1692,9 +1692,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
return
args
def
parse_known_args
(
self
,
args
=
None
,
namespace
=
None
):
# args default to the system args
if
args
is
None
:
# args default to the system args
args
=
_sys
.
argv
[
1
:]
else
:
# make sure that args are mutable
args
=
list
(
args
)
# default Namespace built from parser defaults
if
namespace
is
None
:
...
...
Lib/test/test_argparse.py
View file @
2eb33a0f
...
...
@@ -4486,6 +4486,24 @@ class TestTypeFunctionCallWithNonStringDefault(TestCase):
class
TestParseKnownArgs
(
TestCase
):
def
test_arguments_tuple
(
self
):
parser
=
argparse
.
ArgumentParser
()
parser
.
parse_args
(())
def
test_arguments_list
(
self
):
parser
=
argparse
.
ArgumentParser
()
parser
.
parse_args
([])
def
test_arguments_tuple_positional
(
self
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'x'
)
parser
.
parse_args
((
'x'
,))
def
test_arguments_list_positional
(
self
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'x'
)
parser
.
parse_args
([
'x'
])
def
test_optionals
(
self
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--foo'
)
...
...
Misc/NEWS
View file @
2eb33a0f
...
...
@@ -103,6 +103,9 @@ Core and Builtins
Library
-------
- Issue #15340: Fix importing the random module when /dev/urandom cannot
be opened. This was a regression caused by the hash randomization patch.
- Issue #15841: The readable(), writable() and seekable() methods of
io.BytesIO and io.StringIO objects now raise ValueError when the object has
been closed. Patch by Alessandro Moura.
...
...
Python/random.c
View file @
2eb33a0f
...
...
@@ -165,7 +165,8 @@ dev_urandom_python(char *buffer, Py_ssize_t size)
Py_END_ALLOW_THREADS
if
(
fd
<
0
)
{
PyErr_SetFromErrnoWithFilename
(
PyExc_OSError
,
"/dev/urandom"
);
PyErr_SetString
(
PyExc_NotImplementedError
,
"/dev/urandom (or equivalent) not found"
);
return
-
1
;
}
...
...
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