[issue23296] ‘tokenize.detect_encoding’ is confused between text and bytes: no ‘startswith’ method on a byte string

2015-01-21 Thread Ben Finney
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

[issue23297] ‘tokenize.detect_encoding’ is confused between text and bytes: no ‘startswith’ method on a byte string

2015-01-21 Thread Ben Finney
Ben Finney added the comment: Possibly related to issue9969. -- ___ Python tracker <http://bugs.python.org/issue23297> ___ ___ Python-bugs-list mailing list Unsub

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-02-05 Thread Ben Hoyt
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

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-02-12 Thread Ben Hoyt
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

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-02-12 Thread Ben Hoyt
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

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-02-13 Thread Ben Hoyt
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

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-02-18 Thread Ben Hoyt
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

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-06 Thread Ben Darnell
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

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-09 Thread Ben Darnell
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

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-09 Thread Ben Darnell
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

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-09 Thread Ben Darnell
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

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-10 Thread Ben Darnell
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

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-30 Thread Ben Darnell
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

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-07-03 Thread Ben Darnell
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

[issue24651] Mock.assert* API is in user namespace

2015-07-21 Thread Ben Finney
Changes by Ben Finney : -- nosy: +bignose ___ Python tracker <http://bugs.python.org/issue24651> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue24791] *args regression

2015-08-04 Thread Ben Longbons
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

[issue24791] *args regression

2015-08-04 Thread Ben Longbons
Ben Longbons added the comment: Related: bug 24176 fixed this for the `**` case. -- ___ Python tracker <http://bugs.python.org/issue24791> ___ ___ Python-bug

[issue24791] *args regression

2015-08-04 Thread Ben Longbons
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

[issue2786] Names in traceback should have class names, if they're methods

2015-08-25 Thread Ben Longbons
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

[issue2786] Names in traceback should have class names, if they're methods

2015-08-25 Thread Ben Longbons
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

[issue22729] `wait` and `as_completed` depend on private api

2015-09-21 Thread Ben Mather
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

[issue25392] setup.py --quiet doesn't silence "no previously-included directories" warnings from MANIFEST.in

2015-10-13 Thread Ben Finney
Changes by Ben Finney : -- nosy: +bignose ___ Python tracker <http://bugs.python.org/issue25392> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue25626] Gzip fails for file over 2**32 bytes

2015-11-14 Thread Ben Cipollini
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*

[issue25626] Gzip fails for file over 2**32 bytes

2015-11-15 Thread Ben Cipollini
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

[issue25808] The Python Tutorial 5.3. Tuples and Sequences

2015-12-05 Thread Ben Schreib
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

[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows

2015-12-21 Thread Ben Hoyt
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.

[issue25994] File descriptor leaks in os.scandir()

2016-01-02 Thread Ben Hoyt
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

[issue26032] Use scandir() to speed up pathlib globbing

2016-01-06 Thread Ben Hoyt
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

[issue25596] Use scandir() to speed up the glob module

2016-01-11 Thread Ben Hoyt
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

[issue26111] On Windows, os.scandir will keep a handle on the directory until the iterator is exhausted

2016-01-14 Thread Ben Hoyt
Changes by Ben Hoyt : -- nosy: +benhoyt ___ Python tracker <http://bugs.python.org/issue26111> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26141] typing module documentation incomplete

2016-01-17 Thread Ben Darnell
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

[issue26248] Improve scandir DirEntry docs, especially re symlinks and caching

2016-01-31 Thread Ben Hoyt
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

[issue26032] Use scandir() to speed up pathlib globbing

2016-01-31 Thread Ben Hoyt
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

[issue26248] Improve scandir DirEntry docs, especially re symlinks and caching

2016-02-01 Thread Ben Hoyt
Ben Hoyt added the comment: Thanks, Victor! -- ___ Python tracker <http://bugs.python.org/issue26248> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26248] Improve scandir DirEntry docs, especially re symlinks and caching

2016-02-05 Thread Ben Hoyt
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

[issue26362] Approved API for creating a temporary file path

2016-02-14 Thread Ben Finney
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

[issue26365] ntpath.py Error in Windows

2016-02-15 Thread Ben Kummer
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

[issue26362] Approved API for creating a temporary file path

2016-02-15 Thread Ben Finney
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

[issue26362] Approved API for creating a temporary file path

2016-02-15 Thread Ben Finney
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

[issue26369] doc for unicode.decode and str.encode is unnecessarily confusing

2016-02-16 Thread Ben Spiller
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

[issue26362] Approved API for creating a temporary file path

2016-02-29 Thread Ben Finney
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

[issue26362] Approved API for creating a temporary file path

2016-02-29 Thread Ben Finney
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

[issue26464] str.translate() unexpectedly duplicates untranslated characters

2016-03-01 Thread Ben Knight
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

[issue26490] Leading “0” allowed, only for decimal zero

2016-03-05 Thread Ben Finney
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

[issue26490] Leading “0” allowed, only for decimal zero

2016-03-05 Thread Ben Finney
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

[issue14102] argparse: add ability to create a man page

2016-03-08 Thread Ben Finney
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

[issue14102] argparse: add ability to create a man page

2016-03-08 Thread Ben Finney
Changes by Ben Finney : -- versions: +Python 3.6 -Python 2.7 ___ Python tracker <http://bugs.python.org/issue14102> ___ ___ Python-bugs-list mailing list Unsub

[issue26369] unicode.decode and str.encode are unnecessarily confusing for non-ascii

2016-05-12 Thread Ben Spiller
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

[issue26369] unicode.decode and str.encode are unnecessarily confusing for non-ascii

2016-05-12 Thread Ben Spiller
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

[issue26369] unicode.decode and str.encode are unnecessarily confusing for non-ascii

2016-05-12 Thread Ben Spiller
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

[issue27043] Describe what ‘inspect.cleandoc’ does to synopsis line.

2016-05-16 Thread Ben Finney
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

[issue26369] unicode.decode and str.encode are unnecessarily confusing for non-ascii

2016-05-19 Thread Ben Spiller
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

[issue26369] unicode.decode and str.encode are unnecessarily confusing for non-ascii

2016-05-20 Thread Ben Spiller
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

[issue27043] Describe what ‘inspect.cleandoc’ does to synopsis line.

2016-05-26 Thread Ben Finney
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

[issue13617] Reject embedded null characters in wchar* strings

2015-02-26 Thread Ben Hoyt
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')

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-02-27 Thread Ben Hoyt
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

[issue23535] os.path.join() wrong concatenation of "C:" on Windows

2015-02-27 Thread Ben Hoyt
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

[issue23588] Errno conflicts in ssl.SSLError

2015-03-04 Thread Ben Darnell
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

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-03-05 Thread Ben Hoyt
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

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-03-07 Thread Ben Hoyt
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.

[issue23605] Use the new os.scandir() function in os.walk()

2015-03-07 Thread Ben Hoyt
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

[issue23588] Errno conflicts in ssl.SSLError

2015-03-07 Thread Ben Darnell
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

[issue23619] Python 3.5.0a2 installer fails

2015-03-09 Thread Ben Hoyt
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

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-03-10 Thread Ben Hoyt
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

[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2015-03-10 Thread Ben Hoyt
Ben Hoyt added the comment: Thanks. Will do! -- ___ Python tracker <http://bugs.python.org/issue22524> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23605] Use the new os.scandir() function in os.walk()

2015-03-11 Thread Ben Hoyt
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&#

[issue23605] Use the new os.scandir() function in os.walk()

2015-03-11 Thread Ben Hoyt
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

[issue23605] Use the new os.scandir() function in os.walk()

2015-03-11 Thread Ben Hoyt
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

[issue23605] Use the new os.scandir() function in os.walk()

2015-03-12 Thread Ben Hoyt
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

[issue23605] Use the new os.scandir() function in os.walk()

2015-03-13 Thread Ben Hoyt
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

[issue23605] Use the new os.scandir() function in os.walk()

2015-03-26 Thread Ben Hoyt
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

[issue23605] Use the new os.scandir() function in os.walk()

2015-03-30 Thread Ben Hoyt
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

[issue23605] Use the new os.scandir() function in os.walk()

2015-03-30 Thread Ben Hoyt
Ben Hoyt added the comment: Yep, I'm good -- go ahead and close! -- ___ Python tracker <http://bugs.python.org/issue23605> ___ ___ Python-bugs-list m

[issue24013] Improve os.scandir() and DirEntry documentation

2015-04-19 Thread Ben Hoyt
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

[issue21720] "TypeError: Item in ``from list'' not a string" message

2016-10-12 Thread Ben Finney
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

[issue21720] "TypeError: Item in ``from list'' not a string" message

2016-10-16 Thread Ben Finney
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

[issue39463] ast.Constant, bytes, and ast.unparse

2020-01-27 Thread Tal Ben-Nun
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

[issue39463] ast.Constant, bytes, and ast.unparse

2020-01-27 Thread Tal Ben-Nun
Change by Tal Ben-Nun : -- versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue39463> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40945] TKinter.Tk.geometry(Tk.winfo_geometry()) should be idempotent

2020-06-10 Thread Ben Li-Sauerwine
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

[issue40945] TKinter.Tk.geometry(Tk.winfo_geometry()) should be idempotent

2020-06-10 Thread Ben Li-Sauerwine
Change by Ben Li-Sauerwine : -- type: -> behavior ___ Python tracker <https://bugs.python.org/issue40945> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue40945] TKinter.Tk.geometry(Tk.winfo_geometry()) should be idempotent

2020-06-12 Thread Ben Li-Sauerwine
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

[issue30505] Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance

2017-05-29 Thread Oren Ben-Kiki
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

[issue33102] get the nth folder

2018-03-19 Thread amjad ben hedhili
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,

[issue33102] get the nth folder of a given path

2018-03-19 Thread amjad ben hedhili
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> ___ _

[issue33103] Syntax to get multiple items from an iterable

2018-03-19 Thread amjad ben hedhili
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", &

[issue33103] Syntax to get multiple arbitrary items from an iterable

2018-03-19 Thread amjad ben hedhili
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

[issue15276] unicode format does not really work in Python 2.x

2012-07-07 Thread Ariel Ben-Yehuda
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'

[issue15276] unicode format does not really work in Python 2.x

2012-07-07 Thread Ariel Ben-Yehuda
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 > >

[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Ariel Ben-Yehuda
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

[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Ariel Ben-Yehuda
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

[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Ariel Ben-Yehuda
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

[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Ariel Ben-Yehuda
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

[issue25690] Replacement for unittest.mock.mock_open

2015-11-21 Thread Niv Ben-David
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

[issue25690] Replacement for unittest.mock.mock_open

2016-01-30 Thread Niv Ben-David
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

[issue25690] Replacement for unittest.mock.mock_open

2016-03-15 Thread Niv Ben-David
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

<    1   2   3   4   5   6