[issue43248] platform.libc_ver() returns no information on Alpine Linux

2021-02-19 Thread Dong-hee Na


Dong-hee Na  added the comment:

@Omer.Katz

This issue should be fixed, feel free to submit the PR

--

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Eryk Sun


Eryk Sun  added the comment:

> Isn't `PyUnicode_GET_LENGTH(text) < self->chunk_size` enough?

Yes, that's simpler, except with `<=`" instead of `<`, since the maximum count 
is chunk_size when pending_bytes is a list or ASCII string. When I wrote the 
more complex check, I did't take into account that pending_bytes would be 
flushed anyway if it causes pending_bytes_count to exceed chunk_size.

--

___
Python tracker 

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



[issue43248] platform.libc_ver() returns no information on Alpine Linux

2021-02-19 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue43228] Regression in function builtins

2021-02-19 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue41859] IDLE: ValueError; Completions not working right on macOS

2021-02-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This seemingly random error involved completions and there is already an issue 
about them not working right on macOS.  It was also opened by Raymond as a 
result of another 'random' error in an all day session.

--
components: +macOS
nosy: +ned.deily, ronaldoussoren
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE: problems with completions on Mac
title: Uncaught ValueError -> IDLE: ValueError; Completions not working right 
on macOS

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Inada Naoki


Inada Naoki  added the comment:

You are right. I misunderstood.

```
if (PyUnicode_IS_ASCII(text) &&
  (PyUnicode_GET_LENGTH(text) +
(self->pending_bytes ? self->pending_bytes_count : 0)) <=
  self->chunk_size &&
  is_asciicompat_encoding(self->encodefunc)) {
b = text;
Py_INCREF(b);
}
```

This seems too complex and defensive.  Isn't `PyUnicode_GET_LENGTH(text) < 
self->chunk_size` enough?

When `PyUnicode_GET_LENGTH(text) + self->pending_bytes_count > 
self->chunk_size`, `self->pending_bytes` is preflushed anyway.

--

___
Python tracker 

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



[issue40522] [subinterpreters] Get the current Python interpreter state from Thread Local Storage (autoTSSkey)

2021-02-19 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +23375
pull_request: https://github.com/python/cpython/pull/24597

___
Python tracker 

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



[issue40522] [subinterpreters] Get the current Python interpreter state from Thread Local Storage (autoTSSkey)

2021-02-19 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +23374
pull_request: https://github.com/python/cpython/pull/24596

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Carol Willing


Carol Willing  added the comment:

Absolutely, I can help do that.

On Fri, Feb 19, 2021 at 9:14 PM Guido van Rossum 
wrote:

>
> Guido van Rossum  added the comment:
>
> Carol, the most urgent thing we have going is to come up with text for
> what's new. I posted a PR that adds my standard "quick" tutorial (
> https://github.com/python/cpython/pull/24588) which is also found in
> Appendix A of PEP 636 (the tutorial PEP -- the specification PEP 634 has a
> different Appendix A :-), but we are worried that this is going to mislead
> people into thinking "Oh, this is a switch with a funny name" -- which is
> exactly what we don't want (see Jake vd Plas Tweet at
> https://twitter.com/jakevdp/status/1359870794877132810). Having stared at
> this for way too long already I think I'm not able to come up with a better
> way to present this *quickly* in a format that's appropriate for What's New
> (concise, highlights only, meant for existing fairly experienced Python
> users). Do you think you can help?
>
> --
>
> ___
> Python tracker 
> 
> ___
> ___
> Python-bugs-list mailing list
> Unsubscribe:
> https://mail.python.org/mailman/options/python-bugs-list/willingc%40gmail.com
>
>

--

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Eryk Sun


Eryk Sun  added the comment:

> In your code, huge data passed to .write(huge) may be 
> remained in the internal buffer.

If you mean the buffered writer, then I don't see the problem. A large bytes 
object in pending_bytes gets temporarily referenced by 
_textiowrapper_writeflush(), and self->pending_bytes is cleared. If the 
buffer's write() method fails, then the bytes object is simply deallocated.

If you mean pending_bytes in the text wrapper, then I also don't see the 
problem. It always gets flushed if pending_bytes_count exceeds the chunk size. 
If pending_bytes is a list, it never exceeds the chunk size. It gets 
pre-flushed to avoid growing beyond the chunk size. If pending_bytes isn't a 
list, then it can only exceed the chunk size if it's a bytes object -- never 
for an ASCII str() object. _textiowrapper_writeflush() does not call 
PyBytes_AsStringAndSize() for that case.

--

___
Python tracker 

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



[issue27646] doc: yield from expression can be any iterable

2021-02-19 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +23373
pull_request: https://github.com/python/cpython/pull/24595

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Carol, the most urgent thing we have going is to come up with text for
what's new. I posted a PR that adds my standard "quick" tutorial (
https://github.com/python/cpython/pull/24588) which is also found in
Appendix A of PEP 636 (the tutorial PEP -- the specification PEP 634 has a
different Appendix A :-), but we are worried that this is going to mislead
people into thinking "Oh, this is a switch with a funny name" -- which is
exactly what we don't want (see Jake vd Plas Tweet at
https://twitter.com/jakevdp/status/1359870794877132810). Having stared at
this for way too long already I think I'm not able to come up with a better
way to present this *quickly* in a format that's appropriate for What's New
(concise, highlights only, meant for existing fairly experienced Python
users). Do you think you can help?

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Carol Willing


Carol Willing  added the comment:

@Brandt Bucher  @Guido van Rossum
 I'm
finally getting some free time to get the docs workgroup up and running.
I'm happy to help with any docs that you want for alpha and beyond.

On Fri, Feb 19, 2021 at 8:27 PM Guido van Rossum 
wrote:

>
> Guido van Rossum  added the comment:
>
> But seriously, nothing good can come from social media. It's what drove me
> to retire in 2018. Just ignore it please.
>
> --
>
> ___
> Python tracker 
> 
> ___
> ___
> Python-bugs-list mailing list
> Unsubscribe:
> https://mail.python.org/mailman/options/python-bugs-list/willingc%40gmail.com
>
>

--

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Inada Naoki


Inada Naoki  added the comment:

In your code, huge data passed to .write(huge) may be remained in the internal 
buffer.

```
[NEW PRE-FLUSH]

else if ((self->pending_bytes_count + bytes_len) > self->chunk_size) {
if (_textiowrapper_writeflush(self) < 0) {
Py_DECREF(b);
return NULL;
}
self->pending_bytes = b;
}
(snip)
self->pending_bytes_count += bytes_len;
if (self->pending_bytes_count > self->chunk_size || needflush ||
text_needflush) {
if (_textiowrapper_writeflush(self) < 0)
return NULL;
}
```

In my opinion, when .write(huge) fails with MemoryError, TextIOWrapper must not 
keep the `huge` in the internal buffer.

See my PR-24592.

--

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Eryk Sun


Eryk Sun  added the comment:

> stdout.write("small text")
> stdout.write("very large text")  # Calls writeflush, but can not allocate 
> buffer.

Without the optimization, in most cases this will likely fail in 
_io_TextIOWrapper_write_impl() at the line `b = (*self->encodefunc)((PyObject 
*) self, text)`. In some cases, it could be that the latter succeeds, but its 
size combined with the existing pending_bytes_count leads to a memory error in 
_textiowrapper_writeflush().

> * If input text is large (>1M?)

I'd change write() to only optimize ASCII writes so long as the new total size 
of pending writes would not exceed the text wrapper's chunk size. Then 
rearrange the logic to pre-flush the text wrapper if the pending bytes plus the 
write would exceed the chunk size. Thus the total size of a list of pending 
writes (aggregating small writes as a chunk), or that of a single ASCII str() 
object, would be limited to the chunk size, in which case 
PyBytes_FromStringAndSize in _textiowrapper_writeflush() shouldn't fail in any 
normal circumstances. For example:

if (self->encodefunc != NULL) {

[NEW CONDITION]

if (PyUnicode_IS_ASCII(text) &&
  (PyUnicode_GET_LENGTH(text) +
(self->pending_bytes ? self->pending_bytes_count : 0)) <=
  self->chunk_size &&
  is_asciicompat_encoding(self->encodefunc)) {
b = text;
Py_INCREF(b);
}
else {
b = (*self->encodefunc)((PyObject *) self, text);
}
self->encoding_start_of_stream = 0;
}
else {
b = PyObject_CallMethodOneArg(self->encoder, _PyIO_str_encode, text);
}

Py_DECREF(text);
if (b == NULL)
return NULL;
if (b != text && !PyBytes_Check(b)) {
PyErr_Format(PyExc_TypeError,
 "encoder should return a bytes object, not '%.200s'",
 Py_TYPE(b)->tp_name);
Py_DECREF(b);
return NULL;
}

Py_ssize_t bytes_len;
if (b == text) {
bytes_len = PyUnicode_GET_LENGTH(b);
}
else {
bytes_len = PyBytes_GET_SIZE(b);
}

if (self->pending_bytes == NULL) {
self->pending_bytes_count = 0;
self->pending_bytes = b;
}

[NEW PRE-FLUSH]

else if ((self->pending_bytes_count + bytes_len) > self->chunk_size) {
if (_textiowrapper_writeflush(self) < 0) {
Py_DECREF(b);
return NULL;
}
self->pending_bytes = b;
}
else if (!PyList_CheckExact(self->pending_bytes)) {
PyObject *list = PyList_New(2);
if (list == NULL) {
Py_DECREF(b);
return NULL;
}
PyList_SET_ITEM(list, 0, self->pending_bytes);
PyList_SET_ITEM(list, 1, b);
self->pending_bytes = list;
}
else {
if (PyList_Append(self->pending_bytes, b) < 0) {
Py_DECREF(b);
return NULL;
}
Py_DECREF(b);
}

self->pending_bytes_count += bytes_len;
if (self->pending_bytes_count > self->chunk_size || needflush ||
text_needflush) {
if (_textiowrapper_writeflush(self) < 0)
return NULL;
}

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

But seriously, nothing good can come from social media. It's what drove me to 
retire in 2018. Just ignore it please.

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Okay, I see.  Clearly we should have kept the "DWIM" option, aka "If it starts 
with a capital letter, it's a value pattern." :-)

--

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread laurenjl


laurenjl  added the comment:

> I've seen too many knee-jerk reactions over the past weeks along the lines of 
> "the new switch feature can't handle named constants!".

Here are some that I found interesting:

https://twitter.com/jakevdp/status/1359870794877132810

https://twitter.com/brandon_rhodes/status/1360226108399099909

--
nosy: +laurenjl

___
Python tracker 

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



[issue43272] AMD64 Arch Linux VintageParser 3.9: test_fstring test_named_expressions test_unpack_ex failed

2021-02-19 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

;)

--

___
Python tracker 

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



[issue43272] AMD64 Arch Linux VintageParser 3.9: test_fstring test_named_expressions test_unpack_ex failed

2021-02-19 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for fixing this preciuus buildbot worker.

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Let's continue this at https://github.com/python/cpython/pull/24588

--

___
Python tracker 

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



[issue43272] AMD64 Arch Linux VintageParser 3.9: test_fstring test_named_expressions test_unpack_ex failed

2021-02-19 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset f9d1bf2de07131a8d80bc1e4914ee534bc5effa4 by Pablo Galindo in 
branch '3.9':
[3.9] bpo-43272: Fix old parser test failures for backported grammar constructs 
(GH-24591)
https://github.com/python/cpython/commit/f9d1bf2de07131a8d80bc1e4914ee534bc5effa4


--

___
Python tracker 

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



[issue43272] AMD64 Arch Linux VintageParser 3.9: test_fstring test_named_expressions test_unpack_ex failed

2021-02-19 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue42974] tokenize reports incorrect end col offset and line string when input ends without explicit newline

2021-02-19 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue43257] get_type_hints evaluates class variables before type hints

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Oops, I realized it's not really a compiler bug.  When the compiler sees

class C:
str: str = "abc"

if effectively rearranges that to

class C:
str = "abc"
__annotations__["str"] = str

(where __annotations__ is initialized to {} at the start of the class scope).

This goes to prove once again that silly things like

str: str

are an anti-pattern and should not be used.

--

___
Python tracker 

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



[issue43263] threading module unable to run

2021-02-19 Thread twoone3


twoone3 <3197653...@qq.com> added the comment:

Sorry, I didn't make the question clear yesterday.
My operating system is Windows and the compiler used is VS2019. My project 
address: https://github.com/twoone-3/BDSpyrunner
When I use Python.dll to import Python files, the program is stuck. After 
checking, I found that as long as I use multi-threading, the program will be 
stuck. Of course, this Python file can be directly run by Python.exe, but from  
My program cannot run normally when calling Python.dll

The file:
import threading
import time
 
def worker():
 print "worker"
 time.sleep( 1 )
 return
 
for i in xrange ( 5 ):
 t = threading.Thread(target = worker)
 t.start()

--
status: pending -> open

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks for the clarifications, Victor!

So I now understand: the *identity* of the builtins dict used by a function's 
code is captured when the function object is created. And I understand why: 
it's so that in the fast path for the LOAD_GLOBAL opcode we won't have to do a 
dict lookup in globals to find the builtins.

Regarding the text in What's New 3.10 about this at 
https://docs.python.org/dev/whatsnew/3.10.html#other-language-changes, I 
recommend adding there that func.__builtins__ is initialized from 
globals["__builtins__"], if it exists, else from the frame's builtins, when the 
function object is created; like you state in 
https://github.com/python/cpython/pull/24564. Or perhaps make one of these 
paragraphs refer to the other for details, since they are duplicate mentions of 
the same behavior change (once the latter PR lands).

Also, thanks to you and Mark and everyone else who has worked on optimizations 
like the globals cache and the method cache.

--

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Inada Naoki


Inada Naoki  added the comment:

This is not the problem only in the optimization. _textiowrapper_writeflush 
need to create buffer bytes object anyway and if it cause MemoryError, the 
TextIOWrapper can not flush internal buffer forever.

  stdout.write("small text")
  stdout.write("very large text")  # Calls writeflush, but can not allocate 
buffer.

This example would stuck on same situation without the optimization.


But the optimization made the problem easy to happen. Now the problem happend 
with only one learge text.

Idea to fix this problem:

* If input text is large (>1M?)
  * Flush buffer before adding the large text to the buffer.
  * Encode the text and write it to self->buffer soon. Do not put it into 
internal buffer (self->pending_bytes).

--

___
Python tracker 

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



[issue43042] Augment tutorial sentence.

2021-02-19 Thread miss-islington


miss-islington  added the comment:


New changeset a67fd011eadfae7103ca9e0a0b0f8312e4f00b0f by Miss Islington (bot) 
in branch '3.9':
bpo-43042: Augment tutorial sentence (GH-24514)
https://github.com/python/cpython/commit/a67fd011eadfae7103ca9e0a0b0f8312e4f00b0f


--

___
Python tracker 

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



[issue43202] Cleanup codeop._maybe_compile

2021-02-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Second patch: "Add comment, end others with period, remove unused variables, 
initialize others only when needed, and add explicit return."

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



[issue43042] Augment tutorial sentence.

2021-02-19 Thread miss-islington


miss-islington  added the comment:


New changeset a072788c57f7a40ecc53cb32f795f4ec844c0aba by Miss Islington (bot) 
in branch '3.8':
bpo-43042: Augment tutorial sentence (GH-24514)
https://github.com/python/cpython/commit/a072788c57f7a40ecc53cb32f795f4ec844c0aba


--

___
Python tracker 

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



[issue43272] AMD64 Arch Linux VintageParser 3.9: test_fstring test_named_expressions test_unpack_ex failed

2021-02-19 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
nosy: +pablogsal
nosy_count: 1.0 -> 2.0
pull_requests: +23371
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24591

___
Python tracker 

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



[issue43042] Augment tutorial sentence.

2021-02-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23370
pull_request: https://github.com/python/cpython/pull/24590

___
Python tracker 

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



[issue43042] Augment tutorial sentence.

2021-02-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +23369
pull_request: https://github.com/python/cpython/pull/24589

___
Python tracker 

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



[issue43042] Augment tutorial sentence.

2021-02-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset b30fcba3a8abaabd1087f2392ae8aec4c1b1f210 by Terry Jan Reedy in 
branch 'master':
bpo-43042: Augment tutorial sentence (GH-24514)
https://github.com/python/cpython/commit/b30fcba3a8abaabd1087f2392ae8aec4c1b1f210


--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Brandt Bucher


Brandt Bucher  added the comment:

I understand. I would just like to see something that won't give new Python 
pattern-matching users (read: everybody) the very painful first impression that 
this is a switch. Can we rework it like:

match input().split():
case []:
print("Got nothing!")
case [first]:
print(f"Got one word: {first}")
case [first, last]:
print(f"Got two words: {first} and {last}")
case _:
print("Got more than two words!")

Or something? (Pardon the example, I don't write many tutorials...)

I've seen too many knee-jerk reactions over the past weeks along the lines of 
"the new switch feature can't handle named constants!". My hope is something 
like the above might provide a more accurate, informative intro.

--

___
Python tracker 

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



[issue42825] Build libraries with "/OPT:REF" linker optimization on Windows

2021-02-19 Thread Austin Lamb


Austin Lamb  added the comment:

Thanks Steve!

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

> It's not a huge deal, but I vote that we either drop or rework the 
> "http_error" examples. I think it gives people a very wrong first impression 
> that makes the rest of the behavior quite surprising.
> 
> Can it be changed to build off of something familiar, like unpacking? I like 
> 636's approach much more.

So 636 Appendix A is identical to the tutorial in the README of the patma repo. 
It uses http errors for the very first example only, which introduces literal 
matching.  The main text of 636 is too long for what's new IMO, and also a bit 
unfinished.  It is meant as a gentle intro.  The Appendix is meant as an intro 
to pattern matching for experienced Python users (the kind of people for whom 
the what's new series of documents is written).  This tutorial takes the user 
from the simplest forms of patterns (literals) via more complex ones (tuples, 
classes) to advanced concepts like nesting patterns, and then just lists a 
whole bunch of other features.  I started with http errors because 404 must be 
the world's famous number by now, well before pi or even 0 and 1. :-)

See for yourself: https://github.com/python/cpython/pull/24588

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Guido van Rossum


Change by Guido van Rossum :


--
pull_requests: +23368
pull_request: https://github.com/python/cpython/pull/24588

___
Python tracker 

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



[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-02-19 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
priority: normal -> release blocker

___
Python tracker 

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



[issue37146] opcode cache for LOAD_GLOBAL emits false alarm in memory leak hunting

2021-02-19 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Or maybe need a generic -X flag to tell Python that libregrtest is tracking 
> leaks, since we might need to change other parameters than only the opcode 
> cache size.

I think we should go this way, maybe even less "public". If we add a -X, then 
it will be too visible. Maybe some env variable?

--
nosy: +pablogsal

___
Python tracker 

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



[issue42825] Build libraries with "/OPT:REF" linker optimization on Windows

2021-02-19 Thread Steve Dower


Steve Dower  added the comment:

The ping was enough. Thanks!

--
assignee:  -> steve.dower
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



[issue42825] Build libraries with "/OPT:REF" linker optimization on Windows

2021-02-19 Thread Steve Dower


Steve Dower  added the comment:


New changeset b4af629f4d4868ef74ee298d66259fae78c7fd89 by Austin Lamb in branch 
'master':
bpo-42825: Enable /OPT:REF (GH-24098)
https://github.com/python/cpython/commit/b4af629f4d4868ef74ee298d66259fae78c7fd89


--

___
Python tracker 

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



[issue38302] [3.10] __pow__ and __rpow__ are not reached when __ipow__ returns NotImplemented for **=

2021-02-19 Thread Brett Cannon


Change by Brett Cannon :


--
pull_requests: +23367
pull_request: https://github.com/python/cpython/pull/24587

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Brandt Bucher


Brandt Bucher  added the comment:

> Would people be okay if I added the tutorial from Appendix A of PEP 636 to 
> Doc/whatsnew/3.10.rst?

Yes please!

It's not a huge deal, but I vote that we either drop or rework the "http_error" 
examples. I think it gives people a very wrong first impression that makes the 
rest of the behavior quite surprising.

Can it be changed to build off of something familiar, like unpacking? I like 
636's approach much more.

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't know who's really in charge of the docs. I suppose the PEP authors
are, collectively, but that runs the risk that we're all expecting the
person to our left in the circle to do it.

Would people be okay if I added the tutorial from Appendix A of PEP 636 to
Doc/whatsnew/3.10.rst? It's a bit shy of 200 lines, which is bigger than
the largest section there currently ("Parenthesized Context Managers" is
about 50 lines) but feels not unreasonable for something that's been the
subject of at least 7 PEPs and reviewed by two consecutive Steering
Councils. :-) The full whatsnew.rst is currently around 1000 lines. FWIW
the longest what's new ever was for 2.7, at 3300 lines. 3.8 was 2200 lines.

Okay, I'll just add the PR and we can take it from there.

--

___
Python tracker 

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



[issue43144] test_unicodedata: test_normalization uses network but doesn't depend on network resource

2021-02-19 Thread Arkadiusz Miśkiewicz

Arkadiusz Miśkiewicz  added the comment:

Sorry. Feel free to commit as own patch. It's trivial.

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-19 Thread Brandt Bucher


Brandt Bucher  added the comment:

To the folks working on docs:

Does it seem realistic to have something ready by the next alpha (March 1st)? 
I'd like to at least have a What's New entry and a rough draft tutorial by 
then, since we'll probably (hopefully?) have a bunch of users jumping on that 
release.

I can help if needed, since it looks like I'm mostly waiting on more PR review 
through the weekend. Or I can stay out of the way. :)

--

___
Python tracker 

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



[issue37146] opcode cache for LOAD_GLOBAL emits false alarm in memory leak hunting

2021-02-19 Thread Yury Selivanov


Yury Selivanov  added the comment:

> Giving the ability to control the cache size, at least at Python startup, is 
> one option.

I'd really prefer not to allow users to control cache sizes. There's basically 
no point in that; the only practically useful thing is to enable or disable it.

--

___
Python tracker 

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



[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-02-19 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +Mark.Shannon, gvanrossum

___
Python tracker 

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



[issue43181] Python macros don’t shield arguments

2021-02-19 Thread Vitaliy

Vitaliy  added the comment:

Thanks for the fix, it works for my use case. (btw that was
#define U(...) __VA_ARGS__
and not what I wrote).

> I don't think that PR 24533 should be backported to Python 3.8 and Python 
> 3.9. I prefer to avoid any risk of regression, and so only change Python 3.10.

> For Python 3.9 and older, a workaround is to wrap the call to 
> PyObject_TypeCheck() with your own static inline function.

For Python 3.8 that fix wouldn’t be needed as the `tp` argument was 
parenthesised in the macro.

Yet... the first argument is still unshielded, passed to a macro that expects 
one single macro argument. That’s not a regression, it wasn’t shielded in 3.8 
either, but why not just parenthesise each macro argument that denotes an 
expression (as opposed to e.g. name)?

--

___
Python tracker 

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



[issue42027] /passive run of Windows installer fail silently on Win7

2021-02-19 Thread Steve Dower


Steve Dower  added the comment:

Probably an easy fix, if someone has a Win7 machine around to test on (which I 
don't these days). There are some UI level comparisons in the bootstrapper C++ 
file under Tools/msi that probably need fixing.

Not urgent. Won't be long until Win10 is the only one we have to worry about.

--
priority: normal -> low
stage:  -> needs patch
type:  -> enhancement
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue42825] Build libraries with "/OPT:REF" linker optimization on Windows

2021-02-19 Thread Austin Lamb


Austin Lamb  added the comment:

What are the next steps for this - anything else I can provide, or is someone 
able to take a look at the Pull Request?

Thanks!

--

___
Python tracker 

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



[issue43265] [sqlite3] Improve backup error handling

2021-02-19 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

The unit test suite shows one case of improved "exception text". I'd say it's 
an improvement.

$ ./python.exe  # with GH-24586 applied
>>> import sqlite3
>>> c1 = sqlite3.connect(":memory:")
>>> c2 = sqlite3.connect(":memory:")
>>> c1.backup(c2, name="non-existing")
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.OperationalError: unknown database non-existing

$ python3.10  # latest alpha from python.org
>>> import sqlite3
>>> c1 = sqlite3.connect(":memory:")
>>> c2 = sqlite3.connect(":memory:")
>>> c1.backup(c2, name="non-existing")
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.OperationalError: SQL logic error

--

___
Python tracker 

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



[issue41837] Upgrade installers to OpenSSL 1.1.1i

2021-02-19 Thread Ned Deily


Change by Ned Deily :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue42338] Enable Debug Build For Python Native Modules in Windows, with Visual Studio Toolchain

2021-02-19 Thread Steve Dower


Steve Dower  added the comment:

That's the best solution.

Alternatively, you can install the debug binaries of CPython using the option 
in the installer, recompile 3rd party packages from source, and use true debug 
builds that way.

Unfortunately, there's not much we can do about 3rd party packages being 
complicated to compile. You'll have to work with those projects.

--
resolution:  -> not a bug
stage:  -> 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



[issue42405] Add distutils mvsccompiler support for Windows ARM64 build

2021-02-19 Thread Steve Dower


Steve Dower  added the comment:

Closed due to PEP 632 (distutils is now deprecated).

Changes to support this should go into setuptools or another build backend. I'm 
already trying to get some resources together to help these other projects 
build/test on ARM64, so that should help. If someone wants to make a start on 
developing the cross-compilation support (though I'm not 100% sure we'll need 
it...), that would be great.

--
resolution:  -> out of date
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



[issue30480] samefile and sameopenfile fail for WebDAV mapped drives

2021-02-19 Thread Steve Dower


Steve Dower  added the comment:

Same as issue33935, but since the newer issue has proposed solutions on it 
already, I'm preferring to keep that one open.

--
resolution:  -> duplicate
stage: test needed -> 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



[issue41837] Upgrade installers to OpenSSL 1.1.1i

2021-02-19 Thread Steve Dower


Steve Dower  added the comment:

Looks like we missed Christian's last message...

Have OpenSSL made an updated release? If this issue is as bad as the short 
description above sounds, I expect they would have.

It's possible to rebuild with the patch, but easier if it's a release.

(Also, Christian, should this have been a release blocker? We just made fast 
releases for a security concern...)

--

___
Python tracker 

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



[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-02-19 Thread STINNER Victor


STINNER Victor  added the comment:

If someone wants to measure the stack memory usage per function call, 
_testcapi.stack_pointer() can be used: see bpo-30866.

--

___
Python tracker 

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



[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-02-19 Thread Steve Dower


Steve Dower  added the comment:

Looks like someone increased the size of locals in the ceval functions.

If any new buffers have been added recently, moving the processing into a 
helper function or using a single buffer instead of allocating them in separate 
if/case blocks can help reduce it.

--

___
Python tracker 

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



[issue43272] AMD64 Arch Linux VintageParser 3.9: test_fstring test_named_expressions test_unpack_ex failed

2021-02-19 Thread STINNER Victor


New submission from STINNER Victor :

AMD64 Arch Linux VintageParser 3.9:
https://buildbot.python.org/all/#/builders/495/builds/147

3 tests failed:
test_fstring test_named_expressions test_unpack_ex

The latest success build was 4 months ago (Nov 2):
https://buildbot.python.org/all/#/builders/495/builds/107


**
File 
"/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/test/test_unpack_ex.py",
 line ?, in test.test_unpack_ex.__test__.doctests
Failed example:
(*x),y = 1, 2 # doctest:+ELLIPSIS
Expected:
Traceback (most recent call last):
  ...
SyntaxError: can't use starred expression here
Got nothing
**
File 
"/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/test/test_unpack_ex.py",
 line ?, in test.test_unpack_ex.__test__.doctests
Failed example:
(((*x))),y = 1, 2 # doctest:+ELLIPSIS
Expected:
Traceback (most recent call last):
  ...
SyntaxError: can't use starred expression here
Got nothing
**
File 
"/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/test/test_unpack_ex.py",
 line ?, in test.test_unpack_ex.__test__.doctests
Failed example:
z,(*x),y = 1, 2, 4 # doctest:+ELLIPSIS
Expected:
Traceback (most recent call last):
  ...
SyntaxError: can't use starred expression here
Got nothing
**
File 
"/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/test/test_unpack_ex.py",
 line ?, in test.test_unpack_ex.__test__.doctests
Failed example:
z,(*x) = 1, 2 # doctest:+ELLIPSIS
Expected:
Traceback (most recent call last):
  ...
SyntaxError: can't use starred expression here
Got nothing
**
File 
"/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/test/test_unpack_ex.py",
 line ?, in test.test_unpack_ex.__test__.doctests
Failed example:
((*x),y) = 1, 2 # doctest:+ELLIPSIS
Expected:
Traceback (most recent call last):
  ...
SyntaxError: can't use starred expression here
Got nothing
**
1 items had failures:
   5 of  91 in test.test_unpack_ex.__test__.doctests


==
FAIL: 
test_named_expression_invalid_rebinding_set_comprehension_iteration_variable 
(test.test_named_expressions.NamedExpressionInvalidTest) (case='Local reuse')
--
  File "", line 1
{i := 0 for i in range(5)}
   ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/test/test_named_expressions.py",
 line 185, in 
test_named_expression_invalid_rebinding_set_comprehension_iteration_variable
exec(code, {}, {})
AssertionError: "assignment expression cannot rebind comprehension iteration 
variable 'i'" does not match "invalid syntax (, line 1)"

==
FAIL: 
test_named_expression_invalid_rebinding_set_comprehension_iteration_variable 
(test.test_named_expressions.NamedExpressionInvalidTest) (case='Unpacking 
reuse')
--
  File "", line 1
{i := 0 for i, j in {(0, 1)}}
   ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/test/test_named_expressions.py",
 line 185, in 
test_named_expression_invalid_rebinding_set_comprehension_iteration_variable
exec(code, {}, {})
AssertionError: "assignment expression cannot rebind comprehension iteration 
variable 'i'" does not match "invalid syntax (, line 1)"

==
FAIL: test_named_expression_invalid_set_comprehension_iterable_expression 
(test.test_named_expressions.NamedExpressionInvalidTest) (case='Inside list')
--
  File "", line 1
{i for i in {2, 3, i := range(5)}}
 ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.9.pablogsal-arch-x86_64.oldparser/build/Lib/test/test_named_expressions.py",
 line 218, in 
test_named_expression_invalid_set_comprehension_iterable_expression
exec(code, {}) # Module scope
AssertionError: "assignment expression cannot be used in a comprehension 
iterable 

[issue43166] Unused letters in Windows-specific pragma optimize

2021-02-19 Thread STINNER Victor


STINNER Victor  added the comment:

Since this change, AMD64 Windows10 3.x buildbot started to crash with Windows 
fatal exception: stack overflow -> see bpo-43271.

--
nosy: +vstinner

___
Python tracker 

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



[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-02-19 Thread STINNER Victor


New submission from STINNER Victor :

AMD64 Windows10 3.x, build 856:
https://buildbot.python.org/all/#/builders/146/builds/856

17 tests failed:
test_exceptions test_fileio test_io test_isinstance test_json
test_lib2to3 test_logging test_pickle test_pickletools
test_plistlib test_richcmp test_runpy test_sys test_threading
test_traceback test_typing test_xml_etree

It may be a regression caused by:
"bpo-43166: Disable ceval.c optimisations for Windows debug builds (GH-24485)"
https://github.com/python/cpython/commit/b74396c3167cc780f01309148db02709bc37b432

The latest successful build was 11 days ago (Feb 9):
https://buildbot.python.org/all/#/builders/146/builds/819



0:01:46 load avg: 14.25 [ 61/426/1] test_xml_etree crashed (Exit code 
3221225725) -- running: test_tokenize (46.4 sec), test_largefile (1 min 10 sec)
Windows fatal exception: stack overflow

Current thread 0x110c (most recent call first):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\xml\etree\ElementTree.py", 
line 178 in __repr__
  File "D:\buildarea\3.x.bolen-windows10\build\lib\xml\etree\ElementTree.py", 
line 178 in __repr__
  File "D:\buildarea\3.x.bolen-windows10\build\lib\xml\etree\ElementTree.py", 
line 178 in __repr__
  ...

==
FAIL: test_recursion_limit (test.test_threading.ThreadingExceptionTests)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_threading.py", 
line 1203, in test_recursion_limit
self.assertEqual(p.returncode, 0, "Unexpected error: " + stderr.decode())
AssertionError: 3221225725 != 0 : Unexpected error: 

0:05:09 load avg: 29.65 [140/426/3] test_traceback crashed (Exit code 
3221225725) -- running: test_concurrent_futures (2 min 6 sec), test_mmap (2 min)
Windows fatal exception: stack overflow

Current thread 0x0118 (most recent call first):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_traceback.py", 
line 1154 in f
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_traceback.py", 
line 1156 in f
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_traceback.py", 
line 1156 in f
  ...

0:06:14 load avg: 29.15 [151/426/4] test_lib2to3 crashed (Exit code 3221225725) 
-- running: test_multiprocessing_spawn (31.7 sec), test_capi (1 min 3 sec), 
test_mmap (3 min 4 sec)
Windows fatal exception: stack overflow

Current thread 0x1b90 (most recent call first):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\lib2to3\pytree.py", line 496 
in generate_matches
  File "D:\buildarea\3.x.bolen-windows10\build\lib\lib2to3\pytree.py", line 845 
in generate_matches
  ...

--
components: Windows
messages: 387348
nosy: paul.moore, steve.dower, tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow
versions: Python 3.10

___
Python tracker 

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



[issue43265] [sqlite3] Improve backup error handling

2021-02-19 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
title: Improve sqlite3 backup error handling -> [sqlite3] Improve backup error 
handling

___
Python tracker 

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



[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-19 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
title: sqlite3_column_name() failures should raise MemoryError -> [sqlite3] 
sqlite3_column_name() failures should raise MemoryError

___
Python tracker 

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



[issue43251] sqlite3_column_name() failures should raise MemoryError

2021-02-19 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> Well, it returns NULL in case of out of memory, but is it the only cause? Can 
> NULL be returned for other reasons?

According to the SQLite docs, no. Looking at the source code, we see that it 
also returns NULL if the second parameter (column index) is out of range, but 
we already check that. AFAICS, the only reason for a NULL in our case is OOM.

--

___
Python tracker 

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



[issue43267] [sqlite3] Redundant type checks in pysqlite_statement_bind_parameter()

2021-02-19 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> It is a kind of optimization.

PyLong_Check is very fast (only one comparison, AFAICS), so there is no gain in 
first doing PyLong_CheckExact and then PyLong_Check. Ditto for unicode.

PyFloat_Check is the most expensive check, but it comes before both 
PyUnicode_Check and PyObject_CheckBuffer (both a lot faster), so that's AFAICS 
the opposite of an optimisation. Correct me if I'm wrong.

If we want to optimise it we should do PyLong_Check, PyUnicode_Check, 
PyObject_CheckBuffer, and then PyFloat_Check, no?

> there is nothing wrong in it.

True. I'll argue that my suggestion will improve readability and 
maintainability, which should be worth considering.

--

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-19 Thread STINNER Victor


STINNER Victor  added the comment:

Guido: "I'm still worried about the change in semantics where 
globals["__builtins__"] is assigned a different dict after the function object 
has been created (...)"

Well, there is a semantics change of Python 3.10 documented at:
https://docs.python.org/dev/whatsnew/3.10.html#other-language-changes

"Functions have a new __builtins__ attribute which is used to look for builtin 
symbols when a function is executed, instead of looking into 
__globals__['__builtins__']. (Contributed by Mark Shannon in bpo-42990.)"

And the function __builtins__ attribute is read-only.


Your example is not affected by PR 24564 because the globals has the 
"__builtins__" key.


In Python 3.10, you can modify func.__builtins__ (new attribute):
---
def foo(s): return len(s)
code = foo.__code__
FunctionType = type(foo)
f = FunctionType(code, {"__builtins__": {"len": len}})
print(f("abc"))
f.__builtins__.clear()
print(f("abc"))
---

Output:
---
3
Traceback (most recent call last):
  (...)
NameError: name 'len' is not defined
---


Mark: "Because globals['__builtins__'] is cached for each function activation, 
executing functions don't see updates."

In Python 3.10, if someone wants to hack builtins while the function is 
running, modifying the builtins namespace in-place works as expected:
---
def f():
print(len("test"))
builtins_ns = f.__globals__['__builtins__'].__dict__
#builtins_ns = f.__builtins__
builtins_ns['len'] = lambda x: 7
print(len("test"))

f()
---

Output:
---
4
7
---

It also works with "builtins_ns = f.__builtins__".


Guido: "I realize this is a pretty esoteric, but it does show the change in 
semantics (from later to earlier binding). Should we care? I like early binding 
because it allows more optimizations[1], but traditionally Python's semantics 
use late binding."

Modifying built-in functions/types is commonly done in tests. Example:
---
import unittest.mock

def func():
with unittest.mock.patch('builtins.chr', return_value='mock'):
return chr(65)

print(func())
---

The expected output is: "mock". Overriding an attribute of the builtins module 
immediately updates func.__builtins__. It works because func.__builtins__ is 
builtins.__dict__.

In FAT Python, I implemented an optimization which copies builtin functions to 
constants, replace LOAD_GLOBAL with LOAD_CONST:
https://fatoptimizer.readthedocs.io/en/latest/optimizations.html#copy-builtin-to-constant

This optimization breaks this Python semantics, it is no longer possible to 
override builtin functions in tests:
https://fatoptimizer.readthedocs.io/en/latest/semantics.html#builtin-functions-replaced-in-the-middle-of-a-function

--

___
Python tracker 

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



[issue43265] Improve sqlite3 backup error handling

2021-02-19 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue43263] threading module unable to run

2021-02-19 Thread Mark Dickinson


Change by Mark Dickinson :


--
resolution:  -> works for me
status: open -> pending

___
Python tracker 

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



[issue28007] Bad .pyc files prevent import of otherwise valid .py files.

2021-02-19 Thread Brett Cannon


Brett Cannon  added the comment:

Since this is still open I would assume it never made it in.

--

___
Python tracker 

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



[issue43265] Improve sqlite3 backup error handling

2021-02-19 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> I'm not sure about 1) because if target == source it means a user error. 
> OperationalError is usually used for non-user errors.

Yes, my bad. ProgrammingError would be better.
target == source results in SQLITE_ERROR, BTW.

I'll throw up a PR for 3., then.

--

___
Python tracker 

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



[issue28007] Bad .pyc files prevent import of otherwise valid .py files.

2021-02-19 Thread Brian Hulette


Brian Hulette  added the comment:

Hey there, I just came across this bug when looking into a problem with 
corrupted pyc files. Was the patch ever applied? I'm still seeing the original 
behavior in Python 3.7.

Thanks!

--
nosy: +hulettbh

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-19 Thread Mark Shannon


Mark Shannon  added the comment:

In Python 3.9 the binding is more late-ish binding, than true late binding.

Because globals['__builtins__'] is cached for each function activation, 
executing functions don't see updates.

Example:

>>> def f():
... print(len("test"))
... bltns = f.__globals__["__builtins__"]
... if hasattr(bltns, "__dict__"):
... bltns = bltns.__dict__
... new = bltns.copy()
... new["len"] = lambda x : 7
... f.__globals__["__builtins__"] = new
... print(len("test"))
... 
>>> 
>>> f()
4
4
>>> f()
7
7

True late binding would print:

>>> f()
4
7
>>> f()
7
7

--

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks, that's clearer.

I'm still worried about the change in semantics where globals["__builtins__"] 
is assigned a different dict after the function object has been created 
(similar to https://bugs.python.org/file49816/func_builtins2.py).

I.e.

def foo(): return len("abc")
code = foo.__code__
g = {"__builtins__": {"len": len}}
f = FunctionType(code, g)
f()  # Succeeds
g["__builtins__"] = {}
f()  # Fails in 3.9 and before, passes in 3.10

Assuming code uses len, does f() succeed or fail?

I realize this is a pretty esoteric, but it does show the change in semantics 
(from later to earlier binding). Should we care? I like early binding because 
it allows more optimizations[1], but traditionally Python's semantics use late 
binding.

[1] Not in this case, the user could still change the meaning of len() with e.g.

g["__builtins__"]["len"] = lambda x: return 42

--

___
Python tracker 

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



[issue37146] opcode cache for LOAD_GLOBAL emits false alarm in memory leak hunting

2021-02-19 Thread STINNER Victor


STINNER Victor  added the comment:

> (Or perhaps provide an -X flag to disable it without the need to recompile.)

Giving the ability to control the cache size, at least at Python startup, is 
one option.

Or maybe need a generic -X flag to tell Python that libregrtest is tracking 
leaks, since we might need to change other parameters than only the opcode 
cache size.

--

___
Python tracker 

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



[issue37146] opcode cache for LOAD_GLOBAL emits false alarm in memory leak hunting

2021-02-19 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue (but I'm not interested by trying to fix it).

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue42402] Termios module documentation is extremely lacking

2021-02-19 Thread Irit Katriel


Irit Katriel  added the comment:

Could it simply be that the link to mod:`termios` should have been to 
:manpage:`termios(3)` instead?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue37146] opcode cache for LOAD_GLOBAL emits false alarm in memory leak hunting

2021-02-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Please revert this and use a separate build flag (e.g. DISABLE_INLINE_CACHES) 
for the refleaks run. (Or perhaps provide an -X flag to disable it without the 
need to recompile.)

I am developing new inline cache ideas and of course I need to run in debug 
mode, so I regularly end up wasting some time until I remember to add a patch 
that changes OPCACHE_MIN_RUNS back.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue43267] [sqlite3] Redundant type checks in pysqlite_statement_bind_parameter()

2021-02-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is a kind of optimization. We first perform few fast checks for exact types, 
and then slower subclass checks.

I do not know whether this optimization is worth, but it was written so, and 
there is nothing wrong in it.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue43251] sqlite3_column_name() failures should raise MemoryError

2021-02-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Well, it returns NULL in case of out of memory, but is it the only cause? Can 
NULL be returned for other reasons?

--

___
Python tracker 

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



[issue43259] argparse: allow add_mutually_exclusive_group on add_argument_group

2021-02-19 Thread paul j3


paul j3  added the comment:

The parents mechanism is not elaborate.  It copies groups and actions by 
reference.  The comments that I quoted actually come from that method that does 
this copying.  

>From a quick glance at that code I see that it does not preserve the group 
>nesting.  Mutually_exclusive groups are added directly the parser.

Parents is primarily a convenience tool, especially if used entirely with your 
own code.  It's most valuable when importing the parent, and you don't have 
direct access to the code that constructed it.  But it seems to be used most 
often as a way of creating a number of similar subparsers.  For that it can be 
easily replaced with your own utility function(s).  There's no virtue in trying 
to do everything with the tools that argparse provides.

--

___
Python tracker 

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



[issue37146] opcode cache for LOAD_GLOBAL emits false alarm in memory leak hunting

2021-02-19 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23365
pull_request: https://github.com/python/cpython/pull/24582

___
Python tracker 

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



[issue43266] "String conversion and formatting" formatting messes up array subscripting

2021-02-19 Thread miss-islington


miss-islington  added the comment:


New changeset 1cfed3d5b0ec1419c8a1d5cf8bff1a6e1483771a by Miss Islington (bot) 
in branch '3.9':
closes bpo-43266: Improve array formatting. (GH-24573)
https://github.com/python/cpython/commit/1cfed3d5b0ec1419c8a1d5cf8bff1a6e1483771a


--

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-19 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue43257] get_type_hints evaluates class variables before type hints

2021-02-19 Thread Guido van Rossum

Guido van Rossum  added the comment:

Sure looks like a compiler bug! Can you investigate whether this occurs in 
earlier Python versions? Maybe bisect if it doesn’t?

--

___
Python tracker 

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



[issue43266] "String conversion and formatting" formatting messes up array subscripting

2021-02-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +23363
pull_request: https://github.com/python/cpython/pull/24584

___
Python tracker 

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



[issue43266] "String conversion and formatting" formatting messes up array subscripting

2021-02-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23364
pull_request: https://github.com/python/cpython/pull/24585

___
Python tracker 

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



[issue43266] "String conversion and formatting" formatting messes up array subscripting

2021-02-19 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 2d3e463e4a5aa109d1c15c86f9631580f5ef7a7e by Erlend Egeberg 
Aasland in branch 'master':
closes bpo-43266: Improve array formatting. (GH-24573)
https://github.com/python/cpython/commit/2d3e463e4a5aa109d1c15c86f9631580f5ef7a7e


--
nosy: +benjamin.peterson
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



[issue43265] Improve sqlite3 backup error handling

2021-02-19 Thread Андрей Воропаев

Change by Андрей Воропаев :


Added file: https://bugs.python.org/file49823/DOC-20200420-WA

___
Python tracker 

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



[issue43265] Improve sqlite3 backup error handling

2021-02-19 Thread Berker Peksag


Berker Peksag  added the comment:

I'm not sure about 1) because if target == source it means a user error. 
OperationalError is usually used for non-user errors.

3) sounds good to me if that part is already covered by tests and they passed.

--

___
Python tracker 

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



[issue43257] get_type_hints evaluates class variables before type hints

2021-02-19 Thread Ken Jin


Ken Jin  added the comment:

Hmm I noticed this occurs in Python 3.9 but not 3.10. If you insert ``from 
__future__ import annotations`` at the start of your code, it stops erroring.

Anyways, I don't think this is dataclass specific, the following code using a 
plain class also errors:

```
from typing import get_type_hints
class T:
str: str = 'a'

get_type_hints(T) # Error.
```

Inspecting __annotations__ tells us why:

>>> T.__annotations__
{'str': 'a'}

You can see that the annotations are wrong. Meanwhile with from __future__ 
import annotations:
>>> T.__annotations__
{'str': 'str'}

Seeing that SETUP_ANNOTATIONS in ceval.c didn't change, I suspect it's compiler 
related.

--
nosy: +gvanrossum, kj

___
Python tracker 

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-02-19 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 4a6bf276ed3e6687394afe26b0d9a061ac06fc6b by Nicholas Sim in 
branch 'master':
bpo-35134: Move non-limited C API files to Include/cpython/ (GH-24561)
https://github.com/python/cpython/commit/4a6bf276ed3e6687394afe26b0d9a061ac06fc6b


--

___
Python tracker 

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



[issue43268] [internals] Pass the current interpreter (interp) rather than the current Python thread state (state)

2021-02-19 Thread STINNER Victor


Change by STINNER Victor :


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



[issue43268] [internals] Pass the current interpreter (interp) rather than the current Python thread state (state)

2021-02-19 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 839184f85cb2d2ad514fff9b431733d1c9607533 by Victor Stinner in 
branch 'master':
bpo-43268: local_clear() uses _PyInterpreterState_GET() (GH-24583)
https://github.com/python/cpython/commit/839184f85cb2d2ad514fff9b431733d1c9607533


--

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-19 Thread Boštjan Mejak

Boštjan Mejak  added the comment:

Mr. Stinner, I really don't understand what are you hinting at.

--

___
Python tracker 

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



[issue43268] [internals] Pass the current interpreter (interp) rather than the current Python thread state (state)

2021-02-19 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23362
pull_request: https://github.com/python/cpython/pull/24583

___
Python tracker 

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



[issue30425] Python 3.6.1 (32-bit)_20170522020736.log

2021-02-19 Thread Irit Katriel


Irit Katriel  added the comment:

Chakrit, what is the issue you are reporting here?

--
nosy: +iritkatriel
resolution:  -> not a bug
status: open -> pending

___
Python tracker 

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



  1   2   >