Martin Panter added the comment:
On second thoughts maybe the idea of closing the input is not such a good idea
in practice. Once you call os.close() on the file descriptor, that descriptor
becomes unallocated, and I can’t see any way to prevent p.stdin.close(),
Popen() context, destructors,
akira added the comment:
to be clear: the test itself doesn't use threads, `python -mtest -j0`
runs tests using multiple *processes*, not threads. There is no issue.
If the test were to run in the presence of multiple threads then
the issue would be the *explicit* p.stdin.close() in the test
New submission from Alexander Boyd:
Itertools would benefit greatly from a function (which I've named intersperse,
after Haskell's equivalent) for yielding the items of an iterator with a given
value placed between each. Sort of a str.join-like function, but for arbitrary
sequences.
Éric Araujo added the comment:
Docs and indexing/cross-links in 2.7 should indeed be improved. I had
forgotten which of 2.6 or 2.7 added support for executing packages thanks to
__main__.py files and the docs don't contain an answer that's comprehensive and
easy to find.
--
New submission from Jurko Gospodnetić:
Doc/reference/datamodel.rst documentation states that
the __new__ method is a static method (in Python, not
in C!) when it is in fact a class method.
A patch has been prepared in the
https://bitbucket.org/jurko/cpython repository.
branch:
Changes by Jurko Gospodnetić jurko.gospodne...@gmail.com:
--
keywords: +patch
Added file: http://bugs.python.org/file35130/81c5ba188805.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21415
Steven D'Aprano added the comment:
Actually, no, it is a staticmethod. See Guido's tutorial from way back in
version 2.2:
[quote]
__new__ is a static method. When defining it, you don't need to (but may!) use
the phrase __new__ = staticmethod(__new__), because this is implied by its
name (it
Stefan Krah added the comment:
By default AC emits $type for class methods, see dict_fromkeys in
Objects/dictobject.c.
Thanks, good choice.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21399
eryksun added the comment:
I believe that this explains why you have to use this idiom
inside __new__ when using super():
def __new__(cls, x):
super().__new__(cls, x)
Yes, if __new__ is defined and is a function, type_new replaces it with a
staticmethod:
Brett Cannon added the comment:
Yes, that's a possibility if we want to take the route and essentially prevent
people from ever explicitly knowing that a str in Python 2 will be a str in
Python 3 and they are okay with that.
--
___
Python tracker
Jim Jewett added the comment:
On Fri, May 2, 2014 at 1:14 AM, Adam Polkosnik
The problems documented here are related to two cases (both apparently
arriving from world of windows):
Good! I had thought you had even more!
1. two relative paths with inverted slash in one of them
Adam Polkosnik added the comment:
Extraction works fine, the issue was that raise() was creating an exception,
and stoping the whole extraction process. When replaced with a warning,
everything works fine.
--
___
Python tracker
Roundup Robot added the comment:
New changeset 5f75eadecff1 by Zachary Ware in branch '2.7':
Issue #18604: Consolidated checks for GUI availability.
http://hg.python.org/cpython/rev/5f75eadecff1
New changeset eb361f69ddd1 by Zachary Ware in branch '3.4':
Issue #18604: Consolidated checks for
Ethan Furman added the comment:
Adam Polkasnik said:
Extraction works fine, the issue was that raise() was creating an exception,
and
stopping the whole extraction process.
That doesn't make sense. If an exception was stopping the whole extraction
process then
Francisco Martín Brugué added the comment:
The formatter module was deprecated in Python 3.4 and is scheduled
for removal in Python 3.6. See [1] and [2].
---
[1] https://docs.python.org/3/library/formatter.html#module-formatter
[2] https://docs.python.org/3/whatsnew/3.4.html#deprecated
Changes by Chris Rebert pyb...@rebertia.com:
--
nosy: +cvrebert
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21414
___
___
Python-bugs-list
Changes by Chris Rebert pyb...@rebertia.com:
--
nosy: +cvrebert
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21413
___
___
Python-bugs-list
Andrew Svetlov added the comment:
LGTM. Ping?
--
nosy: +asvetlov
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20544
___
___
Python-bugs-list
Changes by Chris Rebert pyb...@rebertia.com:
--
nosy: +cvrebert
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21347
___
___
Python-bugs-list
Brett Cannon added the comment:
Even with setting SourceFileLoader, you still don't get file lines back. Why?
Because all of the constructed objects in _frozen_importlib have their
co_filename set before the back-patching in importlib.__init__ and so when the
traceback module tries to do its
akira added the comment:
I've checked the same documentation patch applies to both default (3.5) and 2.7
branches.
There are no more instances of the misleading usage left (after applying the
patch).
--
___
Python tracker rep...@bugs.python.org
New submission from Derek Wilson:
If I create an argument parser like:
parser = argparse.ArgumentParser()
parser.add_argument('somebytes', type=bytes, help='i want some bytes')
parser.parse_args()
the parse_args() call will raise an exception printing usage info indicating
that an invalid
Stefan Krah added the comment:
Antoine, if you send me the buildbot credentials, we can get started.
Environment vars:
CC=clang
ASAN_OPTIONS=allocator_may_return_null=1,handle_segv=0
I suggest to compile the release build, just --with-address-sanitizer.
--
Éric Araujo added the comment:
Thanks for the report and patch!
I don't really see how just can be interpreted as applying to something else
than below, so I'm not sure the wording needs to be changed.
The typo should be fixed.
--
nosy: +eric.araujo
stage: - patch review
versions:
Éric Araujo added the comment:
I looked for a previous discussion of this on the Python mailing lists and
found nothing.
Existing solutions include https://twitter.com/snim2/status/393821419114483712
and
Éric Araujo added the comment:
Many features are indeed discussed on this bug tracker, but for a big change
like the one you propose we like to reach out to all of python-dev or all
people on python-ideas to discuss pros and cons. The devguide should explain
this in a little more detail.
I
Éric Araujo added the comment:
FTR https://docs.python.org/devguide/#proposing-changes-to-python-itself
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21405
___
Éric Araujo added the comment:
I think Walter is referring to Ned's coverage.py project, i.e. the standard
coverage module that you get with pip install coverage.
--
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21398
___
___
Python-bugs-list mailing
Éric Araujo added the comment:
I'm reclassifying this ticket as a doc bug, would you mind opening a separate
ticket for zipfile?
--
assignee: - docs@python
components: +Documentation -Library (Lib)
keywords: +easy
nosy: +docs@python, eric.araujo
stage: - needs patch
title:
Éric Araujo added the comment:
IMO either change would not improve the code at all. Suggest closing this.
--
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21391
___
New submission from Sworddragon:
This is a fork from this ticket: http://bugs.python.org/issue21404
tarfile has a compression level and seems to get now the missing documentation
for it. But there is still a compression level missing for zipfile.
--
components: Library (Lib)
messages:
Changes by Sworddragon sworddrag...@aol.com:
--
type: - enhancement
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21417
___
___
Python-bugs-list
Sworddragon added the comment:
Sure, here is the new ticket: http://bugs.python.org/issue21417
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21404
___
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21368
___
___
Python-bugs-list
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +alanmcintyre
stage: - needs patch
versions: +Python 3.5 -Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21417
___
Éric Araujo added the comment:
Thanks, your proposed wording sounds good to me. David (picked you
seni-randomly as a senior core dev and native speaker), what do you think?
--
nosy: +eric.araujo, r.david.murray
___
Python tracker
Changes by Ned Deily n...@acm.org:
--
nosy: +orsenthil
versions: -Python 3.1, Python 3.2, Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21413
___
Changes by Shawn binarycrusa...@gmail.com:
--
nosy: +swalker
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13405
___
___
Python-bugs-list mailing
Eric V. Smith added the comment:
I disagree. It took me longer than I'd like to admit to track down the file
history and understand it. I'd like to prevent other people from having to try
and understand why it works this way.
On the other hand, it looks like people have discovered it:
Terry J. Reedy added the comment:
Thank you Zach.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18604
___
___
Python-bugs-list mailing list
R. David Murray added the comment:
The precisionist in me isn't quite happy, but any wording I've come up with to
make it more precise isn't as informative :) (The 'real' situation is that the
return value of the function is determined by the last return statement
executed, which in turn is
Stefan Krah added the comment:
Why is the default encoding of POSIX wrong on a modern Linux system?
Today I installed Debian testing, and the first question of the
installer is to choose between C and English locales for the
install. This with the remark that the chosen locale will be
the
New submission from Robert Snoeberger:
While embedding the Python interpreter in an application, I have encountered a
crash when the built-in function 'super' is invoked with no arguments. The
crash occurs during a call to PyObject_Call.
A file is attached, super_invoke.c, that reproduces the
Adam Polkosnik added the comment:
Ethan,
I'd refer you to msg92309...
And
When testing with WinZip it looks like this:
No errors detected in compressed data of C:\Downloads\test.zip.
Testing ...
Testing test\OK
Testing test\test2.txt OK
Testing test1.txt
STINNER Victor added the comment:
LC_CTYPE=C: pydoc leaves terminal in an unusable state
In the use case, pydoc doesn't touch the terminal, it's the pager: the program
less. I don't see how to ensure that the terminal state is restored, even on
error.
--
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21412
___
___
Python-bugs-list
STINNER Victor added the comment:
LD_LIBRARY_PATH=/builds/jbeck/ul-python-3/components/python/python34/build/sparcv9
./python -E -S -m sysconfig --generate-posix-vars
Fatal Python error: PyThreadState_Get: no current thread
Could you please run this command in gdb and copy/paste the C
Changes by STINNER Victor victor.stin...@gmail.com:
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21393
___
Stefan Krah added the comment:
Thanks, Ned. I'm attaching a second version of the existing patch
with improved error handling and a fix for test_distutils, which
failed.
The result is slightly overcomplicated, so I came up with a
different approach in issue21121-3.diff. Thoughts?
--
Roundup Robot added the comment:
New changeset 8704198680ba by Victor Stinner in branch 'default':
Issue #21393: random.c: on Windows, close the hCryptProv handle at exit
http://hg.python.org/cpython/rev/8704198680ba
--
nosy: +python-dev
___
Python
Changes by Stefan Krah stefan-use...@bytereef.org:
Added file: http://bugs.python.org/file35134/issue21121-3.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21121
___
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21418
___
___
Python-bugs-list
Stefan Krah added the comment:
STINNER Victor rep...@bugs.python.org wrote:
I don't see how to ensure that the terminal state is restored, even on error.
Python2 suppresses the exception until after normal exit (pressing 'q').
I think that behavior is better.
In Python3 you can also get the
STINNER Victor added the comment:
heapq documentation contains François which is not encodable to ASCII. When
using LC_ALL=C, the locale encoding is ASCII (at least on Linux). It's not easy
to specify a different error handler globally in pydoc, different functions are
used and child
Roundup Robot added the comment:
New changeset 5b0fda8f5718 by Victor Stinner in branch 'default':
Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
http://hg.python.org/cpython/rev/5b0fda8f5718
--
nosy: +python-dev
___
Python
STINNER Victor added the comment:
There is no need to hurry.
I changed my mind :-p It should be easier for numpy to test the development
version of Python.
Let's wait for buildbots.
--
___
Python tracker rep...@bugs.python.org
New submission from STINNER Victor:
Attached patch modifies long_lshift() to allocate the result using calloc()
instead of malloc(). The goal is to avoid allocating physical memory for the
least significat digits (zeros). According to my tests in issue #21233
(calloc), Linux and Windows have
STINNER Victor added the comment:
bench_long_rshift.py: Microbenchmark for int int (lshift) operation. Results
on Linux:
Common platform:
Bits: int=32, long=64, long long=64, size_t=64, void*=64
Timer info: namespace(adjustable=False,
implementation='clock_gettime(CLOCK_MONOTONIC)',
Josh Rosenberg added the comment:
Looks like you forgot to actually use the use_calloc parameter you put in the
long_alloc prototype. It accepts it, but it's never used or passed to another
function. So right now, the only difference in behavior is that there is an
extra layer of function
Josh Rosenberg added the comment:
Given your benchmarks show improvements (you posted while I was typing my last
comment), I'm guessing it's just the posted patch that's wrong, and your local
changes actually use use_calloc?
--
___
Python tracker
STINNER Victor added the comment:
Without the patch, 1 (2**29) allocates 69.9 MB. With the patch, 1 (2**29)
allocates 0.1 MB (104 KB).
Without the patch,
$ ./python
Python 3.5.0a0 (default:5b0fda8f5718, May 2 2014, 22:47:06)
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux
import os
STINNER Victor added the comment:
Looks like you forgot to actually use the use_calloc parameter you put in the
long_alloc prototype. It accepts it, but it's never used or passed to another
function.
Oh f###, you're right. See new patch.
I ran again the new benchmark: my (updated) patch
STINNER Victor added the comment:
Without the patch, 1 (2**29) allocates 69.9 MB. With the patch, 1
(2**29) allocates 0.1 MB (104 KB).
This is still true with long_lshift2.patch (except that in my new test, it
allocates 196 kB).
--
___
Python
STINNER Victor added the comment:
Antoine Pitrou wrote:
The real use case I envision is with huge powers of two. If I write:
x = 2 ** 100
I created the issue #21419 for this idea.
--
___
Python tracker rep...@bugs.python.org
Josh Rosenberg added the comment:
While you're doing this, might it make sense to add a special case to long_pow
so it identifies cases where a (digit-sized) value with an absolute value equal
to a power of 2 is being raised to a positive integer exponent, and convert
said cases to equivalent
Josh Rosenberg added the comment:
I swear, I need to refresh before I post a long comment.
If this is slowing everything down a little just to make 1 (2 ** 29) faster
(and did you really mean 1 (1 29) ? :-) ), then I'd say drop it.
--
___
Python
Roundup Robot added the comment:
New changeset 62438d1b11c7 by Victor Stinner in branch 'default':
Issue #21233: Oops, Fix _PyObject_Alloc(): initialize nbytes before going to
http://hg.python.org/cpython/rev/62438d1b11c7
--
___
Python tracker
Josh Rosenberg added the comment:
One possible way to salvage it: Have you considered declaring long_alloc as
Py_LOCAL_INLINE, or, now that I've checked #5553, a macro for long_alloc, so it
gets inlined, and doesn't add the check overhead to everything (since properly
inlining with a constant
Josh Rosenberg added the comment:
And now that I'm thinking about it, the probable cause of the slowdown is that,
for any PyLongObject that's smaller than PAGESIZE (give or take), using Calloc
means calloc is just calling memset to zero the PyLongObject header and the
used part of the high
New submission from STINNER Victor:
The algorithm for 2 ** n (long_pow) is slower than 1 n algorithm
(long_lshift). I propose to compute x**y as 1y if x==2 and y = 0.
Attached patch implements this idea. According to my microbenchmark, it is 4x
faster to small power (2**0 .. 2**1024) and up
STINNER Victor added the comment:
Results of bench_pow2.py on Linux.
Common platform:
CPU model: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
Platform: Linux-3.13.9-200.fc20.x86_64-x86_64-with-fedora-20-Heisenbug
Timer: time.perf_counter
Python unicode implementation: PEP 393
Timer info:
STINNER Victor added the comment:
Oh, the patch implements another micro-optimization: (x 0) is x becomes
True. I included it in the same patch to reduce the overhead for 2 ** 0.
--
nosy: +josh.rosenberg, pitrou, serhiy.storchaka
___
Python tracker
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +mark.dickinson
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21420
___
___
Stefan Krah added the comment:
The patch works well BTW. We can create another issue for the
general misbehavior of pydoc with other exceptions.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21398
John Beck added the comment:
Victor: sure; see attached.
--
Added file: http://bugs.python.org/file35140/where.out
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21412
___
Éric Araujo added the comment:
I like issue21121-3.diff.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21121
___
___
Python-bugs-list mailing
Terry J. Reedy added the comment:
3.1 to 3.3 only get internet security patcches, and I don't believe this is
such an issue.
It is not clear from the title (a statement, not a request) and your text what
specific patch you would like. If you want to 'reopen a discussion', please
post on
Terry J. Reedy added the comment:
A reference to a non-existent attribute fails no matter who calls the function.
Stephen, can you suggest a patch, perhaps based on code in other functions that
try to access _default_root?
--
nosy: +terry.reedy
___
Changes by Terry J. Reedy tjre...@udel.edu:
--
versions: +Python 3.5
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21414
___
___
Python-bugs-list
Éric Araujo added the comment:
I have to agree the index pages are often frustrating for me too.
Not sure if this involves code changes in Sphinx itself or if we can improve
the markup in the Python docs sources.
--
nosy: +eric.araujo
___
Python
New submission from Josh Rosenberg:
Unlike the other collections ABCs, MappingView and its subclasses
(Keys|Items|Values)View don't define __slots__, so users inheriting them to
take advantage of the mix-in methods get a __dict__ and __weakref__, even if
they try to avoid it by declaring
Josh Rosenberg added the comment:
Hmm... First patch isn't generating a review diff (I'm guessing because my VM's
time sync went farkakte). Trying again.
--
Added file: http://bugs.python.org/file35142/slots_for_mappingview_abcs.patch
___
Python
Changes by Josh Rosenberg shadowranger+pyt...@gmail.com:
Removed file: http://bugs.python.org/file35141/slots_for_mappingview_abcs.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21421
___
Josh Rosenberg added the comment:
I also wrote a slightly more thorough patch that simplifies some of the method
implementations (largely just replacing a bunch of for/if/return True/False
else return False/True with any/all calls against a generator expression).
The one behavior difference
paul j3 added the comment:
I encountered a conflict when merging this patch with
http://bugs.python.org/issue15112. In my first testcase, 'cmd' and 'rest'
failed the 'required' test in phase one of 'intermixed'. That's because 15112
postponed parsing them (with nargs=0/suppressed).
I got
Nick Coghlan added the comment:
That's the problem - even on UTF-8 systems, Linux programs will often be
started in a misconfigured environment: the POSIX locale. Python 2 doesn't
try to interpret the binary data as text, so it doesn't care. Python 3
*does* care, since it automatically converts
Raymond Hettinger added the comment:
What is the use case for interspersing values? I've not run across anything
like it ever before.
--
assignee: - rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21414
Raymond Hettinger added the comment:
At first glance, this seems like a reasonable request.
I leave it open for comments for a while before proceeding.
--
assignee: - rhettinger
components: +Library (Lib)
nosy: +rhettinger
type: - enhancement
versions: +Python 3.5
Raymond Hettinger added the comment:
While this looks harmless, I seriously question whether it is an improvement.
For example, how is this any better?
-self.assertTrue(operator.setitem(a, 0, 2) is None)
+self.assertIsNone(operator.setitem(a, 0, 2))
This error message for
Terry J. Reedy added the comment:
The generic error message for the first is 'False is not true'. Clear but
useless. The error message for the second is the more specific 'representation
of object) is not None'. Since the expression was supposed to evaluate to
None, but did not, it would be
91 matches
Mail list logo