Roy Smith added the comment:
It's nice to see this is still being worked on after all these years :-)
I'm not actually convinced the proposed fix makes sense. It swaps out one
incorrect behavior for a different incorrect behavior. If it really is more
effort than it's wo
Roy Smith added the comment:
I agree that this is confusing and that what we need is an assertion for the
top-level mock having specific calls in a specific order, and ignores any
intervening extra calls to mocked functions. In other words, a version of
assert_has_calls() which looks at
New submission from Roy Smith :
The docs list the arguments in the order:
class argparse.ArgumentParser([description][, epilog][, prog]...
but the code (I'm looking at the 2.7.2 source) lists them as:
class ArgumentParser(_AttributeHolder, _ActionsContainer):
[...]
def __init__
Roy Smith added the comment:
An Nth place is in the docstring:
Keyword Arguments:
- prog -- The name of the program (default: sys.argv[0])
- usage -- A usage
Roy Smith added the comment:
I'm working on a doc patch now...
--
___
Python tracker
<http://bugs.python.org/issue13249>
___
___
Python-bugs-list m
Roy Smith added the comment:
Patch attached. I just deal with putting all the items into the same order,
not terry.reedy's idea for separating them into two groups.
Added a recommendation to only use keywords, which seems sane given the number
of arguments.
--
keywords: +
Roy Smith added the comment:
PS -- this is against the 2.7 branch.
--
___
Python tracker
<http://bugs.python.org/issue13249>
___
___
Python-bugs-list mailin
Roy Smith added the comment:
New patch uploaded.
The added recommendation is around line 161 (look for 'Recommended usage is to
only use keyword arguments')
--
Added file: http://bugs.python.org/file23667/Issue13249-2.patch
___
Pyth
Roy Smith added the comment:
Before I build another patch, would you be OK with leaving it as a note, but
adding the "due to the number of arguments" language? There's a lot of text
here, and people tend to just zoom in on the bits and pieces they need right
now. I think th
Roy Smith added the comment:
Another patch, with the most recent review suggestions incorporated.
--
Added file: http://bugs.python.org/file23703/Issue13249-3.patch
___
Python tracker
<http://bugs.python.org/issue13
New submission from Roy Smith :
While investigating issue7322, I wrote a test case to demonstrate the issue. I
made a mistake and called settimeout() on the wrong socket, but the result
appears to demonstrate a different bug. When I run the attached
test-issue7322.py on my OSX-10.6.5
Roy Smith added the comment:
I'm looking into this now. In the meantime, I've opened a marginally-related
bug, issue10473
--
nosy: +roysmith
___
Python tracker
<http://bugs.python.
Roy Smith added the comment:
Ataching a test case which demonstrates the bug.
--
Added file: http://bugs.python.org/file19711/test-issue7322.py
___
Python tracker
<http://bugs.python.org/issue7
Roy Smith added the comment:
Thank you for the detailed analysis. That certainly explains what I observed.
Would it make sense for socket.makefile() to check to see if the socket is in
blocking mode (assuming there is some reliable/portable way to perform this
check), and raise some
Roy Smith added the comment:
This is kind of ugly. On the one hand, I'm all for adding a check in
makefile() to catch it being called on a non-blocking socket.
On the other hand, you are correct that a user could change the mode leter.
Even if we added checks for this in socket.setblo
Roy Smith added the comment:
The answer depends on what the socket module is trying to do. Is the goal
simply to provide a pythonic thin wrapper over the underlying OS interfaces
without altering their semantics, or to provide a completely homogeneous
abstraction? Having attempted the
Roy Smith added the comment:
I got into this by starting with Issue7322, which reports a scenario where data
is lost using makefile(). The docs for makefile() say, "The socket must be in
blocking mode (it can not have a timeout)". So, we've got published
documentation wh
Roy Smith added the comment:
Responding to msg122013:
I think he exactly meant to equate the two.
The original problem described in issue882297 is that the makefile()
documentation only stated that the socket could not be in non-blocking mode.
The test case presented didn't appear t
New submission from Roy Smith :
The documentation for the threading.Thread constructor says:
"target is the callable object to be invoked by the run() method. Defaults to
None, meaning nothing is called."
This could be improved by explicitly stating that target is called in a stati
Roy Smith added the comment:
What I meant was whether target should be declared as @staticmethod or not.
--
___
Python tracker
<http://bugs.python.org/issue11
Roy Smith added the comment:
Here's the code I ended up writing:
class Foo():
def __init__(self):
self.thread = Thread(target=Foo.runner, args=[self])
self.thread.start()
@staticmethod
def runner(self):
# blah, blah, blah
It was not immediately clear fro
New submission from Roy Smith <[EMAIL PROTECTED]>:
Unless I'm missing something, the only way to tell if a deque is empty is
to try and pop() something and catch the resulting IndexError. This is
not only awkward, but mutates the data structure when you may not want to.
It should
Roy Smith <[EMAIL PROTECTED]> added the comment:
I just realized my request may have been ambiguous; empty() is a
predicate, not a verb. Doc should be something like:
"""Return true if the deque is empty. Return false otherwise."""
__
Roy Smith <[EMAIL PROTECTED]> added the comment:
Sigh. It looks like you can do what I want after all, by just using the
deque object itself, i.e.:
q = deque()
while (q):
...
This should be changed to a docs bug -- the doc page for deque should
mention this, or include an example o
Roy Smith <[EMAIL PROTECTED]> added the comment:
In retrospect, it's obvious that "while mydeque" is indeed the way to
process the queue, yet, when I was reading the docs, I didn't come away
with that.
The statement, "list objects support similar operations&qu
New submission from Roy Smith <[EMAIL PROTECTED]>:
The third argument, places, is optional, but no indication is given what
value is used if it is omitted.
--
assignee: georg.brandl
components: Documentation
messages: 73447
nosy: georg.brandl, roysmith
severity: normal
status
Roy Smith <[EMAIL PROTECTED]> added the comment:
I think you're missing the point. Imagine you are somebody who doesn't know
Python internals. You're looking at the doc page for deque and ask yourself
the question, "How do I tell if one of these is empty?".
New submission from Roy Smith:
At http://docs.python.org/lib/thread-objects.html, under join(), it says:
"As join() always returns None, you must call isAlive() to decide whether a
timeout
happened."
This would be better if it were more explicit, i.e.
"As join() always re
New submission from Roy Smith <[EMAIL PROTECTED]>:
http://docs.python.org/lib/node528.html (17.1.1 Using the subprocess
Module) describes the "env" parameter thusly:
If env is not None, it defines the environment variables for the new
process.
This is too vague to be usef
New submission from Roy Smith <[EMAIL PROTECTED]>:
Note: this is (sort of) related to Issue2633.
http://docs.python.org/lib/os-process.html (14.1.5 Process Management).
The docs for os.execvpe() say, "the env parameter must be a mapping which
is used to define the environment va
New submission from Roy Smith <[EMAIL PROTECTED]>:
The current doc says, "Copy the contents of the file named src to a file
named dst". Anybody used to the unix shell "cp" command would assume that
dst could be a directory, in which case the true destination is a fi
Roy Smith <[EMAIL PROTECTED]> added the comment:
Reading closer, I see that copy() has the shell-like semantics I was
expecting copyfile() to have. Perhaps the right fix is to include a note in
the copyfile() docs saying, "dst must be a file path; see also copy() for a
version w
New submission from Roy Smith <[EMAIL PROTECTED]>:
If you pass csv.reader() a filename as its first argument:
csv.reader('filename')
instead of a file object like you're supposed to, you don't get an error.
You instead get a reader object which returns the cha
New submission from Roy Smith <[EMAIL PROTECTED]>:
The docs say:
Return a string containing the hostname of the machine where the Python
interpreter is currently executing. If you want to know the current
machine's IP address, you may want to use gethostbyname(gethostname()).
Thi
New submission from Roy Smith <[EMAIL PROTECTED]>:
It would be useful if ctypes included limiting constants for the various
fixed-size integers, i.e. MAX_INT_32, MIN_INT_32, etc.
Maybe it does and I just missed just didn't see it in the docs?
--
assignee: theller
compone
New submission from Roy Smith :
It would be nice if Queue.Queue included a way to access the high-water
mark, i.e. the largest value which qsize() has ever reached. This is
often useful when assessing application performance.
I am assuming this is cheap, i.e. O(1), to provide
Roy Smith added the comment:
I'm suppose you could implement this in a subclass, but it would be
inefficient. You'd have to over-ride put() and get(), call qsize(),
then delegate to Base.put() and Base.get().
A cleaner solution would be in the C implementation of deque,
Roy Smith added the comment:
I'm not actually sure what the use case is for clear(). It's easy
enough to just create a new deque. If you can do that, why do you need
clear()? Since I don't ever see a reason anybody would want to call
clear(), I'm not 100% if it should
Roy Smith added the comment:
And, FWIW, I did figure out a use case for clear(). I create a queue and
pass it to two threads. One side or the other decides to abandon processing
of the events currently in the queue. I can't just create a new queue,
because you have no way to tel
New submission from Roy Smith :
In https://docs.python.org/3.5/reference/import.html#importsystem, section "5.2
Packages", second sentence, the word "naming" is broken across two lines.
In 3.7.5rc1 as well. Didn't check any others.
--
assignee: docs@python
Roy Smith added the comment:
Yeah, that's weird. Looks like this may be a Chrome bug. I'm seeing it in
Chrome (Version 77.0.3865.90 (Official Build) (64-bit)), but not Safari. This
is on MacOS (High Sierra).
In the attached screenshot, I narrowed the window a bit. In
New submission from Roy Smith :
See https://docs.python.org/3.7/library/bz2.html
For bz2.open(), the section header says:
bz2.open(filename, mode='r' ...)
but the text says:
The mode argument ... The default is 'rb'.
As I understand it, 'r' and 'rb'
Change by Roy Smith :
--
nosy: +roysmith
___
Python tracker
<https://bugs.python.org/issue24258>
___
___
Python-bugs-list mailing list
Unsubscribe:
Roy Smith added the comment:
The https://bitbucket.org/cliff/cpython#python24258 URL 404's
Looking at the attached bz2.py diff, I would change:
if isinstance(filename, (str, bytes, os.PathLike)):
self._fp = _builtin_open(filename, mode)
+self.fil
New submission from Roy Smith :
At https://docs.python.org/3.9/library/unittest.mock.html#unittest.mock.Mock,
it says:
unsafe: By default if any attribute starts with assert or assret will raise an
AttributeError.
That's not an English sentence. I think what was intended was, "
Roy Smith added the comment:
Just for the archives:
https://bugs.chromium.org/p/chromium/issues/detail?id=1022011
--
___
Python tracker
<https://bugs.python.org/issue38
Roy Smith added the comment:
I just got bit by this in Python 3.5.3.
I get why it does this. I also get why it's impractical to change the behavior
now. But, it really isn't the obvious behavior, so it should be documented at
https://docs.python.org/3.5/library/argparse.html
Roy Smith added the comment:
Just as another edge case, type() can do the same thing:
Foo = type("Foo", (object,), {"a b": 1})
f = Foo()
for example, will create a class attribute named "a b". Maybe this actually
calls setattr() under the covers, but if i
New submission from Roy Smith:
http://docs.python.org/2/library/unittest.html#assert-methods
The docs say, "The TestCase class provides a number of methods to check for and
report failures, such as", and then when you scroll a couple of screens down,
there's another list,
Roy Smith added the comment:
Adding a note that there are more methods in the tables below would be useful.
Otherwise, you assume you've seen them all when you've read the first table.
I agree that the assertions about exceptions and warnings belong in a different
group, but I don
New submission from Roy Smith :
The docs don't say what happens if you call random.sample() with a population
smaller than k. Experimentally, it raises ValueError, but this should be
documented.
I would have guessed it would return IndexError, by analogy to random.c
Roy Smith added the comment:
The docs describe population as a "sequence". Your patch describes it as a
"list". I would go with:
If *len(population)* is less than *k*, raises :exc:`ValueError`.
--
___
Python tracker
<
New submission from Roy Smith:
Opening this bug at Ben Finney's request. See
https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/wmDUrpW2ZCU
for the full thread discussing the problem. Here's a significant excerpt:
---
Roy Smith added the comment:
We need to define the scope of what input strings will be accepted. ISO-8601
defines a lot of stuff which we may not wish to accept.
Do we want to accept both basic format (MMDD) and extended format
(-MM-DD)?
Do we want to accept things like "1985-
Roy Smith added the comment:
I see I mis-stated my example. When I wrote:
s = str(d1)
d2 = datetime.datetime(s)
assert d1 == d2
what I really meant was:
s = d1.isoformat()
d2 = datetime.datetime(s)
assert d1 == d2
But, now I realize that while that is certainly an absolute lower bound, it
Roy Smith added the comment:
I've started collecting some test cases. I'll keep adding to the collection.
I'm going to start trolling ISO 8601:2004(E) for more. Let me know if there
are other sources I should be considering.
--
___
Roy Smith added the comment:
Ooops, clicked the wrong button.
--
Added file: http://bugs.python.org/file27165/test-cases.py
___
Python tracker
<http://bugs.python.org/issue15
New submission from Roy Smith:
Running this code:
---
import argparse
p = argparse.ArgumentParser()
p.add_argument('--foo',
help=u'This is a very long help string. ex:
"--s3\u00A0s3://my.bucket/dir1/
Changes by Roy Smith :
--
nosy: +roysmith
___
Python tracker
<http://bugs.python.org/issue14452>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Roy Smith:
The following code, when run with "--help", omits the trailing newlines from
the epilog. It should just emit the string verbatim. If the developer didn't
want the extra newlines, he/she wouldn't have put them there.
im
New submission from Roy Smith:
# Python 2.7.3
# Ubuntu 12.04
import re
pattern = r"( ?P.*)"
regex = re.compile(pattern, re.VERBOSE)
The above raises an exception in re.compile():
Traceback (most recent call last):
File "./try.py", line 6, in
regex = re.compile
Changes by Roy Smith :
--
nosy: +roysmith
___
Python tracker
<http://bugs.python.org/issue15606>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Roy Smith :
--
nosy: +roysmith
___
Python tracker
<http://bugs.python.org/issue11204>
___
___
Python-bugs-list mailing list
Unsubscribe:
Roy Smith added the comment:
The new text suggested by terry.reedy works for me.
--
___
Python tracker
<http://bugs.python.org/issue19006>
___
___
Python-bug
New submission from Roy Smith:
http://docs.python.org/2/library/nntplib.html contains intra-page references
such as:
NNTP.next()
Send a NEXT command. Return as for stat().
The problem is that the link for "stat" points to the stat module (i.e.
http://docs.python.org/2/library
New submission from Roy Smith:
https://mail.python.org/pipermail/python-list/2014-June/674188.html
--
messages: 221846
nosy: roysmith
priority: normal
severity: normal
status: open
title: str.format() gives poor diagnostic on placeholder mismatch
Roy Smith added the comment:
(ugh, hit return too soon)
>>> '{1}'.format()
Traceback (most recent call last):
File "", line 1, in
IndexError: tuple index out of range
This is a confusing error message. The user hasn't written any tuples, so a
message abo
New submission from Roy Smith:
For background, see:
https://mail.python.org/pipermail/python-list/2014-August/676291.html
In a nutshell, the iglob() docs say, "Return an iterator which yields the same
values as glob() without actually storing them all simultaneously." The
Roy Smith added the comment:
The thread that led to this started out with the use case of a directory that
had 200k files in it. If I ran iglob() on that and discovered that it had
internally generated a list of all 200k names in memory at the same time, I
would be pretty darn surprised
Roy Smith added the comment:
How about something like this:
Note: The current iglob() implementation is optimized for the case of many
files distributed in a large directory tree. Internally, it iterates over the
directory tree, and stores all the names from each directory at once. This
New submission from Roy Smith:
On http://docs.python.org/2/library/random.html, the links to random() go to
the module, not the function. Thus:
Almost all module functions depend on the basic function random(),
If you lick on random(), you get to
http://docs.python.org/2/library/random.html
Roy Smith added the comment:
Ugh, that should say, "if you CLICK on random()". Really wish I was filing
this from my phone so I could blame it on autocorrect.
--
___
Python tracker
<http://bugs.python.o
New submission from Roy Smith:
http://docs.python.org/2/library/socket.html
The description for getnameinfo() says, "... Depending on the settings of
flags, the result can contain a fully-qualified domain name or numeric address
representation in host.", but does not say what t
Roy Smith added the comment:
What might make sense is for all of those, document the function call as taking
"native_flags" (or something like that), with a single note at the top of the
page saying, "native_flags means look up the specific values in the man page"
and li
New submission from Roy Smith:
http://docs.python.org/2/library/functions.html#reload says:
It is legal though generally not very useful to reload built-in or dynamically
loaded modules, except for sys, __main__ and __builtin__.
It is unclear what the "except for ..." part is re
New submission from Roy Smith :
The docs (http://www.python.org/doc/2.5.1/lib/module-tempfile.html) specify
that
mkdtemp(), "returns the absolute pathname of the new directory". It does that
in
the default case, but if you specify a relative path for 'dir', you get b
New submission from Roy Smith:
>>> re.compile('(?P=)')
Traceback (most recent call last):
File "", line 1, in
File "/home/roy/env/python/lib/python2.7/re.py", line 190, in compile
return _compile(pattern, flags)
File "/home/roy/env/python
Roy Smith added the comment:
I'm the guy who was searching for astral characters in msg18597. I should
mention that while what I did was certainly inefficient, the database was so
much slower that it didn't have any observable impact on the overall process
time (a bit over 2 days
Roy Smith added the comment:
Um, make that msg185972.
--
___
Python tracker
<http://bugs.python.org/issue17629>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Roy Smith:
At https://docs.python.org/2/library/hmac.html, hmac.new() is shown as
hmac.new(key[, msg[, digestmod]])
This implies that digestmod can only be given if msg is given. This is
incorrect. Either can be given without the other.
--
assignee: docs@python
80 matches
Mail list logo