Ned Batchelder added the comment:
(sorry, to sort the attributes.)
--
___
Python tracker
<https://bugs.python.org/issue34160>
___
___
Python-bugs-list mailin
Ned Batchelder added the comment:
Hi, this broke my tests, just as earlier comments predicted.
Can we get an optional argument to sort the keys? The json module lets us sort
keys even though it's irrelevant to JSON. Being able to sort attributes would
be a very useful addition t
Ned Batchelder added the comment:
To provide a little more context: coverage.py has tests that the XML reports it
generates are correct. It does this by comparing the result to saved XML
files. On Python versions up to 3.7, the file compares correctly. It has
sorted attributes generated
Ned Batchelder added the comment:
Diego, they are my tests in the coverage.py test suite. I'm checking that my
XML generating code is producing the right XML.
--
___
Python tracker
<https://bugs.python.org/is
Ned Batchelder added the comment:
This is exactly the situation Stefan was talking about: "However, I still think
that Serhiy is right: this change would break code, and in particular test code
that compares XML output. Having to deal with two different "correct"
serialis
Ned Batchelder added the comment:
I can see that there are ways that I can change my tests. I see that there are
third-party libraries that can help me with this.
But changing the behavior of the standard library, without a way to retain the
old behavior, and asking people to adapt by
Ned Batchelder added the comment:
Words like flawed from the outset, fundamentally flawed, fragile, and
ill-conceived are being thrown around, which does not help the discussion. Can
we focus on the question of whether it's reasonable to add sorted attributes as
an option?
This
Ned Batchelder added the comment:
Stefan, just to clarify: it isn't that I don't feel like re-serializing my gold
files with the latest version. I run my test suite on 2.7, 3.4, 3.5, 3.6, 3.7,
3.8, PyPy2, and PyPy3. Today, one gold file suffices for all those versions.
Without
Ned Batchelder added the comment:
It seemed like we were close to a consensus about adding back the option to
sort the attributes, or did I misunderstand?
--
___
Python tracker
<https://bugs.python.org/issue34
Ned Batchelder added the comment:
I find the workarounds mentioned here to be baroque and confusing. The concept
of a default value to return in the case of an empty iterator is
straightforward. I'm +1 on adding this as well.
--
nosy: +n
Ned Batchelder added the comment:
Please don't make this change. "Data" is used as a singular collective noun,
especially in software contexts. "Data" as a plural noun sounds archaic, or at
best, scientific.
--
nosy: +nedbat
_
Changes by Ned Batchelder :
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue14803>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ned Batchelder added the comment:
The difficulty that coverage faces is not measuring python programs started
from the command line like this, you can use "coverage run myprog.py" or
"python -m coverage run myprog.py".
The difficulty is when there are subprocesses run
Changes by Ned Batchelder :
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue15256>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ned Batchelder added the comment:
> I'm -0.5 myself, though, for the reason that it complicates the startup
> process a little bit more, without looking very compelling. It smells
> disturbingly like LD_PRELOAD to me.
Antoine, do you have a suggestion for how to solve the cover
Ned Batchelder added the comment:
Chris:
The real problem is that it isn't the "test suite" that spawns the processes,
the tests invoke product code, and the product code spawns Python. So
modifying the Python-spawning really means modifying the product code to do
something
Ned Batchelder added the comment:
Chris, I'm not sure how to answer your questions. The more powerful and
flexible, the better. There is no "must" here. I'm looking for a way to avoid
the hacks coverage.py has used in the past to measure coverage in subprocesses.
A l
Ned Batchelder added the comment:
I agree with Antoine: I don't see why this should be a feature of virtualenvs.
It's easy to use environment variables in a tightly-controlled way. We don't
worry that any of the other environment variables that affect Python execution
will
New submission from Ned Batchelder:
The logging.exception method differs from .debug(), .info(), .warning(),
.error() and .critical() in that it does not accept an `extra` keyword
argument. There seems to be no reason for this.
The docs are misleading about this. They say, "The argument
New submission from Ned Batchelder:
When tokenizing with tokenize.generate_tokens, if the code ends with whitespace
(no newline), the tokenizer produces an ERRORTOKEN for each space.
Additionally, the regex that fails to find tokens in those spaces is linear in
the number of spaces, so the
Ned Batchelder added the comment:
Here's a patch for 3.3.
I would like to also fix 2.7...
--
keywords: +patch
Added file: http://bugs.python.org/file27459/bug16152.patch
___
Python tracker
<http://bugs.python.org/is
Changes by Ned Batchelder :
Removed file: http://bugs.python.org/file27459/bug16152.patch
___
Python tracker
<http://bugs.python.org/issue16152>
___
___
Python-bugs-list m
Changes by Ned Batchelder :
Added file: http://bugs.python.org/file27466/bug16152_v33.patch
___
Python tracker
<http://bugs.python.org/issue16152>
___
___
Python-bug
Changes by Ned Batchelder :
Added file: http://bugs.python.org/file27467/bug16152_v27.patch
___
Python tracker
<http://bugs.python.org/issue16152>
___
___
Python-bug
Ned Batchelder added the comment:
Updated with new (better) patch, for v2.7 and v3.3. They are the same except
for the test.
--
___
Python tracker
<http://bugs.python.org/issue16
Ned Batchelder added the comment:
Jesús, done!
--
___
Python tracker
<http://bugs.python.org/issue16152>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ned Batchelder added the comment:
Although the OP was incorrect about 1 being guaranteed to be True, it is still
better documentation to use True rather than 1 for a boolean argument.
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.
Ned Batchelder added the comment:
Raymond, thanks for keeping us honest!
I am still hoping to convince people that this is a good idea. I think Guido's
+1 (https://mail.python.org/pipermail/python-dev/2012-December/123099.html)
should help in that regard.
Part of your reason for to
Ned Batchelder added the comment:
Python-Ideas thread started:
https://mail.python.org/pipermail/python-ideas/2014-May/027893.html
--
___
Python tracker
<http://bugs.python.org/issue2
Ned Batchelder added the comment:
I thought we were discussing this on Python-Ideas?
--
___
Python tracker
<http://bugs.python.org/issue2506>
___
___
Python-bug
New submission from Ned Batchelder:
>From the #python IRC channel:
```
[07:55:29] tonysar hello.new to programming and python, i use mac
terminal but problem i have is , when i use help function of python to look up
something , i lose my prompt and i have no idea how to go back , wha
Ned Batchelder added the comment:
Thanks, this is a very complete explanation of the machinery behind the scenes.
I think we would do beginners a service if we made the behavior a bit less
obscure. Are there ways that we could (for example) have the prompt say "END
(q to quit)"
Ned Batchelder added the comment:
Serhiy, thanks for the configuration tip. But you seem to be missing my point,
which is that beginners need the default to be a little more friendly. I don't
want to make it bad for experienced users, of course. I doubt Unix users will
be confus
New submission from Ned Batchelder:
Examining the CPython sources, there are a number of places where
PyLong_FromLong is used without checking its return value. In places where it
is done correctly, PyErr_Occurred is often used to avoid having to check every
call.
Here are places where it
Ned Batchelder added the comment:
I have no idea why pyexpat.c invokes the trace function in the first place.
Unless someone can explain why it does that when no other C extension does, my
inclination would be to make it stop calling the trace function at all, not to
fix how it calls it
Ned Batchelder added the comment:
ITSM this could use more clarification. It is subtle and baffling. I'm
struggling to come up with sentences to make it clearer, though.
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/i
Ned Batchelder added the comment:
I wrote about this here:
http://nedbatchelder.com/blog/201211/tricky_locals.html A reader suggested
this addition to the docs, which I like:
"Multiple invocations within the scope update and return the same dictionary
instance. When a trace function
Ned Batchelder added the comment:
@Brian: Your code doesn't run in Python 2.7 as you've shown it, it produces an
IndentationError. If your code is actually different, and does run, try
running it with the -tt flag on Python, which will warn about inconsistent
indentation.
-
Changes by Ned Batchelder :
--
nosy: -nedbat
___
Python tracker
<http://bugs.python.org/issue14373>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ned Batchelder:
If I register an atexit handler, and then call os.execv, the handler is not
invoked before my process changes over to the new program. Shouldn't it be?
My program is ending, so my atexit handlers should be invoked.
This is based on this coverage.p
Changes by Ned Batchelder :
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue16653>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ned Batchelder:
Sorry if this is the wrong bug tracker for this issue.
Someone just asked in #python what they should do about the fact that Python
has no threads on the Mac. When asked why they thought that, they pointed to
this: http://www.python.org/doc/essays
New submission from Ned Batchelder:
The order of values on the stack is backwards for RAISE_VARARGS. The docs say:
"Raises an exception. argc indicates the number of parameters to the raise
statement, ranging from 0 to 3. The handler will find the traceback as TOS2,
the parameter as
New submission from Ned Batchelder:
In 2.7, set comprehensions are compiled to code objects expecting an argument
named ".0". This convention is also used for the unnamed arguments needed by
tuple arguments. inspect.getcallargs understands the tuple argument case, but
n
Ned Batchelder added the comment:
BTW: I don't hold any illusions that this bug is important enough to fix, but I
would be interested in hearing ideas about how I could work around it...
--
___
Python tracker
<http://bugs.python.org/is
Ned Batchelder added the comment:
There are other forms of numbers allowed by Python that are not allowed by
JSON: "001.1"
Oddly, with all of the strictness in JSON, the exponent-marker "e" can be
upper- or lower-case: 1e1 and 1E1 are both valid JSON.
Ned Batchelder added the comment:
I'll add my voice to those asking for a way to put docstrings on namedtuples.
As it is, namedtuples get automatic docstrings that seem to me to be almost
worse than none. Sphinx produces this:
```
class Key
Key(scope, user_id, block_sco
New submission from Ned Batchelder:
When I make a namedtuple, I get automatic docstrings that use a lot of words to
say very little. Sphinx autodoc produces this:
```
class Key
Key(scope, user_id, block_scope_id, field_name)
__getnewargs__()
Return self as a plain tuple
Ned Batchelder added the comment:
FWIW, every use of rmtree I have on Windows occasionally fails this way,
parallelism seems not to be a factor.
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue22
Ned Batchelder added the comment:
This sentence seems to cover it: "Each instance of the TestCase will only be
used to run a single test method, so a new fixture is created for each test."
from http://docs.python.org/2/library/unittest.html
The word "fixture" here is b
New submission from Ned Batchelder :
If you set the environment variable DISTUTILS_DEBUG=1, distutils will
run with DEBUG, which will trace internal activity. But one of the
traces is incorrect, and leads to this stack trace:
Traceback (most recent call last):
File "setup.py", li
Ned Batchelder added the comment:
Another one:
Traceback (most recent call last):
File "setup.py", line 72, in
**addl_args
File "c:\python31\lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "c:\python31\lib\distutils\dist.py&qu
New submission from Ned Batchelder :
Pyexpat.c calls the tracing function explicitly (not sure why). When it
intercepts an exception, it calls the function with PyTrace_EXCEPTION,
but then leaves the scope without calling PyTrace_RETURN. This is
incorrect. There should always be a
Ned Batchelder added the comment:
Isn't this problem solved by the threading.settrace and threading.setprofile
functions?
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/iss
Ned Batchelder added the comment:
This breaks virtualenv3 on Python 3.2, which simply test for the existence of
os.symlink, which then fails for lack of privileges. Perhaps an
os.can_symlink() method, returning a boolean? It can request privileges if you
like, but provides a simple test
Ned Batchelder added the comment:
I doubt very very much that coverage.py is stealing stderr. Many many test
suites would have this problem if that were true. More likely is that somehow
__del__ is not being invoked when you need it to be.
I tried running the tests under coverage also, and
Ned Batchelder added the comment:
Are you sure the code that tried to print to stderr was even run? It's in a
__del__ method, which is notorious for being affected by surprising things.
--
___
Python tracker
<http://bugs.python.org/is
Ned Batchelder added the comment:
Can you show the output of "coverage debug sys"?
--
___
Python tracker
<http://bugs.python.org/issue29048>
___
___
Ned Batchelder added the comment:
I don't believe this is coverage.py's fault, so I don't have an answer to your
question. There is no revision of coverage.py that *does* swallow stderr.
Also, as you can see from the test output, it isn't swallowed, it's not being
New submission from Ned Batchelder:
Creating two Random() instances in quick succession produces the same sequence,
but only on Windows on Python 3.6. On 3.5 or earlier, or on Mac/Linux, the
randomization is good.
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit
Changes by Ned Batchelder :
--
versions: +Python 3.6
___
Python tracker
<http://bugs.python.org/issue29085>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ned Batchelder added the comment:
Adding a time.sleep(0.001) (or maybe even just 0) between the calls prevents
the problem.
--
___
Python tracker
<http://bugs.python.org/issue29
Ned Batchelder added the comment:
I'm still interested in moving this forward. I can make a GitHub pull request
if that would help.
--
___
Python tracker
<http://bugs.python.org/is
New submission from Ned Batchelder:
The docs for statistics.mean say, "Return the sample arithmetic mean of data, a
sequence or iterator of real-valued numbers." Most of the functions in
statistics have a `data` argument, but this function is the only one that says,
"a seque
Ned Batchelder added the comment:
Why is it important to remove subclassing object? Isn't it still good form to
mention object as a base class.
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/is
Changes by Ned Batchelder :
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue17546>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ned Batchelder added the comment:
Since this is documented in the Python Language Reference, it doesn't make much
sense to have it describe one way for 3.3 and another for 3.4, does it? By
definition, doesn't that make this an implementation dependency? We should
update the docs t
Ned Batchelder added the comment:
Changing the type of the locals() return isn't the right way to solve this
problem. Better docs is the way to do it. If someone is calling locals(),
they should read the docs. Examining the type of values is discouraged in
Python, we shouldn
Ned Batchelder added the comment:
I would say it something like this:
"The dictionary returned by locals() is an accurate snapshot of the local
namespace at the time it is called. After the call returns, changes to one may
or may not be reflected in the other. The dictionary may c
New submission from Ned Batchelder:
I just pulled down the tip of CPython, built it, and ran the tests, and got
this failure:
```
==
FAIL: test_compute_rollover_weekly_attime
(test.test_logging.TimedRotatingFileHandlerTest
Changes by Ned Batchelder :
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue17718>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ned Batchelder:
Looking into this Stack Overflow question:
http://stackoverflow.com/questions/16115027/pythons-sys-settrace-wont-create-c-call-events
Reading the code in c_eval.c and friends, it looks like "c_call" events are
never passed to the trace functio
Ned Batchelder added the comment:
Attached a patch which simply removes the code that invokes the trace function.
--
keywords: +patch
Added file: http://bugs.python.org/file29951/6539.patch
___
Python tracker
<http://bugs.python.org/issue6
New submission from Ned Batchelder:
I find the explanations in the Descriptor howto to be difficult to understand.
I took a stab at changing the first few sections to introduce the concepts in
an easier-to-grasp style.
Issue 12077 also covers a little bit of this.
--
assignee: docs
Changes by Ned Batchelder :
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue17898>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ned Batchelder :
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue12077>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ned Batchelder added the comment:
I worked with Ezio to make a new patch with the full edits.
I have other ideas for edits to the rest of the document, but we can discuss
those if you like these...
--
Added file: http://bugs.python.org/file30127/descriptor_howto_2.patch
Ned Batchelder added the comment:
Raymond, I'm glad you're on top of this. I would have thought the howto should
be the easy on-ramp, and deeper authoritative details should go in the
reference section.
--
___
Python trac
Ned Batchelder added the comment:
If you can't determine the number of CPUs, return a clear "can't determine"
value, such as 0 or -1. Returning 1 will hide information, and it's an easy
default for the caller to apply if they want to.
Ned Batchelder added the comment:
Seriously, return zero, and I can use it as: cpu_count = os.cpu_count() or 1
Why throw away information?
--
___
Python tracker
<http://bugs.python.org/issue17
Ned Batchelder added the comment:
A few small points:
Use `num is None` instead of `num == None`.
Use `isinstance(cpus, int)` rather than `type(cpus) is int`.
And this I think will throw an exception in Python 3: `cpus >= 1 or cpus ==
None`, because you can't compare N
Ned Batchelder added the comment:
@Yogesh: if cpus is None, then this will raise an exception in Python 3: `cpus
>= 1 or cpus == None` Perhaps you don't have enough test cases yet.
--
___
Python tracker
<http://bugs.python.org
Ned Batchelder added the comment:
Python's goal is not to emulate the suboptimal parts of other languages. We
have dynamic typing, and so can return None from the same function that returns
1. And we have compact expressions like `cpu_count() or 1`, so we don't have
to make u
Ned Batchelder added the comment:
Python 3 has no print statement, it has a print function, so you need:
print("Hello, world!")
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.o
Changes by Ned Batchelder :
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue18031>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ned Batchelder:
The Python 3.4 docstring for range is:
{{{
| range(stop) -> range object
| range(start, stop[, step]) -> range object
|
| Return a virtual sequence of numbers from start to stop by step.
}}}
In Python 2.7, it said:
{{{
range(stop) ->
Ned Batchelder added the comment:
This bug just bit me. Changing "# coding: utf8" to "# coding: utf-8" works
around it.
--
nosy: +nedbat
___
Python tracker
<http://bug
Ned Batchelder added the comment:
(oops: with Python 3.4.1 on Windows)
--
___
Python tracker
<http://bugs.python.org/issue20844>
___
___
Python-bugs-list mailin
New submission from Ned Batchelder:
This doesn't work on Python 3.4 on a Mac with Yosemite and Chrome installed:
import webbrowser
webbrowser.get("chrome")
This patch makes it work:
```
*** /usr/local/pythonz/pythons/CPython-3.4.1/lib/python3.4/webbrowser.py
2
Ned Batchelder added the comment:
BTW, the Stack Overflow answer: http://stackoverflow.com/a/4043007
--
___
Python tracker
<http://bugs.python.org/issue24
Ned Batchelder added the comment:
What version of coverage.py is this?
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue25260>
___
___
Python-bug
New submission from Ned Batchelder:
The MANIFEST.in file for coverage.py excludes directories line doc/_build. If
I run "python setup.py --quiet develop", I get output like this:
python3.5 setup.py --quiet develop
no previously-included directories found matching 'doc
Ned Batchelder added the comment:
You are right that "develop" is from setuptools. The same messages appear with
"sdist":
$ python setup.py --quiet sdist
no previously-included directories found matching 'doc/_build'
no previously-included directorie
Ned Batchelder added the comment:
I'm confused: the discussion here is mostly about updating docs to note
deprecation. Then at the very end, is an off-hand remark about removing
getargspec.
The docs for getargspec currently read, "This function will be removed in
Python 3.6."
Ned Batchelder added the comment:
This is the situation I am in: coverage.py uses getargspec in a very simple way
in its tooling. I support 2.7 and 3.5, so I have to do this:
try:
getargspec = inspect.getfullargspec
except AttributeError:
getargspec
Changes by Ned Batchelder :
--
nosy: +nedbat
___
Python tracker
<http://bugs.python.org/issue25486>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ned Batchelder added the comment:
I tried to install 3.5.1 32-bit into a fresh virtualbox image from
https://dev.windows.com/en-us/microsoft-edge/tools/vms/mac/ (IE 10 on Win 7),
and got this same error message. Python will not run, it only shows
New submission from Ned Batchelder:
I tried to install 3.5.1 32-bit into a fresh virtualbox image from
https://dev.windows.com/en-us/microsoft-edge/tools/vms/mac/ (IE 10 on Win 7),
and got this error message. When I try to run Python with "py -3", it will not
run, it
Ned Batchelder added the comment:
This was my second attempt, and there is no other installation running.
--
___
Python tracker
<http://bugs.python.org/issue25
Ned Batchelder added the comment:
This is in a virtualbox. I have my host OS files mapped in the guest Windows OS
to drive N:. When I try to install by running N:\Downloads\python-3.5.1.exe,
it fails with the error shown above. When I copy the file to the C: drive, it
succeeds
201 - 300 of 311 matches
Mail list logo