[issue32449] MappingView must inherit from Collection instead of Sized

2017-12-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: > After I generate an UML diagram from collections.abc, I found > very strange that MappingView inherit from Sized instead > of Collection (new in python 3.6). That isn't strange at all. MappingView predates Collection, so of

[issue32430] Simplify Modules/Setup{,.dist,.local}

2017-12-31 Thread Xavier de Gaye
Change by Xavier de Gaye : -- keywords: +patch pull_requests: +4938 stage: -> patch review ___ Python tracker ___

[issue32430] Simplify Modules/Setup{,.dist,.local}

2017-12-31 Thread Xavier de Gaye
Xavier de Gaye added the comment: The Setup files are configuration files, so their handling is different from the handling of Makefile.pre.in or the handling of the source files. The only reference to Setup.local in the Python documentation is at

[issue32449] MappingView must inherit from Collection instead of Sized

2017-12-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I concur with Raymond. MappingView is a public interface, not just a concrete implementation. Changing it will make third-party implementations of this interface not conforming it. -- nosy: +serhiy.storchaka

[issue30449] Improve __slots__ datamodel documentation

2017-12-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: mpb, I think the docs with respect to strings are fine as-is. Sometimes if too much detail is put in, it makes the docs harder to read and understand (i.e. it gets in the way of our primary purpose). --

[issue32462] mimetypes.guess_type() might be return None or a tuple with (type/subtype, encoding)

2017-12-31 Thread Cheryl Sabella
New submission from Cheryl Sabella : On a Windows 7 system, entering the following: >>> mime, encoding = mimetypes.guess_type('Untitled.sql') >>> mime 'text\\plain' Meaning, the return value is 'text\\plain' instead of 'text/plain'. Tracking this down, it's due

[issue32462] mimetypes.guess_type() returns incorrectly formatted type

2017-12-31 Thread Cheryl Sabella
Change by Cheryl Sabella : -- title: mimetypes.guess_type() might be return None or a tuple with (type/subtype, encoding) -> mimetypes.guess_type() returns incorrectly formatted type ___ Python tracker

[issue32463] problems with shutil.py and os.get_terminal_size

2017-12-31 Thread Nick McElwaine
New submission from Nick McElwaine : os.get_terminal_size() fails with () or (0) or (1) shutil.sys fails calling it with (sys.__stdout__.fileno()) because sys.__stdout__ is type None -- components: Windows messages: 309276 nosy: Dhruve, paul.moore, steve.dower,

[issue32462] mimetypes.guess_type() returns incorrectly formatted type

2017-12-31 Thread Cheryl Sabella
Change by Cheryl Sabella : -- keywords: +patch pull_requests: +4939 stage: -> patch review ___ Python tracker ___

[issue32464] raise NotImplemented vs return NotImplemented

2017-12-31 Thread Srinivas Reddy T
New submission from Srinivas Reddy T : I ran these queries on cpython repo. ➜ cpython git:(master) ✗ grep -r . -e return --include=\*.py | grep NotImplemented | wc -l 196 ➜ cpython git:(master) ✗ grep -r . -e raise --include=\*.py | grep NotImplemented

[issue32464] raise NotImplemented vs return NotImplemented

2017-12-31 Thread Mark Dickinson
Mark Dickinson added the comment: Here's the documentation, which I think explains all this clearly: briefly, `return NotImplemented` and `raise NotImplementedError` are the normal usages. `raise NotImplemented` doesn't make sense, and shouldn't be used: it'll end up

[issue32463] problems with shutil.py and os.get_terminal_size

2017-12-31 Thread Eryk Sun
Eryk Sun added the comment: The 3.5 branch only gets security fixes at this point. Consider upgrading to 3.6. That said, this shouldn't be a problem with shutil.get_terminal_size() in 3.5. It handles AttributeError, ValueError, and OSError by returning the `fallback`

[issue32449] MappingView must inherit from Collection instead of Sized

2017-12-31 Thread Yahya Abou Imran
Yahya Abou Imran added the comment: Hmm... Okay, I understand. So the only objection I have left, it's that ValuesView isn't passing the is instance of Collection test whereas it should, since he has the full behavior of one. It could be passed in its

[issue32430] Simplify Modules/Setup{,.dist,.local}

2017-12-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: I would hope to simplify the build process, not to complicate it. In other words, I think the PR is a step in the wrong direction, *except* if using Setup.dist becomes the default and the other way is clearly marked deprecated. --

[issue32430] Simplify Modules/Setup{,.dist,.local}

2017-12-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: Note the use case we're trying to preserve here is probably extremely rare. I've never needed it myself, and I've never seen it done by anyone else. We're talking about a very small demographics who's probably skilled enough to handle a

[issue32460] don't use tentative declarations

2017-12-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: Sounds like good hygiene to me, though I didn't know that "tentative declarations" were legacy (don't they simply mean the variable gets an arbitrary initialization value?). -- nosy: +pitrou ___

[issue32460] don't use tentative declarations

2017-12-31 Thread Benjamin Peterson
Benjamin Peterson added the comment: If no definition provides an initializer, they'll end up initialized to 0. The legacy part is that you can have multiple tentative definitions of a symbol and most unix linkers will merge them. --

[issue32460] don't use tentative declarations

2017-12-31 Thread Benjamin Peterson
Benjamin Peterson added the comment: New changeset 0a37a30037073a4a9ba45e560c8445048e5f2ba2 by Benjamin Peterson in branch 'master': closes bpo-32460: ensure all non-static globals have initializers (#5061)

[issue8525] Display exception's subclasses in help()

2017-12-31 Thread Sanyam Khurana
Sanyam Khurana added the comment: I've changed the version to 3.7. Not sure if this would need a backport since this is a new feature. So, I'll defer this call to a core developer. I've created a PR for the new feature. -- versions: +Python 3.7 -Python 3.2

[issue8525] Display exception's subclasses in help()

2017-12-31 Thread Sanyam Khurana
Change by Sanyam Khurana : -- pull_requests: +4940 stage: needs patch -> patch review ___ Python tracker ___

[issue32466] Remove fractions._gcd()

2017-12-31 Thread Gordon P. Hemsley
Gordon P. Hemsley added the comment: Indeed, that is the code fragment I was referring to. Mathematically speaking, a rational number is one that can be expressed as a fraction of two integers, so in that regard the numerator and the denominator should both be

[issue32453] shutil.rmtree can have O(n^2) performance on large dirs

2017-12-31 Thread Niklas Hambüchen
Niklas Hambüchen added the comment: Serhiy, did you run your benchmark on an SSD or a spinning disk? The coreutils bug mentions that the problem is seek times. My tests on a spinning disk with 400k files suggest that indeed rmtree() is ~30x slower than `rm -r`: # time

[issue32469] Generator and coroutine repr could be more helpful

2017-12-31 Thread Antoine Pitrou
New submission from Antoine Pitrou : Currently, a generator or coroutine's repr looks like this: >>> gen It could instead be something like: >>> gen (replace "suspended" with "running" or "closed" depending on the generator's status -- i.e. gi_running and gi_frame

[issue32453] shutil.rmtree can have O(n^2) performance on large dirs

2017-12-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: Did you try to sync and flush caches before running `rm -r`? -- ___ Python tracker ___

[issue30449] Improve __slots__ datamodel documentation

2017-12-31 Thread mpb
mpb added the comment: @rhettinger I disagree (but you're the boss). If a function can take type X as a parameter, I believe docs should also say what the expected behavior is when you call the function and pass it type X, especially when type X is fundamentally

[issue32468] Frame repr should be more helpful

2017-12-31 Thread Antoine Pitrou
New submission from Antoine Pitrou : Currently a frame's repr looks like this: >>> f It would be more helpful if it displayed something like: >>> f -- components: Interpreter Core messages: 309298 nosy: pitrou, serhiy.storchaka, yselivanov priority: normal severity:

[issue32466] Remove fractions._gcd()

2017-12-31 Thread Mark Dickinson
Mark Dickinson added the comment: > In what scenario would the numerator and denominator be numbers.Rational but > not an integer or a fraction But that's not the issue here. The issue here is having an instance of `numbers.Rational` whose numerator and denominator are

[issue32468] Frame repr should be more helpful

2017-12-31 Thread Antoine Pitrou
Change by Antoine Pitrou : -- keywords: +patch pull_requests: +4941 stage: -> patch review ___ Python tracker ___

[issue32468] Frame repr should be more helpful

2017-12-31 Thread Antoine Pitrou
Change by Antoine Pitrou : -- nosy: +benjamin.peterson ___ Python tracker ___ ___

[issue32468] Frame repr should be more helpful

2017-12-31 Thread Yury Selivanov
Yury Selivanov added the comment: +1 -- ___ Python tracker ___ ___ Python-bugs-list

[issue32453] shutil.rmtree can have O(n^2) performance on large dirs

2017-12-31 Thread Niklas Hambüchen
Niklas Hambüchen added the comment: It turns out I was wrong when saying that there's some cache we're hitting. In fact, `rm -r` is still precisely O(n^2), even with the coreutils patch I linked. Quick overview table of the benchmark: nfiles real user sys

[issue32466] Remove fractions._gcd()

2017-12-31 Thread Mark Dickinson
Mark Dickinson added the comment: Here's a concrete example, using gmpy2 [1], that exercises the code path you're proposing to remove. I had to cheat a bit, since the gmpy2 types *don't* (currently) buy in to the numbers ABC tower (though there's no good reason that they

[issue32466] Remove fractions._gcd()

2017-12-31 Thread Mark Dickinson
Mark Dickinson added the comment: > if math.gcd() only accepts integers and not, at least, numbers.Integral, > wouldn't that be a bug? I'd call it an enhancement opportunity rather than a bug. :-) There's no general Python-wide requirement that an instance of

[issue32466] Remove fractions._gcd()

2017-12-31 Thread Mark Dickinson
Mark Dickinson added the comment: > but it would result in a behaviour change: for the above code, we'd get a > `Fraction` whose numerator and denominator were both of actual type `int` > instead of `mpz` Ah, sorry. That's not true in this particular case. The returned

[issue32453] shutil.rmtree can have O(n^2) performance on large dirs

2017-12-31 Thread Niklas Hambüchen
Niklas Hambüchen added the comment: > Did you try to sync and flush caches before running `rm -r`? Yes, it doesn't make a difference for me, I still see the same O(n²) behaviour in `rm -r`. I've sent an email "O(n^2) performance of rm -r" to bug-coreut...@gnu.org just now,

[issue32466] Remove fractions._gcd()

2017-12-31 Thread Gordon P. Hemsley
Gordon P. Hemsley added the comment: Side note: https://github.com/aleaxit/gmpy/issues/127 suggests that the types in question were added to the numeric tower for gmpy 2.0.9 and 2.1.0. -- ___ Python tracker

[issue32466] Remove fractions._gcd()

2017-12-31 Thread Gordon P. Hemsley
Gordon P. Hemsley added the comment: So, if I'm understanding your position correctly: * We're back to needing a test for the line in question. * We're eschewing the possibility of changing the behavior of `fractions.Fraction` to force int numerator and denominator.

[issue32468] Frame repr should be more helpful

2017-12-31 Thread Antoine Pitrou
Change by Antoine Pitrou : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue32468] Frame repr should be more helpful

2017-12-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: New changeset 14709144b521b9916f798a43aac9dc44fd44f6ca by Antoine Pitrou in branch 'master': bpo-32468: Better frame repr() (#5067) https://github.com/python/cpython/commit/14709144b521b9916f798a43aac9dc44fd44f6ca --

[issue32470] Unexpected behavior of struct.pack

2017-12-31 Thread Luka Malisa
Change by Luka Malisa : -- components: Library (Lib) nosy: Luka Malisa priority: normal severity: normal status: open title: Unexpected behavior of struct.pack type: behavior versions: Python 2.7, Python 3.5 ___ Python tracker

[issue32470] Unexpected behavior of struct.pack

2017-12-31 Thread Luka Malisa
New submission from Luka Malisa : >>> import struct >>> struct.pack("IB", 1, 1) b'\x01\x00\x00\x00\x01' >>> struct.pack("BI", 1, 1) b'\x01\x00\x00\x00\x01\x00\x00\x00' -- ___ Python tracker

[issue32470] Unexpected behavior of struct.pack

2017-12-31 Thread Benjamin Peterson
Benjamin Peterson added the comment: That's because of alignment. See https://docs.python.org/3/library/struct.html#struct-alignment -- nosy: +benjamin.peterson resolution: -> not a bug stage: -> resolved status: open -> closed

[issue32469] Generator and coroutine repr could be more helpful

2017-12-31 Thread Taras Matsyk
Change by Taras Matsyk : -- keywords: +patch pull_requests: +4942 stage: -> patch review ___ Python tracker ___

[issue32469] Generator and coroutine repr could be more helpful

2017-12-31 Thread Taras Matsyk
Taras Matsyk added the comment: I have added a pull request. Hope it makes sense and I've done everything correctly :) Happy New Year! -- nosy: +tarasmatsyk ___ Python tracker

[issue32465] [urllib] proxy_bypass_registry - extra error handling required for ProxyOverride, Windows under proxy environment

2017-12-31 Thread chansol kim
New submission from chansol kim : [Problem] - String value from registry Proxy override is read and incorrectly decides the current connection requires not to use proxy. [Setup] - Using urllib under proxy environment. - Proxy bypass settings are in place. ProxyOverride

[issue32430] Simplify Modules/Setup{,.dist,.local}

2017-12-31 Thread Xavier de Gaye
Xavier de Gaye added the comment: > and I've never seen it done by anyone else In msg294174 Thomas says he intends to use it for Python at Google in order to "avoid third-party libraries even when they are available on the build system". I do not have a strong opinion

[issue32466] Remove fractions._gcd()

2017-12-31 Thread Gordon P. Hemsley
New submission from Gordon P. Hemsley : I noticed that there was a single line of Lib/fractions.py that did not have test coverage: the normalize step for fractions with non-integer numerators and/or denominators. I initially was going to implement a test for that

[issue32462] mimetypes.guess_type() returns incorrectly formatted type

2017-12-31 Thread R. David Murray
R. David Murray added the comment: You can get the same "bad" behavior on a posix system by having a mimetypes file with an incorrect entry in it. That would be a system misconfiguration, as is your Windows registry case, and is outside of Python's control. I suppose

[issue32430] Simplify Modules/Setup{,.dist,.local}

2017-12-31 Thread Xavier de Gaye
Xavier de Gaye added the comment: Yes 3.8 and this leaves plenty of time for writing some documentation on the build process :-) -- ___ Python tracker

[issue32467] dict_values isn't considered a Collection nor a Container

2017-12-31 Thread Yahya Abou Imran
New submission from Yahya Abou Imran : a `dict_values` instance behaves like a Collection (a Sized Iterable Container): >>> values = {1: 'one', 2: 'two'}.values() >>> 'two' in values True >>> 'three' in values False >>> for value in values: print(value) one two

[issue32430] Simplify Modules/Setup{,.dist,.local}

2017-12-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: First, I would count Google in the extremely skilled category :-) (cc'ing Thomas so that he can chime in) Second, if someone are doing a custom build of Python, they are very likely modifying something else than Modules/Setup (*). So they

[issue32430] Simplify Modules/Setup{,.dist,.local}

2017-12-31 Thread Antoine Pitrou
Antoine Pitrou added the comment: > It is annoying that there is no documentation on the build process that can > be modified to describe the deprecation in details. Do you think a What'sNew > entry is sufficient ? Yes, I think so. Also my hope is to remove it in 3.8 :-)

[issue32466] Remove fractions._gcd()

2017-12-31 Thread Mark Dickinson
Mark Dickinson added the comment: > [...] I cannot envision a scenario where that would be possible [...] I don't think it can be ruled out. If I'm reading the code right, it's preceded by this branch of the initial if/elif chain: elif (isinstance(numerator,

[issue32445] Skip creating redundant wrapper functions in ExitStack.callback

2017-12-31 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I think I am missing something because the callbacks are always called with (exc_type, exc, tb) (check here https://github.com/python/cpython/blob/176baa326be4ec2dc70ca0c054b7e2ab7ca6a9cf/Lib/contextlib.py#L475) and therefore a

[issue32453] shutil.rmtree can have O(n^2) performance on large dirs

2017-12-31 Thread Niklas Hambüchen
Niklas Hambüchen added the comment: OK, my coreutils email is at http://lists.gnu.org/archive/html/bug-coreutils/2017-12/msg00054.html -- ___ Python tracker

[issue32471] Add an UML class diagram to the collections.abc module documentation

2017-12-31 Thread Yahya Abou Imran
New submission from Yahya Abou Imran : >From python-ideas: >https://mail.python.org/pipermail/python-ideas/2017-December/048492.html In this page of the documentation: https://docs.python.org/3/library/collections.abc.html The table could be difficult to

[issue32471] Add an UML class diagram to the collections.abc module documentation

2017-12-31 Thread Yahya Abou Imran
Yahya Abou Imran added the comment: Here is the .puml -- Added file: https://bugs.python.org/file47358/base.puml ___ Python tracker

[issue32474] argparse nargs should support string wrapped integers too

2017-12-31 Thread Shubham Sharma
Shubham Sharma added the comment: nargs can take various values like "*", "+", etc. but doesn't support integers which are wrapped around in strings. Say, I want to take a user input for the nargs value (just a hypothetical situation); now I'll have to check

[issue32474] argparse nargs should support string wrapped integers too

2017-12-31 Thread Shubham Sharma
Change by Shubham Sharma : -- components: Library (Lib) nosy: shubham1172 priority: normal severity: normal status: open title: argparse nargs should support string wrapped integers too type: enhancement versions: Python 2.7, Python 3.4, Python 3.5, Python

[issue32474] argparse nargs should support string wrapped integers too

2017-12-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Values like "1", "2", "3", should be supported. You mean you want to call parser.add_argument('--foo', nargs="2") instead of parser.add_argument('--foo', nargs=2)? Why? -- ___

[issue32472] Mention of __await__ missing in Coroutine Abstract Methods

2017-12-31 Thread Yahya Abou Imran
New submission from Yahya Abou Imran : In the collections.abc documentation: https://docs.python.org/3/library/collections.abc.html __await__() doesn't appear in the abstract methods of Coroutine, we see only send() and throw(). But since Coroutine inherit

[issue32474] argparse nargs should support string wrapped integers too

2017-12-31 Thread R. David Murray
R. David Murray added the comment: Why? What's the motivation for supporting this? There's no reason that I can think of, so I'm curious what your use case is. -- nosy: +r.david.murray ___ Python tracker

[issue32474] argparse nargs should support string wrapped integers too

2017-12-31 Thread Steven D'Aprano
New submission from Steven D'Aprano : What do you mean by "string wrapped integers", and how should it support them? -- nosy: +steven.daprano ___ Python tracker

[issue32473] Readibility of ABCMeta._dump_registry()

2017-12-31 Thread Yahya Abou Imran
New submission from Yahya Abou Imran : >From python-ideas: https://mail.python.org/pipermail/python-ideas/2017-December/048504.html In python 2.7, ABCs's caches and registries are sets. But in python 3.6 they are WeakSet. In consequence, the output of

[issue32474] argparse nargs should support string wrapped integers too

2017-12-31 Thread Shubham Sharma
Shubham Sharma added the comment: Values like "1", "2", "3", should be supported. -- ___ Python tracker ___

[issue32474] argparse nargs should support string wrapped integers too

2017-12-31 Thread Shubham Sharma
Shubham Sharma added the comment: A simple int(nargs) would be sufficient. I am getting ready with a PR in some time. -- ___ Python tracker