New submission from Ben Finney:
In `tokenize.detect_encoding` is the following code::
first = read_or_stop()
if first.startswith(BOM_UTF8):
# …
The `read_or_stop` function is defined as::
def read_or_stop():
try:
return readline()
except
Ben Finney added the comment:
Possibly related to issue9969.
--
___
Python tracker
<http://bugs.python.org/issue23297>
___
___
Python-bugs-list mailing list
Unsub
Ben Hoyt added the comment:
Victor, I'd love to push forward with this (I doubt it's going to make alpha 1
on February 8, but hopefully alpha 2 on March 8).
It seems pretty settled that we need to use the all-C version I've created,
especially for Linux.
Can you please review
Ben Hoyt added the comment:
Hi Victor, I thank you for your efforts here, especially your addition of
DirEntry.inode() and your work on the tests.
However, I'm a bit frustrated that you just re-implemented the whole thing
without discussion: I've been behind scandir and written
Ben Hoyt added the comment:
To continue the actual "which implementation" discussion: as I mentioned last
week in http://bugs.python.org/msg235458, I think the benchmarks above show
pretty clearly we should use the all-C version.
For background: PEP 471 doesn't add any new fun
Ben Hoyt added the comment:
Akari: yes, I'm aware of this, and it's definitely a concern to me -- it may be
that scandir has a bug with counting the size of certain non-file directory
entries, or my implementation of os.walk() via scandir is not quite correct.
I'll look at it
Ben Hoyt added the comment:
BTW, I replied to Victor privately, but for the thread: no worries, and apology
accepted! :-) I'm working on updating my C patch with his feedback, and will
update this issue hopefully in the next few days.
--
___
P
New submission from Ben Darnell:
The new collections.abc.Awaitable ABC relies on __instancecheck__, which makes
it incompatible with functools.singledispatch (singledispatch works based on
args[0].__class__; any instance-level information is discarded). This surprised
me because the first
Ben Darnell added the comment:
> 4. While this patch addresses initial request from Ben only partially
> (generator-based coroutines still require __instancecheck__),
A partial solution doesn't mean much to me: as long as the __instancecheck__ is
sometimes necessary, I
Ben Darnell added the comment:
On Tue, Jun 9, 2015 at 10:12 PM, Yury Selivanov
wrote:
>
> Yury Selivanov added the comment:
>
> > All this checking for coroutine-ness feels very strange to me. It's
> anti-duck-typing: [..]
>
> Why is it "anti-duck-typ
Ben Darnell added the comment:
GeneratorWrapper helps, but it fails when applied to non-generator functions
that return a value (while both tornado.gen.coroutine and asyncio.coroutine
take pains to support such usage). The "raise TypeError" should be removed;
just return the resu
Ben Darnell added the comment:
With the two changes I described things appear to be working, although I've
only done light testing so far.
For inspect.isgenerator(), my use case is here:
https://github.com/tornadoweb/tornado/blob/2971e857104f8d02fa9107a0e13f50170eb4f30d/tornado/gen.py#L2
Ben Darnell added the comment:
Yes, I can switch use the ABC instead, and I agree that it doesn't make sense
to have the inspect method if it's going to be equivalent to the ABC.
I'm happy with the outcome here but AFAIK the original issue still stands: the
Awaitable ABC is
Ben Darnell added the comment:
I don't think operator.getfuture() is possible because there are multiple ways
of turning an awaitable into a Future. asyncio has one way; tornado has another.
--
___
Python tracker
<http://bugs.python.org/is
Changes by Ben Finney :
--
nosy: +bignose
___
Python tracker
<http://bugs.python.org/issue24651>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ben Longbons:
The following code is allowed by the grammar of Python 3.4, but not Python 3.5:
`def f(): g(*a or b)`
where unary `*` has the lowest precedence, i.e. it is equivalent to:
`def f(): g(*(a or b))`
The cause of the regression that the 3.4 grammar for `arglist
Ben Longbons added the comment:
Related: bug 24176 fixed this for the `**` case.
--
___
Python tracker
<http://bugs.python.org/issue24791>
___
___
Python-bug
Ben Longbons added the comment:
Also consider:
*() or (), *() or ()
[*() or (), *() or ()]
{*() or (), *() or ()}
{**{} or {}, **{} or {}}
Note that the second-or-later argument is a separate part of the grammar so
that's why I wrote it twice.
Actually, I think `star_expr` will probab
Ben Longbons added the comment:
Code objects currently have no mutable fields.
So what are you planning to do about things like:
Foo = namedtuple('Foo', 'x y')
def frob(self):
return self.x + self.y
# probably actually done via a @member(Foo) decorator
# so adding mor
Ben Longbons added the comment:
I made a minimal gist of my motivating code:
https://gist.github.com/o11c/ce0c2ff74b87ea71ad46
--
___
Python tracker
<http://bugs.python.org/issue2
Ben Mather added the comment:
Sorry for slow response. I completely missed your reply.
I was working on a project that used a concurrent.futures thread pool but also
needed to listen to responses from a chip-and-pin card reader.
Payment sessions operated in three phases:
- check with card
Changes by Ben Finney :
--
nosy: +bignose
___
Python tracker
<http://bugs.python.org/issue25392>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ben Cipollini:
Gzip fails when opening a file more than 2**32 bytes. This is a new issue in
Python 3.5.
We hit this opening large neuroimaging files from the Human Connectome Project.
See https://github.com/nipy/nibabel/issues/362 for more details.
When size is > 2*
Ben Cipollini added the comment:
@Martin: yes, that reproduces the problem.
>I think the ideal fix would be to cap the limit at 2**32 - 1 in the zlib
>library.
If this cap is implemented, is there any workaround how we can efficiently open
gzipped files over 4GB? Such files exist, ex
New submission from Ben Schreib:
The example given in section 5.3 shows an output of "t[0] = 8" but I
believe it should be "t[0] = 12345"
>>> t
(12345, 54321, 'hello!')
>>> # Tuples may be nested:
... u = t, (1, 2, 3, 4, 5)
>>> u
((1
Ben Hoyt added the comment:
Just to clarify what Victor and Zachary mentioned: bytes filenames have been
deprecated only *on Windows* since Python 3.3; bytes filenames are still fine
on POSIX.
--
___
Python tracker
<http://bugs.python.
Ben Hoyt added the comment:
I'm not sure this is actually a leak, because (looking at the code)
ScandirIterator_close() is called not just in the destructor, but also at the
end of iterating, just before raising StopIteration. Is the issue that if an
exception is raised or you stop iter
Ben Hoyt added the comment:
Guido, it's true that in almost all cases you get the speedup (no system call),
and it's very much worth using. But the idea with the docs being non-committal
is because being specific would make the docs fairly complex. I believe it's as
follows for
Ben Hoyt added the comment:
Nice! Good to see scandir() getting used to speed up other functions, functions
that folks are using a ton already, like glob().
--
___
Python tracker
<http://bugs.python.org/issue25
Changes by Ben Hoyt :
--
nosy: +benhoyt
___
Python tracker
<http://bugs.python.org/issue26111>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ben Darnell:
The typing module docs at https://docs.python.org/3/library/typing.html do not
include everything that is documented in the PEP
(https://www.python.org/dev/peps/pep-0484/#the-typing-module). Specifically,
`AnyStr` is mentioned but not defined, the `@overload
New submission from Ben Hoyt:
Per Guido's comment about DirEntry documentation on Issue 26032, especially
http://bugs.python.org/issue26032#msg257665, it'd be good to improve the docs
of the scandir DirEntry methods with regard to symlinks and caching.
Attaching my stab at a documen
Ben Hoyt added the comment:
Guido, I've made some tweaks and improvements to the DirEntry docs here:
http://bugs.python.org/issue26248 -- the idea is to fix the issues you
mentioned to clarify when system calls are required with symlinks, mentioning
that the results are cached separatel
Ben Hoyt added the comment:
Thanks, Victor!
--
___
Python tracker
<http://bugs.python.org/issue26248>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ben Hoyt added the comment:
Seeing this has been merged (thanks Victor), can this issue be closed? Guido,
are you happy with the changes given your comments at
http://bugs.python.org/issue26032#msg257665?
--
___
Python tracker
<h
New submission from Ben Finney:
The security issues of `tempfile.mktemp` are clear when the return value is
used to create a filesystem entry. The documentation and docstrings (and even
some comments on past issues) are correct o deprecate its use for that purpose.
The function has a use
New submission from Ben Kummer:
ntpath.py throws an error in Python2.7.11 Windows
Code snippet:
product_dir ="/zope/eggs43"
my_tuple= os.path.split(product_dir)[:-1]
roduct_prefix = os.path.join(my_tuple )
The same code works in python 2.7.11 under Linux
Traceback:
C:\zope\selen
Ben Finney added the comment:
It has been pointed out that `tempfile.mktemp` does in fact access the
filesystem, to query whether the entry exists.
So this request would be best met by exposing a simple “get a new return value
from the `tempfile._RandomNameSequence` instance” function
Ben Finney added the comment:
An example::
import io
import tempfile
names = tempfile._get_candidate_names()
def test_frobnicates_configured_spungfile():
""" ‘foo’ should frobnicate the configured spungfile. """
fake_file_path = os
New submission from Ben Spiller:
It's well known that lots of people struggle writing correct programs using
non-ascii strings in python 2.x, but I think one of the main reasons for this
could be very easily fixed with a small addition to the documentation for
str.encode and unicode.d
Ben Finney added the comment:
> I have read the thread on Python-list
Thank you, and thanks for linking to that discussion.
> and still don't understand the purpose of your idea.
The purpose is to get a public API for making temporary filesystem paths with
the same properties as a
Ben Finney added the comment:
Serhiy Storchaka
> mktemp is deprecated, and I think we will get rid of it when 2.7 will be out
> of use.
That's fine. This is not a request to retain ‘tempfile.mktemp’.
I confused matters in my initial message, so your confusion is understandable
on
New submission from Ben Knight:
Python 3.5.1 x86-64, Windows 10
I created a translation map that translated some characters to None and others
to strings and found that in some cases str.translate() will duplicate one of
the untranslated characters in the returned string.
How to reproduce
New submission from Ben Finney:
The language reference carves out a special case for decimal zero literals:
they may have leading “0” digits. Non-zero decimal literals may not. This is
apparently deliberate:
Note that leading zeros in a non-zero decimal number are not allowed. This
is
Ben Finney added the comment:
> rationale unknown
That's quite a pity. The inconsistency catches people out, and the docs do not
make clear why an exception is made.
> but any number of zeroes is still unambiguously zero.
Of course. But the same is true for “0003 is unambiguously
Ben Finney added the comment:
Oz Tiram wrote:
> I doubt if the correct place for formatting a man page should be in
> argparse.py itself. My solution is an extension of Andial's brecht solution
Thank you for that, Oz.
I see an easy seam to refactor this work into separate con
Changes by Ben Finney :
--
versions: +Python 3.6 -Python 2.7
___
Python tracker
<http://bugs.python.org/issue14102>
___
___
Python-bugs-list mailing list
Unsub
Ben Spiller added the comment:
Thanks that's really helpful
Having thought about it some more, I think if possible it'd be really so much
better to actually 'fix' the behaviour for the unicode<->str standard codecs
(i.e. not base64) rather than just document
Ben Spiller added the comment:
yes the situation is loads better in python 3, this issue is specific to 2.x,
but like many people sadly we're not able to move to 3 for the time being.
Since making this mistake is quite common and there's some sensible behaviour
that would make it
Ben Spiller added the comment:
I'm proposing that str.encode() should _not_ throw a 'decode' exception for
non-ascii characters and be effectively a no-op, to match what it already does
for ascii characters - which therefore shouldn't break behavior anyone will be
dependi
New submission from Ben Finney:
The library documentation for ‘inspect.cleandoc’ describes the transformation
that occurs to “the second line onwards”, but makes no mention of what
processing occurs to the synopsis (first) line.
Please update the library documentation for this function, to
Ben Spiller added the comment:
btw If anyone can find the place in the code (sorry I tried and failed!) where
str.encode('utf-8', error=X) is resulting in an implicit call to the equivalent
of decode(defaultencoding, errors=strict) (as suggested by the exception
message) I thin
Ben Spiller added the comment:
Thanks for considering this, anyway. I'll admit I'm disappointed we couldn't
fix this on the 2.7 train, as to me fixing a method that takes an
errors='ignore' argument and then throws an exception anyway seems a little
more like
Ben Finney added the comment:
On Fri, May 27, 2016, at 02:58, Nathan Harold wrote:
> Here's my shot at a revision (corresponding patch attached):
Thanks for that. The only improvement I'd ask for is to more clearly
separate
the description into two paragraphs: overall description
Ben Hoyt added the comment:
Note that this (or a very similar issue) also affects os.listdir() on Windows:
os.listdir(bytes_path_with_nul) raises ValueError as expected, but
os.listdir(unicode_path_with_nul) does not. Test case:
>>> import os
>>> os.mkdir('foo')
Ben Hoyt added the comment:
Okay, here's the next version of the patch. I've updated scandir-2.patch with a
number of modifications and several fixes to the C code.
This includes Victor's scandir-6.patch test suite (with minor mods) and my
original documentation. Note that I ha
Ben Hoyt added the comment:
Sorry, but this is operating as designed and documented. See the docs here:
https://docs.python.org/3.4/library/os.path.html#os.path.join
"On Windows ... since there is a current directory for each drive,
os.path.join("c:", "foo") represen
New submission from Ben Darnell:
ssl.SSLError is a subclass of OSError but uses error codes that come from a
different scope than the standard errno constants and may have conflicts. For
example, on my system (OSX), ssl.SSL_ERROR_WANT_X509_LOOKUP and errno.EINTR
have the same value. This
Ben Hoyt added the comment:
Updated version of the patch after Victor's code review of scandir-7 and a
couple of his comments offline. Full commit log is available on my GitHub
project in posixmodule_scandir_main.c if anyone's interested. Again, I haven't
looked closely at th
Ben Hoyt added the comment:
Oops, I'm sorry re previous comment -- looks like I forgot to attach
scandir-8.patch. Now attached. Please re-read my previous comment and review.
:-)
--
Added file: http://bugs.python.org/file38374/scandir-8.
Ben Hoyt added the comment:
Attaching a first cut at this -- basically the implementation I use for walk()
in scandir.py on GitHub.
One thing that's really weird to me: are the os.walk() unit tests actually
being run? In test_os.py, I notice everything's in WalkTest.setUp, which
Ben Darnell added the comment:
I agree that SSLError should have used a different attribute, but it's too late
for that - changing it would break any code currently relying on SSL errnos (in
particular asynchronous code using the SSL_ERROR_WANT_{READ,WRITE} error codes
for normal oper
Ben Hoyt added the comment:
Same exact issue here. I didn't have a Python 3.5 alpha 1 previously installed,
and I tried running the installer normally and also (after uninstalling) with
right-click, "Run as administrator".
Both do the same thing for me: pop up a dialog bo
Ben Hoyt added the comment:
Hi Victor. I'm attaching a patch to the What's New doc. I know it's a minor
thing, but I really read the What's New in Python x.y page whenever it comes
out, so making this as specific as possible is good. The changes are:
1. Be more speci
Ben Hoyt added the comment:
Thanks. Will do!
--
___
Python tracker
<http://bugs.python.org/issue22524>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ben Hoyt added the comment:
@Scott Dial: just a response about this benchmark: note that this benchmark
isn't really valid, as it says "Using slower ctypes version of scandir", which
is the slow all-Python version. You want it to be saying "Using Python 3.5
Ben Hoyt added the comment:
To Victor and Serhiy:
1) Serhiy's point about not needing to build the symlinks set when followlinks
is True is a good one, because it'll never get used. Just a "if not
followlinks: ..." around that try/except would do it. Though this is a small
Ben Hoyt added the comment:
Note specifically in the unsymlink() example Serhiy gave, you probably don't
*want* os.walk() to recurse into a
symlink-to-a-directory-that's-changed-to-a-directory, and you probably haven't
thought about it doing so, so maybe the new be
Ben Hoyt added the comment:
Thanks, Victor.
I haven't quite grokked all the changes here -- it's gotten somewhat more
complicated with the scandir_it and manual next() call -- but I ran some
benchmarks (via a hacked version of my scandir project's benchmark.py). The
results
Ben Hoyt added the comment:
> I don't understand your benchmark. Do you mean that os.walk() is slower
> with fast_bottom-up.patch because islink() is called or because I replaced
> "for entry in scandir(top):" with "entry = next(scandir_it)"?
No, sorry, I w
Ben Hoyt added the comment:
Victor, great work on pushing this out, especially with the "modifying the
directories" fix. (And thanks Serhiy for pushing on correctness here.)
Couple of comments/questions about your new os.walk() implementation.
1) The new implementation is more c
Ben Hoyt added the comment:
Thanks for the explanation (and the comment fix).
> What's your point about complexity? Would you like to drop os.scandir
> changes in os.walk(), or do you have a simpler version to propose?
No, not at all! I was just noting it and trying to brainstorm
Ben Hoyt added the comment:
Yep, I'm good -- go ahead and close!
--
___
Python tracker
<http://bugs.python.org/issue23605>
___
___
Python-bugs-list m
New submission from Ben Hoyt:
Victor Stinner's documentation for os.scandir and DirEntry is a great start
(https://docs.python.org/dev/library/os.html#os.scandir), however there are a
few mistakes in it, and a few ways I think it could be improved. Attaching a
patch with the following ov
Ben Finney added the comment:
On 12-Oct-2016, Nick Coghlan wrote:
> In this case, I think just reporting the first failing item is fine,
> and mentioning the type of that item in the error message is the
> most useful additional information we can provide to make things
> easier to
Ben Finney added the comment:
On 16-Oct-2016, Roundup Robot wrote:
> New changeset 7dd0910e8fbf by Berker Peksag in branch '2.7':
> Issue #21720: Improve exception message when the type of fromlist is unicode
> https://hg.python.org/cpython/rev/7dd0910e8fbf
This is an improv
New submission from Tal Ben-Nun :
In Python 3.8, the "kind" field was introduced into the Constant AST class.
This brings about a problem when unparsing the AST for various packages. First,
it breaks backward compatibility for older code that creates ast.Num without
specifying kind
Change by Tal Ben-Nun :
--
versions: +Python 3.8
___
Python tracker
<https://bugs.python.org/issue39463>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ben Li-Sauerwine :
One would expect that calling TKinter.Tk.geometry(tk.winfo_geometry()) would be
idempotent. However, based on the system window frame, it is not and doing so
moves the window down the screen.
Running the example below reproduces the issue
Change by Ben Li-Sauerwine :
--
type: -> behavior
___
Python tracker
<https://bugs.python.org/issue40945>
___
___
Python-bugs-list mailing list
Unsubscrib
Ben Li-Sauerwine added the comment:
Thanks for clarifying. Using Tk.geometry() instead of Tk.winfo_geometry() does
indeed resolve the issue on Linux.
Weird that using Tk.winfo_geometry() is idempotent under Windows, though.
--
___
Python tracker
New submission from Oren Ben-Kiki:
In 3.6.0, invocation of isinstance calls
typing._ProtocolMeta._get_protocol_attrs.
This creates a set of all attributes in all base classes, loops on these
attributes to check they exist, and discards the set. It is very slow.
My program uses isinstance to
New submission from amjad ben hedhili :
It will be handy if there was an os or os.path function that returns the path
to the nth directory in a given path
for example:
given path =
"C:\Users\User\AppData\Local\Programs\Python\Python36\Lib\asyncio\__init__.py"
os.path.nthpath(path,
Change by amjad ben hedhili :
--
title: get the nth folder -> get the nth folder of a given path
___
Python tracker
<https://bugs.python.org/issue33102>
___
_
New submission from amjad ben hedhili :
It will be much of improvement for readability to write:
my_list = ["John", "Richard", "Alice", 1, True, 2.1, "End"]
a, b, c = my_list[1, 3, -1]
instead of:
my_list = ["John", "Richard", &
Change by amjad ben hedhili :
--
title: Syntax to get multiple items from an iterable -> Syntax to get multiple
arbitrary items from an iterable
___
Python tracker
<https://bugs.python.org/issu
New submission from Ariel Ben-Yehuda :
unicode formats (u'{:n}'.format) in python 2.x assume that the thousands
seperator is in ascii, so this fails:
>>> import locale
>>> locale.setlocale(locale.LC_NUMERIC, 'fra') # or fr_FR on UNIX
>>> u'
Ariel Ben-Yehuda added the comment:
I don't work on CPython
On Sat, Jul 7, 2012 at 6:57 PM, Martin v. Löwis wrote:
>
> Martin v. Löwis added the comment:
>
> Ariel: would you like to provide a patch?
>
> --
> nosy: +loewis
>
>
New submission from Ariel Ben-Yehuda :
Hello, I think there is a problem with Python 2.7: I installed it, and tried to
compile GObject-Introspection 0.9.2. Here is the result:
...
GISCAN GLib-2.0.gir
Traceback (most recent call last):
File "../tools/g-ir-scanner", line 36, in
Ariel Ben-Yehuda added the comment:
Bug or not bug, Python2.7 breaks Gobject-Introspection.
--
status: closed -> open
___
Python tracker
<http://bugs.python.org/iss
Ariel Ben-Yehuda added the comment:
My test on Class Methods was based on the GI Code that does not run on Python
2.7.
--
___
Python tracker
<http://bugs.python.org/issue9
Ariel Ben-Yehuda added the comment:
Done it for myself. However, I am not a GI Maintainer - you should talk with
them and send them this patch.
--
___
Python tracker
<http://bugs.python.org/issue9
New submission from Niv Ben-David:
The unittest.mock module defines a mock_open utility to mock the builtin open
function.
During a recent project I found I needed something more. Specifically, mocking
different files at the same time, better mocking for operations (like seek,
readlines, etc
Niv Ben-David added the comment:
Regarding the documentation changes, my version simply mocks `open` more
"closely", so for the most part I can't think of any changes to the
documentation. I've added a bit about the mock object acting as a map of file
names to mock o
Niv Ben-David added the comment:
I copied the code in place of the old mock_open in unittest/mock.py.
Regarding the VFS issue, I think that it really depends on what you're trying
to test. If you only care about "side effects" on the file system, the VFS way
it much better and
501 - 595 of 595 matches
Mail list logo