[issue38389] Bug on sorted with count key

2019-10-06 Thread Benjamin Peterson
Benjamin Peterson added the comment: 5 and 12 both appear twice in the list, so as far as the key function is concerned, they're equal. -- nosy: +benjamin.peterson resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python

[issue38389] Bug on sorted with count key

2019-10-06 Thread Tamirys Pino
New submission from Tamirys Pino : >>> data=[2, 3, 2, 4, 5, 12, 2, 3, 3, 3, 12, 5] >>> data [2, 3, 2, 4, 5, 12, 2, 3, 3, 3, 12, 5] >>> sorted(data) [2, 2, 2, 3, 3, 3, 3, 4, 5, 5, 12, 12] >>> sorted(data, key=data.count) [4, 5, 12, 12, 5, 2, 2, 2, 3, 3, 3, 3] [4, 5, 12, 12, 5, 2, 2, 2, 3, 3, 3,

Re: Get __name__ in C extension module

2019-10-06 Thread MRAB
On 2019-10-07 00:38, Ian Pilcher wrote: On 10/6/19 11:55 AM, MRAB wrote: > Don't you already have the module's name? You have to specify it in the > PyModuleDef struct that you pass to PyModule_Create. I do. Perhaps I'm trying to be too Pythonic, but there's so much advice out there about

[issue26510] [argparse] Add required argument to add_subparsers

2019-10-06 Thread miss-islington
miss-islington added the comment: New changeset f19b4d7474973236e63d3d8260bfb8072acfff9d by Miss Islington (bot) in branch '3.8': bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588) https://github.com/python/cpython/commit/f19b4d7474973236e63d3d8260bfb8072acfff9d

[issue26510] [argparse] Add required argument to add_subparsers

2019-10-06 Thread miss-islington
miss-islington added the comment: New changeset 50b8d579421e621130806e62d6108f5f83d4be7f by Miss Islington (bot) in branch '3.7': bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588) https://github.com/python/cpython/commit/50b8d579421e621130806e62d6108f5f83d4be7f

[issue26510] [argparse] Add required argument to add_subparsers

2019-10-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +16197 pull_request: https://github.com/python/cpython/pull/16609 ___ Python tracker ___

[issue26510] [argparse] Add required argument to add_subparsers

2019-10-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +16196 pull_request: https://github.com/python/cpython/pull/16608 ___ Python tracker ___

[issue26510] [argparse] Add required argument to add_subparsers

2019-10-06 Thread miss-islington
miss-islington added the comment: New changeset 9e71917e0290972f65711f75510078f799cf0b59 by Miss Islington (bot) (Adam J. Stewart) in branch 'master': bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks Warren, the resistance example is excellent, would you like to write up a PR to add it to the docs? In the original design, I prohibited negative numbers because that seems to be what everyone says you should do, but as far as I can tell it is

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I don't have a problem with the current behavior (early out on zero, > even if later arguments are senseless). So: > > > * Just document that there is an early-out for zero. That make the most sense to me as well (even though the OP thinks otherwise).

[issue38386] ModuleNotFoundError: No module named '_ctypes'

2019-10-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: I agree with Ned closing this issue, but just glancing at the logs, it looks to me like buildozer has shadowed your Python's ctypes with a broken ctypes in

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-06 Thread Tim Peters
Tim Peters added the comment: I don't have a problem with the current behavior (early out on zero, even if later arguments are senseless). So: > * Just document that there is an early-out for zero. -- ___ Python tracker

[issue38386] ModuleNotFoundError: No module named '_ctypes'

2019-10-06 Thread Ned Deily
Ned Deily added the comment: Sorry, you appear to be using a third-party packaging system that provides Python for Android platforms. It's not something we provide or support. You should ask your question of that project (python-for-android perhaps?) or on a forum like StackOverflow.

[issue38388] Pickle protocol v 5 needs to be documented

2019-10-06 Thread Dima Tisnek
New submission from Dima Tisnek : Python 3.8 brings new pickle protocol, version 5. It's not documented. ``` (venv) … ~/m/proj> python Python 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more

Re: Get __name__ in C extension module

2019-10-06 Thread Ian Pilcher
On 10/6/19 12:55 PM, Barry Scott wrote: Then the answer to your question is simple. Do it in python and passt logger into the C++ module. Funny thing, that's exactly where I started this journey. I couldn't figure out how to get the logging.Logger type object, so that I could use a "O!"

[issue38387] Document PyDoc_STRVAR

2019-10-06 Thread Brad Solomon
New submission from Brad Solomon : The C-API reference would benefit from a short mention of PyDoc_STRVAR usage, since it is used so frequently within Modules/. -- assignee: docs@python components: Documentation messages: 354053 nosy: bsolomon1124, docs@python priority: normal

Re: Get __name__ in C extension module

2019-10-06 Thread Ian Pilcher
On 10/6/19 11:55 AM, MRAB wrote: Don't you already have the module's name? You have to specify it in the PyModuleDef struct that you pass to PyModule_Create. I do. Perhaps I'm trying to be too Pythonic, but there's so much advice out there about using getLogger(__name__) in Python code,

[issue38386] ModuleNotFoundError: No module named '_ctypes'

2019-10-06 Thread yangzongwu
New submission from yangzongwu : I have try the following, but it is no useful sudo apt install libffi-dev but when i import _ctypes under python,it is OK yzw@yzw-virtual-machine:~/Desktop/Test$ python3 Python 3.6.8 (default, Aug 20 2019, 17:12:48) [GCC 8.3.0] on linux Type "help",

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: The resistor example is persuasive :-) -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-06 Thread Warren Weckesser
Warren Weckesser added the comment: I find it hard to accept the first option. It seems to let a detail of the current implementation take precedence over API design. I don't see why we would want an API in which harmonic_mean([1, 0, -1]) returns 0 but harmonic_mean([-1, 0, 1]) raises an

[issue14364] Argparse incorrectly handles '--' as argument to option

2019-10-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Paul and David, is the current PR complete in your opinion? Are there known cases where the PR would break existing, working code? Also there needs to be doc entry that is clear on both new and old strategy for distinguishing options from arguments when

[issue35005] argparse should accept json and yaml argument types

2019-10-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: I am going to decline this feature request on the principle of keeping our modules loosely coupled and orthogonal to one another. As paul.j3 pointed out, the "type" option seems to work best with simple conversions like "int". As pointed-out by

Mouse control

2019-10-06 Thread Alexander Vergun
Hello all, I am coding a voice assistant under Python 3.7, Windows 7. I am using PYcharm and libraries such as PYSimpleGUI, mouse, keyboard etc.  Everything works except for the mouse control and probably keyboard, the problem is following, when I run the script under PYcharm, the script can

Strange tab completion oddity with enums?

2019-10-06 Thread Chris Angelico
I'm not sure what's going on here, and it's probably not actually enum-specific, but that's where I saw it. If you create a plain class and have an attribute with an annotation, you can see that: >>> class Foo: ... spam: "ham" = 1 ... >>> Foo.__a Foo.__abstractmethods__ Foo.__annotations__

[issue38210] Intersection of dict view with iterator returns empty set

2019-10-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It was added. Do you mean any special? -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue21360] mailbox.Maildir should ignore files named with a leading dot

2019-10-06 Thread Abhilash Raj
Abhilash Raj added the comment: David: How do you propose we move forward on this? Should we provide a switch to keep the original behaviour (which is off by default) so if there is someone depending on this bug, they could still continue to do it with relatively small change? It is a

[issue38210] Intersection of dict view with iterator returns empty set

2019-10-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Please add a test for this regression. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue38385] statistics: incorrect documentation

2019-10-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: This is a reasonable suggestion (all iterators are iterable, but not all iterables are iterators). I'll work on it shortly (in conjunction with some other minor doc fixups). -- assignee: docs@python -> rhettinger nosy: +rhettinger,

[issue38385] statistics: incorrect documentation

2019-10-06 Thread Eric O. LEBIGOT
New submission from Eric O. LEBIGOT : The documentation for the statistics package indicates that many of its functions (like median()) accept iterators. They seem to actually accept something more convenient, namely iterables. Thus, iterator could probably be usefully replaced by iterable

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Normally early-out behaviors are allowed to skip any checks for subsequent inputs (for example, the any() and all() builtins stop consuming inputs one a final value is found). However, that reasoning might not apply to a zero input for harmonic_mean().

[issue38379] finalizer resurrection in gc

2019-10-06 Thread Tim Peters
Tim Peters added the comment: Just noting that check_garbage() currently only determines which trash objects are now directly reachable from outside. To be usable for the intended purpose, it would need to go on to compute which trash objects are reachable from those too. Maybe a new

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-06 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger, steven.daprano versions: +Python 3.7, Python 3.8 ___ Python tracker ___

Re: Get __name__ in C extension module

2019-10-06 Thread Barry Scott
> On 5 Oct 2019, at 18:55, Ian Pilcher wrote: > > On 10/4/19 4:30 PM, Ian Pilcher wrote: >> Ideally, I would pass my existing Logging.logger object into my C >> function and use PyObject_CallMethod to call the appropriate method on >> it (info, debug, etc.). > > As I've researched this

Anyone has good understanding of how model base agents work in 2D array? --AIMA repository

2019-10-06 Thread krishna singh
Hi, I have started learning artificial intelligence and currently going through AIMA repository https://github.com/aimacode/aima-python but I am stucked at model base reflex agent implementation in the 2D environment. Does anyone have a good understanding of how model base agents work in 2D

Re: Get __name__ in C extension module

2019-10-06 Thread MRAB
On 2019-10-06 15:48, Ian Pilcher wrote: On 10/5/19 12:55 PM, Ian Pilcher wrote: This is straightforward, except that I cannot figure out how to retrieve the __name__. Making progress. I can get a __name__ value with: PyDict_GetItemString(PyEval_GetGlobals(), "__name__") I say "a

[issue38384] An assertion failure in test_pickle

2019-10-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I do not understand how you got an assertion failure. Did you interrupt tests with Ctrl-C? -- nosy: +serhiy.storchaka ___ Python tracker

pytest 5.2.1

2019-10-06 Thread Bruno Oliveira
pytest 5.2.1 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest The full changelog is available at https://docs.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: *

[issue35005] argparse should accept json and yaml argument types

2019-10-06 Thread Mauricio Villegas
Mauricio Villegas added the comment: FYI there is a new python package that extends argparse with the enhancements proposed here and more. https://pypi.org/project/jsonargparse/ -- nosy: +mauvilsa ___ Python tracker

Re: Get __name__ in C extension module

2019-10-06 Thread Ian Pilcher
On 10/5/19 12:55 PM, Ian Pilcher wrote: This is straightforward, except that I cannot figure out how to retrieve the __name__. Making progress. I can get a __name__ value with: PyDict_GetItemString(PyEval_GetGlobals(), "__name__") I say "a __name__ value" because the returned value is

[issue38384] An assertion failure in test_pickle

2019-10-06 Thread Zackery Spytz
Change by Zackery Spytz : -- keywords: +patch pull_requests: +16194 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16606 ___ Python tracker ___

[issue38384] An assertion failure in test_pickle

2019-10-06 Thread Zackery Spytz
New submission from Zackery Spytz : When running test_pickle, I sometimes see an assertion failure. ./python -m test test_pickle 0:00:00 load avg: 1.04 Run tests sequentially 0:00:00 load avg: 1.04 [1/1] test_pickle python: Objects/typeobject.c:3151: _PyType_Lookup: Assertion

[issue38383] undefined behavior in tailmatch() of bytes_methods.c

2019-10-06 Thread miss-islington
miss-islington added the comment: New changeset ce3c913909746aa1d782ed8bca5076a656422931 by Miss Islington (bot) in branch '3.8': bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603)

[issue38383] undefined behavior in tailmatch() of bytes_methods.c

2019-10-06 Thread miss-islington
miss-islington added the comment: New changeset b40442ba88fec5e64ab1802ce37df0afec59fa53 by Miss Islington (bot) in branch '3.7': bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603)

[issue38383] undefined behavior in tailmatch() of bytes_methods.c

2019-10-06 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue38383] undefined behavior in tailmatch() of bytes_methods.c

2019-10-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +16193 pull_request: https://github.com/python/cpython/pull/16605 ___ Python tracker ___

[issue38383] undefined behavior in tailmatch() of bytes_methods.c

2019-10-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +16192 pull_request: https://github.com/python/cpython/pull/16604 ___ Python tracker ___

[issue38383] undefined behavior in tailmatch() of bytes_methods.c

2019-10-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 24ddd9c2d6ab61cbce7e68d6de36d4df9bd2c3fb by Serhiy Storchaka (Hai Shi) in branch 'master': bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603)

[issue38210] Intersection of dict view with iterator returns empty set

2019-10-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Dong-hee for your fix! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue38210] Intersection of dict view with iterator returns empty set

2019-10-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset c38e725d17537b20ff090b1b5ec7db1820ff9b63 by Serhiy Storchaka (Dong-hee Na) in branch 'master': bpo-38210: Fix intersection operation with dict view and iterator. (GH-16602)

[issue38383] undefined behavior in tailmatch() of bytes_methods.c

2019-10-06 Thread hai shi
Change by hai shi : -- keywords: +patch pull_requests: +16191 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16603 ___ Python tracker ___

[issue38383] undefined behavior in tailmatch() of bytes_methods.c

2019-10-06 Thread hai shi
New submission from hai shi : `if (start + slen > len)` would cause undefined behavior? such as: start=PY_SSIZE_T_MAX, slen=1 REFS: [1] https://github.com/python/cpython/blob/master/Objects/bytes_methods.c#L746 -- components: Interpreter Core messages: 354032 nosy: shihai1991

[issue38210] Intersection of dict view with iterator returns empty set

2019-10-06 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38381] Possible wordcode optimization for STORE/LOAD pairs

2019-10-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I thought about this. But STORE_FAST x is followed by LOAD_FAST x just by accident. If you change the expression (1+x**2 or f(x**2)) they no longer be neighbors. I am not sure this pattern is common enough. There are more common pairs. Also, note that

[issue38210] Intersection of dict view with iterator returns empty set

2019-10-06 Thread Dong-hee Na
Change by Dong-hee Na : -- keywords: +patch pull_requests: +16190 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16602 ___ Python tracker ___