[issue33041] Issues with "async for"

2018-03-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm surprised, but seems PR 6154 fixes the whole issue 3 in 3.7. It keeps only one POP_BLOCK corresponding to SETUP_LOOP. It also make the generated bytecode a tiny bit more efficient (less jumps). -- ___ Python

[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-19 Thread Berker Peksag
Berker Peksag added the comment: New changeset 2cb4661707818cfd92556e7fdf9068a993577002 by Berker Peksag (Matt Eaton) in branch 'master': bpo-33034: Improve exception message when cast fails for {Parse,Split}Result.port (GH-6078) https://github.com/python/cpython/commit/2cb4661707818cfd92556e

[issue32872] backport of #32305 causes regressions in various packages

2018-03-19 Thread Matthias Klose
Matthias Klose added the comment: reopening. Lib/test/libregrtest/setup.py still needs fixing at least on 3.6, I didn't check the trunk. libregrtest/setup.py: 60c60 < if hasattr(module, '__file__'): --- > if getattr(module, '__file__', None): -- stage: -> patch revi

[issue33041] Issues with "async for"

2018-03-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +5912 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-19 Thread Eryk Sun
Eryk Sun added the comment: > the way `python -m pip` searches for the module to execute is much > closer to the way Windows searches for a command like `pip` (i.e. > current directory first) That's classic Windows behavior. However, search paths for CreateProcess and the loader are composed

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-19 Thread Tim Peters
Tim Peters added the comment: Mark, how about writing a clever single-rounding dot product that merely _detects_ when it encounters troublesome cases? If so, it can fall back to a (presumably) much slower method. For example, like this for the latter: def srdp(xs, ys): "Single r

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset 3d41f482594b6aab12a316202b3c06757262109a by Eric V. Smith (Miss Islington (bot)) in branch '3.7': bpo-33100: Dataclasses now handles __slots__ and default values correctly. (GH-6152) (GH-6153) https://github.com/python/cpython/commit/3d41f482594b

[issue33094] dataclasses: ClassVar attributes are not working properly

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: Are there any remaining issues here? If not, I'm going to close this issue. -- status: open -> pending ___ Python tracker ___ _

[issue33105] os.path.isfile returns false on Windows when file path is longer than 260 characters

2018-03-19 Thread Eryk Sun
Eryk Sun added the comment: > If you use os.listdir() on the networked folder, the log file > will come up. Querying a file's parent directory (e.g. via os.scandir in Python 3) can provide a basic stat (i.e. attributes, reparse tag, size, and timestamps) when opening the file directly fails.

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

2018-03-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, there is already a way to do this but it involves the extra step of applying map() to a bound method: >>> my_list = ["John", "Richard", "Alice", 1, True, 2.1, "End"] >>> a, b, c = map(my_list.__getitem__, [1, 3, -1]) >>> a 'Richard' >>> b 1 >>> c 'End

[issue1467929] %-formatting and dicts

2018-03-19 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: eric.smith -> ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset 7389fd935c95b4b6f094312294e703ee0de18719 by Eric V. Smith in branch 'master': bpo-33100: Dataclasses now handles __slots__ and default values correctly. (GH-6152) https://github.com/python/cpython/commit/7389fd935c95b4b6f094312294e703ee0de18719

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread miss-islington
Change by miss-islington : -- pull_requests: +5911 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue33105] os.path.isfile returns false on Windows when file path is longer than 260 characters

2018-03-19 Thread Eryk Sun
Eryk Sun added the comment: Python 2.7 is all but set in stone. Changes to its behavior have to correct serious bugs, not work around limits in an OS. You can do that yourself. For example, use an extended local-device path, i.e. a path that's prefixed by u"?\\". This path type must be un

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +5910 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-lis

[issue33087] No reliable clean shutdown method

2018-03-19 Thread Brett Cannon
Change by Brett Cannon : -- type: behavior -> enhancement versions: +Python 3.8 -Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker ___ _

[issue3405] Add support for the new data option supported by event generate (Tk 8.5)

2018-03-19 Thread Matthias Kievernagel
Change by Matthias Kievernagel : -- nosy: +mkiever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks, but I'm already looking at this in the context of a different bug. -- ___ Python tracker ___ __

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Adrian Stachlewski
Adrian Stachlewski added the comment: There's also another major problem. Because Base.x has value, __init__ is not prepared correctly (member_descriptor is passed as default). @dataclass class Base: __slots__ = ('x',) x: Any Base() # No TypeError exception Fixing this should be qu

[issue33106] Deleting a key in a read-only gdbm results in KeyError, not gdbm.error

2018-03-19 Thread sds
sds added the comment: Same problem with 3.6.4, start with >>> from dbm import gnu as gdbm then the same incorrect behavior -- versions: +Python 3.6 -Python 2.7 ___ Python tracker __

[issue33106] Deleting a key in a read-only gdbm results in KeyError, not gdbm.error

2018-03-19 Thread sds
New submission from sds : deleting a key from a read-only gdbm should be gdbm.error, not KeyError: >>> import gdbm >>> db = gdbm.open("foo","n") # create new >>> db["a"] = "b" >>> db.close() >>> db = gdbm.open("foo","r") # read only >>> db["x"] = "1" Traceback (most recent call last): Fil

[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: > it's different than python3 (for no good reason?) Python 3 has new style classes which were always different. > main concern here is ease in portability We've long stated that there should never be dependency on the exact wording of an error message. W

[issue25345] Unable to install Python 3.5 on Windows 10

2018-03-19 Thread Arran McCutcheon
Arran McCutcheon added the comment: Yes there have been various Cumulative Updates and Security Updates in the past few months, the most recent five days ago. Last features update was successfully installed in December. Update Status: Your device is up to date. Last checked today, 09:14. I c

[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-19 Thread Anthony Sottile
Anthony Sottile added the comment: I think the main concern here is ease in portability coupled with the incorrectness of the current message (pointed out in https://bugs.python.org/issue31550#msg302738) For instance it was consistent in 2.7.1, but not later on in the 2.7.x tree. *And* it's

[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: I would like to leave this as-is. Consistency between error message wording is one of our least important considerations. The __getitem__ message is somewhat useful -- it helps learners know which magic method is being called and what they would need to

[issue33105] os.isfile returns false on Windows when file path is longer than 260 characters

2018-03-19 Thread Steve Dower
Steve Dower added the comment: Given basically every other file operation on Windows XP will also break on this file, I don't think it's worth us fixing in 2.7. If it occurs on Python 3.6 on Windows 7, we can consider it. But considering how well known this limitation is (and the workarounds

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-19 Thread Tim Peters
Tim Peters added the comment: Mark, thanks! I'm happy with that resolution: if any argument is infinite, return +inf; else if any argument is a NaN, return a NaN; else do something useful ;-) Serhiy, yes, the scaling that prevents catastrophic overflow/underflow due to naively squaring uns

[issue25345] Unable to install Python 3.5 on Windows 10

2018-03-19 Thread Steve Dower
Steve Dower added the comment: Arran - I think you have something else going wrong with your machine. There is nothing we do to cause multiple installs to start at the same time, and if rebooting does not help then I have to assume you have some permanently corrupt state. Have you installed

[issue33061] NoReturn missing from __all__ in typing.py

2018-03-19 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: New changeset 4573820d2a9156346392838d455e89f33067e9dd by Ivan Levkivskyi (aetracht) in branch 'master': bpo-33061: Add missing 'NoReturn' to __all__ in typing.py (GH-6127) https://github.com/python/cpython/commit/4573820d2a9156346392838d455e89f33067e9dd --

[issue25345] Unable to install Python 3.5 on Windows 10

2018-03-19 Thread Arran McCutcheon
Arran McCutcheon added the comment: Hi Steve, thanks for the reply. I tried the download again and got the same error with a slightly different log file, hopefully that will help identify the problem. Apart from that, I don't know of any other Python log files, there's no others in the same f

[issue33105] os.isfile returns false on Windows when file path is longer than 260 characters

2018-03-19 Thread Ned Deily
Change by Ned Deily : -- nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue33105] os.isfile returns false on Windows when file path is longer than 260 characters

2018-03-19 Thread Luis Conejo-Alpizar
New submission from Luis Conejo-Alpizar : Windows has a maximum path length limitation of 260 characters. This limitation, however, can be bypassed in the scenario described below. When this occurs, os.isfile() will return false, even when the affected file does exist. For Windows systems, the

[issue32968] Fraction modulo infinity should behave consistently with other numbers

2018-03-19 Thread Mark Dickinson
Mark Dickinson added the comment: > Mark, I tried `Fraction(10**23) // 1e22`, and I got 10. Sorry: that result was with your PR (as it was at the time I wrote that comment). On master, you do indeed get 10. > I think the fact that floating-point rounding error sometimes causes > strange resul

[issue33104] Documentation for EXTENDED_ARG in dis module is incorrect for >=3.6

2018-03-19 Thread Eric Appelt
Eric Appelt added the comment: Yes, thanks. I failed to see the duplicate searching for open issues, closing. -- resolution: -> duplicate stage: -> resolved status: open -> closed ___ Python tracker ___

[issue32625] Update the dis module documentation to reflect switch to wordcode

2018-03-19 Thread Eric Appelt
Change by Eric Appelt : -- nosy: +Eric Appelt ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue25433] whitespace in strip()/lstrip()/rstrip()

2018-03-19 Thread Cheryl Sabella
Change by Cheryl Sabella : -- versions: +Python 3.7, Python 3.8 -Python 3.5, Python 3.6 ___ Python tracker ___ ___ Python-bugs-list m

[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-19 Thread Anthony Sottile
Anthony Sottile added the comment: I made a new PR which instead *reverts* the python2.7 patch to restore consistency -- ___ Python tracker ___ ___

[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-19 Thread Anthony Sottile
Change by Anthony Sottile : -- pull_requests: +5909 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue19417] Bdb: add a unittest file (test.test_bdb)

2018-03-19 Thread Mariatta Wijaya
Mariatta Wijaya added the comment: New changeset 424f3dafea16fbaee55a30903af2d6717f4d4a6b by Mariatta (xdegaye) in branch '3.6': bpo-19417: Add test_bdb.py (GH-5217) https://github.com/python/cpython/commit/424f3dafea16fbaee55a30903af2d6717f4d4a6b --

[issue32756] argparse: parse_known_args: raising exception on unknown arg following known one

2018-03-19 Thread paul j3
paul j3 added the comment: >From the documentation, 16.4.4.1. Option value syntax > For short options (options only one character long), the option and its value > can be concatenated: > Several short options can be joined together, using only a single - prefix, > as long as only the last op

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-19 Thread Mark Dickinson
Mark Dickinson added the comment: Okay, that cut and paste didn't work so well. Just imagine an infinity symbol in those missing spaces. Trying again: > For the hypot function, hypot(±0, ±0) is +0, hypot(±∞, qNaN) is +∞, and > hypot(qNaN, ±∞) is +∞. -- ___

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-19 Thread Mark Dickinson
Mark Dickinson added the comment: > By the same logic, if there's an infinite argument to hypot(), it doesn't > matter what any other argument is - the result is +inf regardless. Yep, that's what IEEE 754-2008 says for the two-argument case, so I think that's the logic that should be followed

[issue26647] ceval: use Wordcode, 16-bit bytecode

2018-03-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -1041 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue33104] Documentation for EXTENDED_ARG in dis module is incorrect for >=3.6

2018-03-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Isn't this a duplicate of issue32625? -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Pyth

[issue33104] Documentation for EXTENDED_ARG in dis module is incorrect for >=3.6

2018-03-19 Thread Eric Appelt
New submission from Eric Appelt : The documentation for the EXTENDED_ARG instruction in the dis module documentation refers to the way the opcode worked before 3.6: https://docs.python.org/3.6/library/dis.html#opcode-EXTENDED_ARG As I understand, since moving to 2-byte wordcode in 3.6, each EX

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-19 Thread Tim Peters
Tim Peters added the comment: Some notes on the hypot() code I pasted in: first, it has to special case infinities too - it works fine if there's only one of 'em, but returns a NaN if there's more than one (it ends up computing inf/inf, and the resulting NaN propagates). Second, it's not cl

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

2018-03-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This syntax already is supported for dicts and NumPy arrays, but with different semantic. >>> d = {(1, 2): 'foo'} >>> d[1, 2] 'foo' >>> a = numpy.array([[1, 2], [3, 4]]) >>> a[1, 0] 3 -- nosy: +serhiy.storchaka resolution: -> rejected stage: -> re

[issue33101] Possible name inversion in heapq implementation

2018-03-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: There isn't universal agreement on whether it should be sift up or sift down. One point of view for sift down is that the datum is moving downward. The other point of view is that the datum is stationary which the rest of the heap moves downward (like si

[issue33102] get the nth folder of a given path

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: Path.parents will do what you want. I don't have a Windows box handy, but this is on MacOS: >>> from pathlib import Path >>> p = >>> Path("/Users/User/AppData/Local/Programs/Python/Python36/Lib/asyncio/__init__.py") >>> p.parents[1] PosixPath('/Users/User/AppD

[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 ___

[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", "Alice", 1, True, 2.1, "End"] a, b, c = my_list[1], my_list[3], my_

[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 ___ ___ Python-bu

[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, 2) returns

[issue33101] Possible name inversion in heapq implementation

2018-03-19 Thread Yomguithereal
New submission from Yomguithereal : Hello Python team, I might be hallucinating but I am under the impression that the `heapq` module uses reverse naming. What I mean is that it seems to me that the _siftup method should actually be named _siftdown and, the other way around, _siftdown should

[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-19 Thread Nick Coghlan
Nick Coghlan added the comment: It occurs to me that there may be some additional unshared context here: the way `python -m pip` searches for the module to execute is much closer to the way Windows searches for a command like `pip` (i.e. current directory first) than it is to the way *nix sys

[issue19417] Bdb: add a unittest file (test.test_bdb)

2018-03-19 Thread Xavier de Gaye
Change by Xavier de Gaye : -- pull_requests: +5908 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: My point is that the problem is that after: @dataclass class Base: __slots__ = ('x',) x: Any Base.x has a value (it's the member_descriptor for x). That's what's causing the problem that when adding a field to the derived class, it thinks you're addin

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Adrian Stachlewski
Adrian Stachlewski added the comment: I don't really get your point. @dataclass class Base: __slots__ = ('x',) x: Any This case is described in PEP 557 as correct, so I don't understand why you want to generate error. Also inheritance without defining slots is correct as stated in d

[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-19 Thread Nathaniel Smith
Nathaniel Smith added the comment: Ah, yeah, I see: ~/t$ echo 'print("hi")' > re.py ~/t$ pip --version pip 9.0.1 from /home/njs/.user-python3.5-64bit/local/lib/python3.5/site-packages (python 3.5) ~/t$ python -m pip --version hi Traceback (most recent call last): [...] But if I create a sitec

[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-19 Thread Antti Haapala
Antti Haapala added the comment: Took 2 seconds. % sudo python3 -mpip --version hello world Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/usr/lib/python3.6/r

[issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)

2018-03-19 Thread Eric V. Smith
Eric V. Smith added the comment: This is the same reason that this fails: class Base: __slots__ = ('x',) x = 3 with: ValueError: 'x' in __slots__ conflicts with class variable In the dataclasses case, the error needs to be improved, and moved to when the base class is being defined.

[issue33094] dataclasses: ClassVar attributes are not working properly

2018-03-19 Thread Adrian Stachlewski
Adrian Stachlewski added the comment: Once more same mistake. 'x' should be declared as: - x: ClassVar[set] = set() - x: ClassVar[Set[Any]] = set() -- ___ Python tracker ___

[issue33083] math.factorial accepts non-integral Decimal instances

2018-03-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: "Special cases aren't special enough to break the rules." Supporting floats is a special case. After ending the period of deprecation the code can be simplified. -- ___ Python tracker

[issue33083] math.factorial accepts non-integral Decimal instances

2018-03-19 Thread Mark Dickinson
Mark Dickinson added the comment: Raymond: what are your thoughts on deprecating the ability of `math.factorial` to accept a float (as in `math.factorial(5.0)` -> `120`)? For me, I'm not sure I see the value of the deprecation. It's the usual story: the answer to "Knowing what we know now, sh

[issue33021] Some fstat() calls do not release the GIL, possibly hanging all threads

2018-03-19 Thread Robert Collins
Robert Collins added the comment: Re: backporting this. I think backporting to 3.6/3.7 makes a lot of sense - bugfix and prerelease respectively. For 2.7, this bug has been around for ages, the patch is small, and I have no objection - but the RM has already said no, so I guess not happening

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-19 Thread Mark Dickinson
Mark Dickinson added the comment: +1 for a single-rounded dot product. If we're allowed to assume IEEE 754, it's straightforward to code up something that's not too inefficient and gives correctly rounded results for "normal" cases, using a combination of Veltkamp splitting, Dekker multiplica

[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-19 Thread Nathaniel Smith
Nathaniel Smith added the comment: @ncoghlan: The comparison I'm worried about is specifically this one: IIUC, right now it's safe to run 'pip --version' in an arbitrary directory, but it's not safe to run 'python -m pip --version' in an arbitrary directory. Am I wrong? (I actually couldn't c

[issue33098] add implicit conversion for random.choice() on a dict

2018-03-19 Thread Aristide Grange
Aristide Grange added the comment: My bad... For my reference to Python 2, I relied on my memory only, which starts to vanish. Really sorry about that. Yes, `random.choice(d)` (mostly) fails in Python 2 too, with an error message that I better understand after reading your explanation. So, i

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Uncle Timmy] > I doubt `fsum()` would add much value here: all the addends have the > same sign, so cancellation is impossible fsum() may be overkill for this problem. I mentioned it because the math module already had the requisite code and because it