[issue39191] Coroutine is awaited despite an exception in run_until_complete()

2020-01-04 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +17246
pull_request: https://github.com/python/cpython/pull/17820

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39191] Coroutine is awaited despite an exception in run_until_complete()

2020-01-04 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +17247
pull_request: https://github.com/python/cpython/pull/17821

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39191] Coroutine is awaited despite an exception in run_until_complete()

2020-01-04 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 9c145e19fba53369da5cd23a1e71de489836f827 by Andrew Svetlov in 
branch '3.7':
[3.7] bpo-39191: Don't spawn a task before failing (GH-17796) (#17821)
https://github.com/python/cpython/commit/9c145e19fba53369da5cd23a1e71de489836f827


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39191] Coroutine is awaited despite an exception in run_until_complete()

2020-01-04 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 867d8333ce6a7f74191ad464acc609d4a04e4acb by Andrew Svetlov in 
branch '3.8':
[3.8] bpo-39191: Don't spawn a task before failing (GH-17796) (GH-17820)
https://github.com/python/cpython/commit/867d8333ce6a7f74191ad464acc609d4a04e4acb


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39191] Coroutine is awaited despite an exception in run_until_complete()

2020-01-04 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-04 Thread Juancarlo Añez

Juancarlo Añez  added the comment:

There's no way to assert that `findall(...)[0]` is efficient enough in most 
cases. It is easy to see that that it is risky in every case, as runtime may be 
exponential, and memory O(len(input)). A mistake in the regular expression may 
easily result in an out-of-memory, which can only be debugged with a series of 
tests using `search()`.

A problem with `re.search(...)` is that id doesn't have the return value 
semantics of `findall(...)[0]`, and those semantics seem to be what appeal to 
Python programmers. It takes several lines of code (the ones in 
`findalliter()`) to have the same result as `findal(...)[0]` when using 
`search()`. `findall()` is the sole, lonely function in `re` with its 
return-value semantics.

Also this proposal embeds `first()` within the body of `findfirst(...)`, but by 
the implementation one should consider if `first()` shouldn't be part of 
`itertools`, perhaps with a different name, like `take_one()`.

One should also consider that although third-party extensions to `itertools` 
already provide the equivalent of `first()`, `findalliter()` and `findfirst()` 
do not belong there, and there are no mainstream third-party extensions to `re` 
where they would fit.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28367] Add more standard baud rate constants to "termios"

2020-01-04 Thread Thomas Wouters


Change by Thomas Wouters :


--
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28367] Add more standard baud rate constants to "termios"

2020-01-04 Thread Thomas Wouters


Thomas Wouters  added the comment:


New changeset 7dc72b8d4f2c9d1eed20f314fd6425eab66cbc89 by T. Wouters (Anthony 
Shaw) in branch 'master':
bpo-28367: Add additional baud rates for termios (GH-13142)
https://github.com/python/cpython/commit/7dc72b8d4f2c9d1eed20f314fd6425eab66cbc89


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Your implementation takes several lines of code only because of complex 
semantic of findall() which you want to preserve in findfirst(). Actually 
findall() is an equivalent of one of three expressions, depending on the number 
of capturing groups in the regular expression:

[m[0] for m in finditer(...)]
[m[1] for m in finditer(...)]
[m.groups() for m in finditer(...)]

so findfirst() is an equivalent of one of three expressions:

search(...)[0]
search(...)[1]
search(...).groups()

In real code the number of capturing groups in the regular expression you use 
is known statically, so you should not dispatch one of above variants at run 
time. You just use the appropriate one.

findall() is older interface. More modern, generator and object interface is 
finditer(). findall() was not deprecated and was not converted to returning an 
iterator because many old code uses it, and we do not want to break it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39158] ast.literal_eval() doesn't support empty sets

2020-01-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The documentation for ast.literal_eval():

   Safely evaluate an expression node or a string containing a Python literal or
   container display.  The string or node provided may only consist of the
   following Python literal structures: strings, bytes, numbers, tuples, lists,
   dicts, sets, booleans, and ``None``.

https://docs.python.org/3/library/ast.html#ast.literal_eval

If we are going to add support of a function call set(), we should change the 
documentation.

And if add support of non-literals, where should we stop? Should we support 
also frozenset() and bytearray()? inf and nan? infj and nanj? complex()? 
Ellipsis? __debug__?

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-04 Thread Giovanni Lombardo


Giovanni Lombardo  added the comment:

Hello Terry J. Reedy, first and foremost thanks for the time you've dedicated 
to this issue! I really appreciate you work!! Even if I work with Python since 
2007, I'm new here, and not very well versed with this issue management system. 
This has been my first issue, hopefully not the last.. or maybe yes. Anyway, 
I'm going to clarify some points about your answers: 

1: scale.configure('whateveroption') can take the name of an option and should 
return its value, usually a tuple (unless you've already customized the 
option's value) as all other widgets already do. 

2. The code I've provided is not correct you're right. Mistakenly I've pasted 
the wrong one, but when I realized it, trying to delete and replace the 
uncorrect part, I've been unable to find the edit or delete feature on the 
issue tracker. Sorry for that.

3. I'd like to thank you for the clarification you've given about correct 
definition of crash and exception. I knew them. Anyway I'd like point out that 
there is no option in the 'create ticket' page of the issue tracker to specify 
that an exception that shouldn't be raised at all is instead raised. 
Considering that, if a piece of code is not supposed to raise exceptions 
managing them involve a runtime overhead we all want to avoid. Eventually the 
raising of the exception may stop an application abnormally leading to the same 
effect experienced in an application crash. 

4. Exaclty, Scale is the only one widget that override configure. So in theory 
no other similar issues should be found there.

It there is some action I need to do, or some documentation I need to read in 
order to be able to help here please point me there. Thank you again.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is a special case in tests for Scale.configure. It should be removed now. 
And maybe there is an old issue for this?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-04 Thread Giovanni Lombardo


Giovanni Lombardo  added the comment:

@serhiy.storchaka I didn't found any old issue not closed aboud tkinter Scale 
widget.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39209] Crash on REPL mode with long text copy and paste

2020-01-04 Thread Dong-hee Na


New submission from Dong-hee Na :

When I copy and paste the pretty long text into REPL shell.
REPL shell is crash down with segment fault.

This issue is only reproducible on macOS,
but Linux REPL doesn't look like normal behavior.

[origin text]





0KiB
0
1.3
0


16738211KiB
237.15
1.3
0

never
none




[macOS]

Python 3.9.0a2+ (heads/master:7dc72b8d4f, Jan  4 2020, 23:22:45)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = """
... 
... 
... 
... 
... 0KiB
... 0
... 1.3
... 0
... 
... 
... 16738211KiB
... 237.15
... 1.3
... 0
... 
... never
... none
... 
... 
... 
... """
Assertion failed: ((intptr_t)(int)(a - line_start) == (a - line_start)), 
function parsetok, file Parser/parsetok.c, line 324.
[1]13389 abort  ./python.exe


[linux]

Python 3.9.0a2+ (heads/master-dirty:7dc72b8, Jan  4 2020, 23:22:11)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = """




0KiB
0
true
0


16738211KiB
237.15
true
0

never
none



... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... 
... """
>>> a
'\n\n\n
\n\n0KiB\n
0\ntrue\n
0\n\n\n 
   16738211KiB\n237.15\n
true\n0\n 
   \nnever\n
none\n\n
\n\n'
>>>

--
messages: 359290
nosy: corona10, pablogsal
priority: normal
severity: normal
status: open
title: Crash on REPL mode with long text copy and paste
type: crash
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39209] Crash on REPL mode with long text copy and paste

2020-01-04 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +serhiy.storchaka, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33095] Cross-reference isolated mode from relevant locations

2020-01-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Closing since PRs were merged. Thanks for the review.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39158] ast.literal_eval() doesn't support empty sets

2020-01-04 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> And if add support of non-literals, where should we stop? Should we support 
> also frozenset() and bytearray()? inf and nan? infj and nanj? complex()? 
> Ellipsis? __debug__?

Then the name of the function would be a bit misleading (for frozenset() and 
bytearray()), no? I think the set() change is somehow inconsistent already with 
the function name.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39210] Sorting falls back to use __gt__ when __lt__ is not present

2020-01-04 Thread Yan Mitrofanov


New submission from Yan Mitrofanov :

Sorting documentation claims that sorting algorithm is only using < comparisons
https://docs.python.org/3/howto/sorting.html#odd-and-ends
https://docs.python.org/3/library/stdtypes.html#list.sort

When __lt__ implementation is missing, you get an exception
class Foo:
pass
sorted([Foo(), Foo(), Foo()])
TypeError: '<' not supported between instances of 'Foo' and 'Foo'

However, if implement __gt__ method, you doesn't get an exception
class Foo:
def __gt__(self, other):
return False
sorted([Foo(), Foo(), Foo()])  # ok


Is it supposed to work like this? Or is it lack of documentation?

--
assignee: docs@python
components: Documentation
messages: 359293
nosy: docs@python, yanmitrofanov
priority: normal
severity: normal
status: open
title: Sorting falls back to use __gt__ when __lt__ is not present
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39210] Sorting falls back to use __gt__ when __lt__ is not present

2020-01-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

The `<` comparison uses `__lt__` dunder if it exists, otherwise it falls back 
on `__gt__`.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39210] Sorting falls back to use __gt__ when __lt__ is not present

2020-01-04 Thread Mark Dickinson


Mark Dickinson  added the comment:

To be precise, when doing `a < b`, either `a.__lt__` or `b.__gt__` can be used, 
since `__gt__` is considered the reversed / reflected version of `__lt__` 
(analogous to `__add__` and `__radd__`).


>>> class A:
... def __lt__(self, other): return False
... 
>>> class B:
... def __gt__(self, other): return True
... 
>>> A() < B()
False
>>> B() < A()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: '<' not supported between instances of 'B' and 'A'
>>> sorted([A(), B()])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: '<' not supported between instances of 'B' and 'A'
>>> sorted([B(), A()])
[<__main__.B object at 0x10dc4cca0>, <__main__.A object at 0x10dc68ca0>]

Presumably in the normal case, all the objects being sorted have the same type, 
and so in that case it's enough that the type implements at least one of __lt__ 
and __gt__.

--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35292] Make SimpleHTTPRequestHandler load mimetypes lazily

2020-01-04 Thread AnLong


Change by AnLong :


--
pull_requests: +17248
pull_request: https://github.com/python/cpython/pull/17822

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39210] Sorting falls back to use __gt__ when __lt__ is not present

2020-01-04 Thread Yan Mitrofanov


Yan Mitrofanov  added the comment:

I got your point. So it seems that two pieces of documentation are not 
equivalent: 

https://docs.python.org/3/howto/sorting.html#odd-and-ends
> The sort routines are guaranteed to use __lt__() when making comparisons 
> between two objects.

https://docs.python.org/3/library/stdtypes.html#list.sort
> This method sorts the list in place, using only < comparisons between items.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27657] urlparse fails if the path is numeric

2020-01-04 Thread Ned Deily


Change by Ned Deily :


--
keywords: +3.7regression, 3.8regression -patch
priority: normal -> deferred blocker

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11416] netrc module does not handle multiple entries for a single host

2020-01-04 Thread Tibor Baranya


Tibor Baranya  added the comment:

Just for further clarification on how .netrc is supposed to work, I tested some 
other implementations. Sorry if this comment gets too long, but it seems netrc 
is not really a standardized solution.

In my last comment I referred curl and wget, but of course the original 
implementation is ftp (which points to the netrc manual). The manual itself 
doesn't talk about priorities, but all the mentioned 3 tools are in common in 
that they take the first entry if the same machine is in the netrc file 
multiple times.

When trying to force using the second entry, though, breaks this consistency 
quickly: none of the above tools seem to support a query with host and login 
name provided.
ftp: doesn't support providing a user name from shell (and doesn't use netrc 
when opening a connection interactively)
curl: if username is provided, it interactively asks for a password and uses 
that (which may be an issue on my end, as source code suggested there is a 
login-based lookup)
wget: if username is provided without a password, it doesn't send a auth 
information at all (also wget doesn't send default auth information for http, 
which behavior can be altered somehow)

Actually these results suprised me, as I remembered I used host+login based 
lookup previously. And the answer was git clone via https: git's implementation 
is exactly what I would expect:
* if only host is provided, the first entry is used
* if both host and login is provided, it looks up the password for the 
appropriate login
* if no matching machine entry can be found, it uses the default entry
* it also supports login matching for the default entry

I'm about the send a pull request with my understanding on how netrc should 
work. Of course all comments are welcome, and I'm happy to alter the 
implementation (or break it up to smaller pieces if necessary). My priorities 
were:

* Not to break backward compatibility.
* Provide a way to consistently pick up the first entry, without the need to 
make modifications in all of the dependent libraries (see doc change).
* __repr__() had a bug: for the default entry, it gives 'machine default', 
instead of 'default'.
* another bug: 'machine default' is actually not supported, as the netrc.hosts 
dictionary cannot make a difference between the default entry and a machine 
called default (this has a partial fixed)

As r.david.murray mentioned, the hosts dictionary should probably be deprecated.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34480] _markupbase.py fails with UnboundLocalError on invalid keyword in marked section

2020-01-04 Thread Josh Kamdjou


Change by Josh Kamdjou :


--
keywords: +patch
pull_requests: +17250
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/17643

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11416] netrc module does not handle multiple entries for a single host

2020-01-04 Thread Tibor Baranya


Change by Tibor Baranya :


--
pull_requests: +17249
pull_request: https://github.com/python/cpython/pull/17823

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39210] Sorting falls back to use __gt__ when __lt__ is not present

2020-01-04 Thread Mark Dickinson


Mark Dickinson  added the comment:

Right, the HOWTO language could possibly be improved. The intended and 
practical message is that you *only* need to provide __lt__ everywhere for sort 
to work.

--
nosy: +rhettinger, tim.peters

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39211] Change in http.server default IP behavior?

2020-01-04 Thread Shane


Change by Shane :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38973] Shared Memory List Returns 0 Length

2020-01-04 Thread Derek Frombach


Change by Derek Frombach :


Removed file: https://bugs.python.org/file48757/20191203_194951.jpg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39211] Change in http.server default IP behavior?

2020-01-04 Thread Shane

New submission from Shane :

It seems to me that the direct invocation behavior for http.server changed, 
probably with Python 3.8 (I'm currently using 3.8.1 on Windows 10).  On 3.7.X I 
was able to use it as described in the docs 
(https://docs.python.org/3/library/http.server.html)

> python -m http.server 8000

and it would default to whatever IP address was available.  Now, in order for 
it to function at all (not return "This site can’t be reached" in Chrome), I 
have to bind it to a specific IP address (say, 127.0.0.1, sticking with the 
docs example).

> python -m http.server 8000 --bind 127.0.0.1

At which point it works fine.  So it's still quite usable for this purpose, 
though I was surprised and -simple as the solution is- the solution is less 
simple when you don't know it!

Was this an intended change?  Something something security, perhaps?  If so, 
should it be noted in the "What's new" of the docs?  And of course, there's 
always the slight possibility that some aspect of Windows or Chrome behavior 
changed, but based on the termal's response I don't think that's the case.

Thanks,

--
messages: 359299
nosy: Shane Smith
priority: normal
severity: normal
status: open
title: Change in http.server default IP behavior?
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34480] _markupbase.py fails with UnboundLocalError on invalid keyword in marked section

2020-01-04 Thread Josh Kamdjou


Josh Kamdjou  added the comment:

(Author of PR https://github.com/python/cpython/pull/17643)

Since the behavior of self.error() is determined by the subclass 
implementation, an Exception is not guaranteed. How should this be handled? It 
seems the options are:

- continue execution, in which case 'match' needs to be defined (I proposed 
initialization to None, which results in returning -1 on the next line)
- return a value
- raise an Exception

Happy to update the PR with @xtreak's test cases.

--
nosy: +jkamdjou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39211] Change in http.server default IP behavior?

2020-01-04 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39212] Show qualified function name when giving arguments error

2020-01-04 Thread Ram Rachum


New submission from Ram Rachum :

I recently got this familiar error:

builtins.TypeError: __init__() takes 1 positional argument but 2 were given

It was annoying that I didn't know which `__init__` method was under 
discussion. I wish that Python used the `__qualname__` of the function to show 
this error message (and maybe others?) so it'll show like this: 

builtins.TypeError: FooBar.__init__() takes 1 positional argument but 2 
were given

If I'm not mistaken, the implementation of this error is in getargs.c in the 
function vgetargs1_impl.

--
components: Interpreter Core
messages: 359302
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Show qualified function name when giving arguments error
type: enhancement
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39211] Change in http.server default IP behavior?

2020-01-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Can you please paste the output of http.server as in the port and address 
printed as a log when started for different commands? As I can see from the 
history the binding process was changed to include IPv6 as default : 
https://github.com/python/cpython/pull/11767

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39211] Change in http.server default IP behavior?

2020-01-04 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +jaraco

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

After reading Serhiy's clarification of the old and wonky findall return api, I 
agree that reusing  it in an unneeded new function would be a retrograde move.  
We should instead upgrade the documentation of the more flexible current 
functions.

For search, give these examples of common uses:
  search(...)[0]  # Get entire matched string.
  search(...)[1]  # Get first captured group string.
  search(...).groups()  # Get tuple of captured group strings.

Note that the first two (unlike findfirst) may be used even when there are 
1/many groups.  If one has a pattern with multiple groups, one might want 
different return values for different applications of the pattern. Or one may 
add a group to a pattern to use as a backreference in the matching process, not 
to mark the substring one want to see.

For find: list and explain finditer ***first***.  Then list and explain findall 
as the old less-flexible list interface, kept for back compatibility, that is 
equivalent to one of the following, depending on whether the pattern has 0, 1, 
or multiple groups.

[m[0] for m in finditer(...)]  # List of full-match strings.
[m[1] for m in finditer(...)]  # List of captured strings.
[m.groups() for m in finditer(...)]  # List of tuples of strings.

To me, the above is clearer than "If one or more groups are present in the 
pattern, return a list of groups; this will be a list of tuples if the pattern 
has more than one group."  The first clause implies tuples even with one group; 
the second denies that.  One must infer that for one group, the match is 
extracted from the tuple.

Again, using finditer is more flexible than using findall in that the return, 
which limited by the number of groups, is not determined by it.

Given that each function is documented twice, as method and combined module 
function, where should the expanded explanation go?  Currently, expanded 
explanations of search, match, and fullmatch are on the methods, which the same 
for split, sub, and escape are on the functions.  Instead, all should go on 
whichever set of listings is first.

I think https://docs.python.org/3/library/re.html#module-contents should be 
split in two sections: re.compile and compile flags; combined compile + method 
functions.  Then consider moving the functions below the method listings (and 
move explanations of all functions that are methods to the methods.  Or maybe 
interleave the methods and functions.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39213] cmd should have a hook in the finally block of cmdloop

2020-01-04 Thread Joseph Sible


New submission from Joseph Sible :

Currently, the cmdloop function in cmd has a preloop hook, which runs before 
the large try block, and a postloop hook, which runs at the end of the body of 
the large try block. This isn't sufficient for subclasses to safely use 
readline.set_completion_display_matches_hook, since an exception in the large 
try block would mean that postloop doesn't get called, so there wouldn't be an 
opportunity to restore the old value of that callback. This is analogous to how 
we need the finally block ourself to restore the old value of the completer. 
Moving where postloop is called would be a breaking change, so we should 
probably create a new method instead, called postloop_finally or something.

--
components: Library (Lib)
messages: 359305
nosy: Joseph Sible
priority: normal
severity: normal
status: open
title: cmd should have a hook in the finally block of cmdloop
type: enhancement
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Giovanni, I saw that you gave a correct fix even if your example was wrong.  
Currently, scale.configure returns None instead of the configuration.  Your 
patch fixes this.  Once I created a git branch to verify and test the fix, it 
was trivial to make a PR, so I did so.

My PR still needs to patch the ttk.scale test.  If you get an idea of what to 
do, before I do it, post on the PR if you have a github account, or here.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

2020-01-04 Thread Steve Dower


Steve Dower  added the comment:

Right, IDLE doesn't call exec/compile until _after_ the code is submitted, 
while the regular prompt calls it first and passes stdin as the source file 
(which then does a buffered read).

The loop occurs because the next action after an invalid input is to read 
another input, which is correct, it just doesn't (and cannot) detect the case 
where an error is raised _before_ the user presses Enter.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11416] netrc module does not handle multiple entries for a single host

2020-01-04 Thread Frew Schmidt


Change by Frew Schmidt :


--
nosy:  -Frew Schmidt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39211] Change in http.server default IP behavior?

2020-01-04 Thread Shane


Shane  added the comment:

For the basic invocation:

>python -m http.server 8080
Serving HTTP on :: port 8080 (http://[::]:8080/) ...

It just sits there, because I can't access it (http://[::]:8080/ is not a valid 
address, so far as I know, and inserting my IP address doesn't find it either). 
 If I bind it to an IP address, it works as expected (using 127.0.0.1 from the 
docs, for the sake of consistency).  For the following messages, I'm starting 
up the server in my user directory, browsing to http://127.0.0.1:8080/ in 
Chrome, and following the Documents link.

>python -m http.server 8080 --bind 127.0.0.1
Serving HTTP on 127.0.0.1 port 8080 (http://127.0.0.1:8080/) ...
127.0.0.1 - - [04/Jan/2020 15:15:18] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [04/Jan/2020 15:15:18] code 404, message File not found
127.0.0.1 - - [04/Jan/2020 15:15:18] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [04/Jan/2020 15:15:28] "GET /Documents/ HTTP/1.1" 200 -

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39214] Add curses.window.in_wch

2020-01-04 Thread Anthony Sottile


New submission from Anthony Sottile :

(I've already got a patch for this, just making the necessary issue)

curses.window.inch is pretty useless for any non-ascii character

--
components: Extension Modules
messages: 359309
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: Add curses.window.in_wch
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39212] Show qualified function name when giving arguments error

2020-01-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> builtins.TypeError: __init__() takes 1 positional argument but 2 were given

How did you get the fully qualified exception? I just get "TypeError". (Also 
the error message is different in 3.8.)


> It was annoying that I didn't know which `__init__` method was under 
> discussion.

Couldn't you tell from the stacktrace showing the failed line of code?

I don't know about this. While I can certainly see that there are circumstances 
where it might be useful (e.g. you're running a .pyc file and there's no source 
line available), I think that in the majority of the cases showing 
fully-qualified names would be more annoying than useful, and certainly more 
intimidating to beginners.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39184] Many command execution functions are not raising auditing events

2020-01-04 Thread Saiyang Gou


Change by Saiyang Gou :


--
keywords: +patch
pull_requests: +17252
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17824

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39214] Add curses.window.in_wch

2020-01-04 Thread Anthony Sottile


Change by Anthony Sottile :


--
keywords: +patch
pull_requests: +17253
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17825

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39184] Many command execution functions are not raising auditing events

2020-01-04 Thread Saiyang Gou


Saiyang Gou  added the comment:

I have made PR 17824 to add auditing events for the command execution functions 
mentioned above.

After a review on other related Python modules, I think maybe the following 
functions can also be audited, but a discussion may be required to determine 
whether they are necessary (whether these actions are sensitive enough to 
record, and performance trade off). 

- os.getenv/putenv/unsetenv
- os.getcwd/chdir
- os.chown/chmod
- os.stat/access
- os.link/symlink
- os.rename/renames/replace
- os.mkdir/mkdirs
- os.remove/removedirs/rmdir/unlink  (`shutil.rmtree` is already audited)
- os.add_dll_directory
- os.fork
- os.kill/killpg
- os.path.exists/isfile/isdir/...
- signal.pthread_kill
- shutil.copy*  (`shutil.copytree` is already audited)
- shutil.move
- shutil.chown
- shutil.unpack_archive  (`shutil.make_archive` is already audited)
- resource.prlimit
- file operations in `msvcrt`
- functions in `fcntl`, `syslog`
- many high level networking modules such as `http.client/server`, 
`socketserver`, `xmlrpc`  (the low-level `socket` calls are already audited)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39215] Type Annotation of nested function with positional only arguments triggers SystemError

2020-01-04 Thread Anthony Sottile


New submission from Anthony Sottile :

def f():
def g(arg: int, /):
pass

f()


$ python3.9 t2.py
Traceback (most recent call last):
  File "/home/asottile/workspace/t2.py", line 5, in 
f()
  File "/home/asottile/workspace/t2.py", line 2, in f
def g(arg: int, /):
SystemError: no locals when loading 'int'

Originally from this StackOverflow post: 
https://stackoverflow.com/q/59594494/812183

--
components: Interpreter Core
messages: 359312
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: Type Annotation of nested function with positional only arguments 
triggers SystemError
versions: Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39215] Type Annotation of nested function with positional only arguments triggers SystemError

2020-01-04 Thread Anthony Sottile


Anthony Sottile  added the comment:

Looks as though annotations are using `LOAD_NAME` when they should probably use 
`LOAD_GLOBAL`?

```
$ diff -u <(python3.9 -m dis t2.py | sed 
's/0x[a-f0-9]*/0xdeadbeef/g;s/t2\.py/FILENAME/g') <(python3.9 -m dis t3.py | 
sed 's/0x[a-f0-9]*/0xdeadbeef/g;s/t3\.py/FILENAME/g')
--- /dev/fd/63  2020-01-04 16:34:27.372004436 -0800
+++ /dev/fd/62  2020-01-04 16:34:27.372004436 -0800
@@ -10,7 +10,7 @@
  16 RETURN_VALUE
 
 Disassembly of :
-  2   0 LOAD_NAME0 (int)
+  2   0 LOAD_GLOBAL  0 (int)
   2 LOAD_CONST   1 (('arg',))
   4 BUILD_CONST_KEY_MAP  1
   6 LOAD_CONST   2 ()
```

t3.py is the same as t2.py but without positional-only arguments

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38597] C Extension import limit

2020-01-04 Thread Kevin Schlossser


Kevin Schlossser  added the comment:

Thank you msg356892 for spear heading this for me. I family things to attend to 
so I apologize for opening this bug report and then walking away..

As far as recreating this issue. It simple to do. you can either use cython or 
you can put together a quick script that will make say 150 extensions. put one  
line of code in it and compile it.. The results always end up being the same 
123 extensions can be loaded on the 124th a TB happens.. It does not matter 
where the files are inside the package. it is always the 124th one that gets 
loaded for any one package. importing a pyd from another package does not 
change the number. The extensions have to be a direct descendant of one single 
package.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39215] Type Annotation of nested function with positional only arguments triggers SystemError

2020-01-04 Thread Anthony Sottile


Anthony Sottile  added the comment:

this triggers an assertion when run with debug enabled:

$ gdb ./python 
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./python...done.
warning: File "/home/asottile/workspace/cpython/python-gdb.py" auto-loading has 
been declined by your `auto-load safe-path' set to 
"$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /home/asottile/workspace/cpython/python-gdb.py
line to your configuration file "/home/asottile/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/asottile/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) run t2.py
Starting program: /home/asottile/workspace/cpython/python t2.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
python: Python/compile.c:3545: compiler_nameop: Assertion `scope || 
PyUnicode_READ_CHAR(name, 0) == '_'' failed.

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x77060801 in __GI_abort () at abort.c:79
#2  0x7705039a in __assert_fail_base (
fmt=0x771d77d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
assertion=assertion@entry=0x55815190 "scope || 
PyUnicode_READ_CHAR(name, 0) == '_'", file=file@entry=0x55814233 
"Python/compile.c", 
line=line@entry=3545, 
function=function@entry=0x55814180 <__PRETTY_FUNCTION__.17589> 
"compiler_nameop") at assert.c:92
#3  0x77050412 in __GI___assert_fail (
assertion=assertion@entry=0x55815190 "scope || 
PyUnicode_READ_CHAR(name, 0) == '_'", file=file@entry=0x55814233 
"Python/compile.c", 
line=line@entry=3545, 
function=function@entry=0x55814180 <__PRETTY_FUNCTION__.17589> 
"compiler_nameop") at assert.c:101
#4  0x5568e946 in compiler_nameop (c=0x7fffdb40, 
name=, ctx=Load) at Python/compile.c:3545
#5  0x5569020e in compiler_visit_expr1 (c=c@entry=0x7fffdb40, 
e=0x55b739d0) at Python/compile.c:5027
#6  0x5569027f in compiler_visit_expr (c=0x7fffdb40, 
e=) at Python/compile.c:5052
#7  0x55693570 in compiler_visit_argannotation (
c=c@entry=0x7fffdb40, id=0x77f95d60, annotation=, 
names=names@entry=0x766217d0) at Python/compile.c:2045
#8  0x5569363e in compiler_visit_argannotations (
c=c@entry=0x7fffdb40, args=0x55b739c0, 
names=names@entry=0x766217d0) at Python/compile.c:2066
#9  0x556936b2 in compiler_visit_annotations (
c=c@entry=0x7fffdb40, args=args@entry=0x55b73a28, 
returns=returns@entry=0x0) at Python/compile.c:2094
#10 0x556939fc in compiler_function (c=0x7fffdb40, 
s=0x55b73ab8, is_async=is_async@entry=0) at Python/compile.c:2214
#11 0x55693dad in compiler_visit_stmt (c=c@entry=0x7fffdb40, 
s=0x55b73ab8) at Python/compile.c:3332
---Type  to continue, or q  to quit---
#12 0x55693b8f in compiler_function (c=0x7fffdb40, 
s=, is_async=is_async@entry=0) at Python/compile.c:2238
#13 0x55693dad in compiler_visit_stmt (c=c@entry=0x7fffdb40, 
s=0x55b73b00) at Python/compile.c:3332
#14 0x55694022 in compiler_body (c=c@entry=0x7fffdb40, 
stmts=0x55b73960) at Python/compile.c:1816
#15 0x55694754 in compiler_mod (c=c@entry=0x7fffdb40, 
mod=mod@entry=0x55b73c00) at Python/compile.c:1836
#16 0x5569682b in PyAST_CompileObject (mod=mod@entry=0x55b73c00, 
filename=filename@entry=0x7662a7b0, flags=flags@entry=0x7fffddc0, 
optimize=optimize@entry=-1, arena=arena@entry=0x77e69640)
at Python/compile.c:364
#17 0x556c20cc in run_mod (mod=mod@entry=0x55b73c00, 
filename=filename@entry=0x7662a7b0, 
globals=globals@entry=0x77ecf3b0, locals=locals@entry=0x77ecf

[issue22543] -W option cannot use non-standard categories

2020-01-04 Thread Feng Yu


Feng Yu  added the comment:

Coming here from 
https://github.com/astropy/astropy/issues/9832#issuecomment-570751353

Importing the named module during warning initialization is somewhat like code 
injection. And it may introduce unintended side-effects -- for example if this 
causes some 3rd party libraries to initialize too early?

String matching on the class name of every class in the hierarchy is safer, as 
there is no 'expected' code execution.

--
nosy: +Feng Yu

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39215] Type Annotation of nested function with positional only arguments triggers SystemError

2020-01-04 Thread Anthony Sottile


Change by Anthony Sottile :


--
keywords: +patch
pull_requests: +17254
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17826

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39216] ast_opt.c -- missing posonlyargs?

2020-01-04 Thread Anthony Sottile


New submission from Anthony Sottile :

while fixing bpo-39215, I noticed that there seems to be a place here where 
posonlyargs was missed: 
https://github.com/python/cpython/blob/7dc72b8d4f2c9d1eed20f314fd6425eab66cbc89/Python/ast_opt.c#L617-L627

not sure if this is intentional or not -- happy to make a patch which adds a 
line there if someone can help me with the test

--
components: Interpreter Core
messages: 359317
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: ast_opt.c -- missing posonlyargs?
versions: Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39215] Type Annotation of nested function with positional only arguments triggers SystemError

2020-01-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17255
pull_request: https://github.com/python/cpython/pull/17827

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39217] GC of a ctypes object causes application crash

2020-01-04 Thread Kevin Schlossser


New submission from Kevin Schlossser :

I guess this is a question as much as it is a bug report. I know that all kinds 
of strange behavior can happen when using ctypes improperly. This is what is 
taking place. I can provide code if needed. but lets work off of my description 
of what is taking place first.

I am querying DeviceIoControl which is apart of the Windows API..

I have a function that has ctypes objects passed to it.. it does whatever it is 
that is needed to call DeviceIoControl. I have narrow it down to a single 
object and I ran the visual studio debugger and it traced the problem back to 
the garbage collector.

So this is the basic layout..


```python

def IOControl(io_ctrl, inBuffer, outBuffer, outBufferSize=None):


if outBuffer is None:
outBufferSize = INT(0) 

else:
pOutBuffer = ctypes.byref(outBuffer)

if outBufferSize is None:
outBufferSize = INT(ctypes.sizeof(outBuffer))
else:
outBufferSize = INT(outBufferSize)


if inBuffer is None:
inBufferSize = INT(0) 
else:
pInBuffer = ctypes.byref(inBuffer)
inBufferSize = INT(ctypes.sizeof(inBuffer))

DeviceIOControl(
 io_ctrl, 
 inBuffer, 
 ctypes.byref(inBufferSize), 
 outBuffer,
 ctypes.byref(outBufferSize)
)

class SomeStructure(ctypes.Structure):

_fields_ = [
('SomeField1', ULONG),
('SomeField2, LONG * 100,
]




out_buffer = SomeStructure()
buf_size = ctypes.sizeof(out_buffer)

IOControl(
'some io control code', 
None, 
None, 
out_buffer , 
buf_size
]
 
```


The code above will crash Python and the debug leads back to an error in the GC.


I do not know what the internals of ctypes are or how they function. when using 
ctypes.byref() to create a pointer I would imagine that the original instance 
is held somewhere inside of the pointer. But when it gets passed off to the 
Windows function where it does or what it does is unknown to me. The process if 
doing this is more complex then what is above It is for example purposes.. 
There is another in the Windows API that will wait for data to be had from the 
first function call.

The funny thing is the first time it goes though IOControl without incident. 
its repeated attempts that cause the appcrash. 

If someone has a reason as to why this is taking place I am ready to 
learn!!!... I find it odd behavior that once i mode the code from that function 
into the same namespace where that function was originally called form 
everything works fine and no application crashes happen 


The debugger pointed to data that was being passed to a GC macro or function 
that did not have the information correct. It was pretty car into the GC code 
before the application crash happens. 

I am also able to provide the results of running the debugger

any help/information would be greatly appreciated.

--
components: ctypes
messages: 359318
nosy: Kevin Schlossser
priority: normal
severity: normal
status: open
title: GC of a ctypes object causes application crash
type: crash
versions: Python 2.7, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39215] Type Annotation of nested function with positional only arguments triggers SystemError

2020-01-04 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks, Anthony, for the quick fix and the investigation! :)

--
nosy: +pablogsal
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39210] Sorting falls back to use __gt__ when __lt__ is not present

2020-01-04 Thread Tim Peters


Tim Peters  added the comment:

It's hard to be clearer without being annoyingly wordy.  The truth is that sort 
does all comparisons by calling the CAPI:

PyObject_RichCompareBool(v, w, Py_LT)`

Sorting doesn't know (or care) how `PyObject_RichCompareBool()` is implemented. 
 The closest Python equivalent is:

bool(v < w)

although then you also have to be clear that `bool` refers to the builtin 
function of that name.

Regardless, the sorting docs certainly aren't the place to explain how `v < w` 
is implemented.  For example, that it _may_ end up calling `w.__gt__(v)` has 
nothing to do with sorting - instead that's about the semantics of comparison 
operators, regardless of context.

Since, best I can recall, nobody has asked about this before, perhaps the docs 
don't need "improvement" ;-)  If they do, then I'm with Mark:  the _intent_ was 
to say "if you want a class to implement its own sorting order, then it's 
sufficient to implement `__lt__` alone, and then sorting will use only that 
comparison operator if the list contains only instances of that class".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39216] ast_opt.c -- missing posonlyargs?

2020-01-04 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39198] Lock may not be released in Logger.isEnabledFor

2020-01-04 Thread Ned Deily


Change by Ned Deily :


--
nosy: +vinay.sajip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39174] unicodedata.normalize failing with NFD and NFKD for some characters in Python3

2020-01-04 Thread Inada Naoki


Inada Naoki  added the comment:

I can not get what you say.  If "unicodedata.normalize() produces the correct 
sequence", isn't it just a your terminal behavior?

If you think it is Python's issue, could you be more specific and write a 
simple sample code?

--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39210] Sorting falls back to use __gt__ when __lt__ is not present

2020-01-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

On Sun, Jan 05, 2020 at 02:19:49AM +, Tim Peters wrote:

> Since, best I can recall, nobody has asked about this before

See discussion here:

https://mail.python.org/archives/list/python-...@python.org/message/5AQMG6ADD6RGPLI3VTILB2MKXMBFTIGU/

which followed from discussions on sort order. I was asked to provide a 
PR, but I have technical difficulties with github.

I think it's sufficient to say that sorting relies only on the `<` 
operator, and link to the section of the docs that map special dunders 
to comparison operators, namely here:

https://docs.python.org/3/reference/datamodel.html#object.__lt__

where it goes into detail about reflected methods and such.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39218] Assertion failure when calling statistics.variance() on a float32 Numpy array

2020-01-04 Thread Reed


New submission from Reed :

If a float32 Numpy array is passed to statistics.variance(), an assertion 
failure occurs. For example:

import statistics
import numpy as np
x = np.array([1, 2], dtype=np.float32)
statistics.variance(x)

The assertion error is:

assert T == U and count == count2

Even if you convert x to a list with `x = list(x)`, the issue still occurs. The 
issue is caused by the following lines in statistics.py 
(https://github.com/python/cpython/blob/ec007cb43faf5f33d06efbc28152c7fdcb2edb9c/Lib/statistics.py#L687-L691):

T, total, count = _sum((x-c)**2 for x in data)
# The following sum should mathematically equal zero, but due to rounding
# error may not.
U, total2, count2 = _sum((x-c) for x in data)
assert T == U and count == count2

When a float32 Numpy value is squared in the term (x-c)**2, it turns into a 
float64 value, causing the `T == U` assertion to fail. I think the best way to 
fix this would be to replace (x-c)**2 with (x-c)*(x-c). This fix would no 
longer assume the input's ** operator returns the same type.

--
components: Library (Lib)
messages: 359323
nosy: reed
priority: normal
severity: normal
status: open
title: Assertion failure when calling statistics.variance() on a float32 Numpy 
array
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39218] Assertion failure when calling statistics.variance() on a float32 Numpy array

2020-01-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think it's more of an implementation artifact of numpy eq definition for 
float32 and float64 and can possibly break again if (x-c) * (x-c) was also 
changed to return float64 in future.

--
nosy: +rhettinger, steven.daprano, taleinat, xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com