[issue44791] Substitution of ParamSpec in Concatenate

2021-07-31 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Substitution of ParamSpec in Concatenate produces weird results:

>>> import typing
>>> P = typing.ParamSpec('P')
>>> typing.Concatenate[str, P][int]
typing.Concatenate[str, int]
>>> typing.Concatenate[str, P][[int]]
typing.Concatenate[str, (,)]
>>> typing.Concatenate[str, P][typing.Concatenate[int, P]]
typing.Concatenate[str, typing.Concatenate[int, ~P]]

But all these results are invalid:

>>> typing.Concatenate[str, int]
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/typing.py", line 309, in inner
return func(*args, **kwds)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 400, in __getitem__
return self._getitem(self, parameters)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 595, in Concatenate
raise TypeError("The last parameter to Concatenate should be a "

TypeError: The last parameter to Concatenate should be a ParamSpec variable.
>>> typing.Concatenate[str, (int,)]
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/typing.py", line 309, in inner
return func(*args, **kwds)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 400, in __getitem__
return self._getitem(self, parameters)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 595, in Concatenate
raise TypeError("The last parameter to Concatenate should be a "

TypeError: The last parameter to Concatenate should be a ParamSpec variable.
>>> typing.Concatenate[str, [int]]
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/typing.py", line 309, in inner
return func(*args, **kwds)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 400, in __getitem__
return self._getitem(self, parameters)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 595, in Concatenate
raise TypeError("The last parameter to Concatenate should be a "

TypeError: The last parameter to Concatenate should be a ParamSpec variable.
>>> typing.Concatenate[str, typing.Concatenate[int, P]]
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/typing.py", line 309, in inner
return func(*args, **kwds)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 400, in __getitem__
return self._getitem(self, parameters)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 595, in Concatenate
raise TypeError("The last parameter to Concatenate should be a "

TypeError: The last parameter to Concatenate should be a ParamSpec variable.

I expect that

1. The last parameter to Concatenate can be a Concatenate. Inner Concatenate 
should merge with the external one:

Concatenate[str, Concatenate[int, P]] -> Concatenate[str, int, P]
Concatenate[str, P][Concatenate[int, P]] -> Concatenate[str, int, P]

2. The last parameter to Concatenate can be a list of types. The result should 
be a list of types.

Concatenate[str, [int, dict]] -> [str, int, dict]
Concatenate[str, P][[int, dict]] -> [str, int, dict]

3. The last parameter to Concatenate can be an ellipsis.

Concatenate[str, ...]
Concatenate[str, P][...] -> Concatenate[str, ...]

--
components: Library (Lib)
messages: 398632
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Substitution of ParamSpec in Concatenate
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue44792] Improve syntax errors for invalid if expressions

2021-07-31 Thread Miguel Brito


New submission from Miguel Brito :

Hi, I was playing around with Python's grammar and noticed that the error 
message for if expression is generic, so not very informative.

I decided to improve it slightly.

*From*:

```
>>> a = 42 if True
  File "", line 1
a = 42 if True
  ^
SyntaxError: invalid syntax
```

*To*:

```
$ ./python
Python 3.10.0b4 (tags/v3.10.0b4-dirty:2ba4b20854, Jul 31 2021, 11:50:15) [GCC 
7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 42 if True
  File "", line 1
a = 42 if True
  ^
SyntaxError: invalid syntax. Conditional expression expected an 'else' here.
```

--
messages: 398633
nosy: miguendes
priority: normal
severity: normal
status: open
title: Improve syntax errors for invalid if expressions

___
Python tracker 

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



[issue44792] Improve syntax errors for invalid if expressions

2021-07-31 Thread Miguel Brito


Change by Miguel Brito :


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

___
Python tracker 

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



[issue44789] Code compliance concern in Parser/pegen/pegen.c

2021-07-31 Thread Dennis Clarke

Dennis Clarke  added the comment:

Let me see if I can be a bit more clear with the problem that I am
seeing on three separate systems. It does seem to be an issue in
a macro  : 

1) Debian Linux on IBM Power ppc64 big-endian : 

enceladus$ uname -a 
Linux enceladus 5.13.4-genunix #1 SMP Tue Jul 20 12:42:08 EDT 2021 ppc64 
GNU/Linux
enceladus$ gcc --version 
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

enceladus$ 
enceladus$ 
enceladus$ ls Parser/pegen/pegen.c Parser/pegen/pegen.h
Parser/pegen/pegen.c  Parser/pegen/pegen.h
enceladus$ 
enceladus$ /usr/bin/gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG \
> -fwrapv -Wall -std=iso9899:1999 -pedantic -g -O0 -fno-builtin -m64 \
> -mno-quad-memory-atomic -mfull-toc -mno-multiple -mupdate -mbig \
> -mregnames -fno-unsafe-math-optimizations -pedantic-errors \
> -Wextra -Wno-unused-result -Wno-unused-parameter \
> -Wno-missing-field-initializers \
> -Werror=implicit-function-declaration \
> -fvisibility=hidden \
> -I./Include/internal -I. -I./Include \
> -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE \
> -DPy_BUILD_CORE -o Parser/pegen/pegen.o Parser/pegen/pegen.c
In file included from Parser/pegen/pegen.c:5:
Parser/pegen/pegen.h: In function ‘_RAISE_SYNTAX_ERROR_INVALID_TARGET’:
Parser/pegen/pegen.h:297:47: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
  297 | return RAISE_SYNTAX_ERROR("invalid syntax");
  |   ^
Parser/pegen/pegen.c: In function ‘_PyPegen_check_barry_as_flufl’:
Parser/pegen/pegen.c:71:74: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
   71 | RAISE_SYNTAX_ERROR("with Barry as BDFL, use '<>' instead of 
'!='");
  | 
 ^
Parser/pegen/pegen.c: In function ‘tokenizer_error’:
Parser/pegen/pegen.c:323:81: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
  323 | RAISE_SYNTAX_ERROR("EOF while scanning triple-quoted string 
literal");
  | 
^
Parser/pegen/pegen.c:326:67: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
  326 | RAISE_SYNTAX_ERROR("EOL while scanning string literal");
  |   ^
Parser/pegen/pegen.c:329:62: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
  329 | RAISE_SYNTAX_ERROR("unexpected EOF while parsing");
  |  ^
Parser/pegen/pegen.c:332:90: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
  332 | RAISE_INDENTATION_ERROR("unindent does not match any outer 
indentation level");
  | 
 ^
Parser/pegen/pegen.c: In function ‘_PyPegen_number_token’:
Parser/pegen/pegen.c:953:62: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
  953 |   "in Python 3.6 and greater");
  |  ^
Parser/pegen/pegen.c: In function ‘_PyPegen_run_parser’:
Parser/pegen/pegen.c:1132:73: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
 1132 | RAISE_SYNTAX_ERROR("error at start before reading any 
input");
  | 
^
Parser/pegen/pegen.c:1135:62: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
 1135 | RAISE_SYNTAX_ERROR("unexpected EOF while parsing");
  |  ^
Parser/pegen/pegen.c:1139:60: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
 1139 | RAISE_INDENTATION_ERROR("unexpected indent");
  |^
Parser/pegen/pegen.c:1142:62: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
 1142 | RAISE_INDENTATION_ERROR("unexpected unindent");
  |  ^
Parser/pegen/pegen.c:1145:52: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
 1145 | RAISE_SYNTAX_ERROR("invalid syntax");
  |^
Parser/pegen/pegen.c:1153:97: error: ISO C99 requires at least one argument for 
the "..." in a variadic macro
 1153 | return RAISE_SYNTAX_ERROR("mul

[issue44789] Code compliance concern in Parser/pegen/pegen.c

2021-07-31 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Seems to me that you are not only running configure + make but you are adding 
things to the CFLAGS. Could you please add a list of all the extra complication 
flags you are adding?

--

___
Python tracker 

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



[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

>>> import typing
>>> T = typing.TypeVar('T')
>>> P = typing.ParamSpec('P')
>>> C = typing.Callable[P, T]
>>> C[int, str, float]
typing.Callable[[int], str]

int substitutes P as [int], str substitutes T, and the third argument float is 
ignored.

--
components: Library (Lib)
messages: 398636
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Arguments ignored in substitution in typing.Callable
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The proposed PR merges tests for typing.Callable (in test_typing.py) and 
collection.abc.Callable (in test_genericalias.py). All old tests are now 
executed for both implementations.

It has exposed a bug in typing.Callable (see issue44793) and minor bug in error 
message for collection.abc.Callable (missed space). It will help to support 
consistency of implementations in future.

--
components: Tests
messages: 398637
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Merge tests for typing.Callable and collection.abc.Callable
type: enhancement
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue44795] asyncio.run does not allow for graceful shutdown of main task

2021-07-31 Thread Andreas H.


New submission from Andreas H. :

The issue is that the main task (which was supplied to asyncio.run) has no 
chance to clean up its "own" sub-tasks and handle 
possible exceptions that occur during the sub-task clean up. It prevents a 
graceful shutdown.

There is no way to prevent the current printing of the "unhandled" exeption, 
even though the sub-task exception was catched by the main task. (See example 
below)


-- Current behavior --

When asyncio.run() receives an (unhanded) exception, all tasks are cancelled 
simultaneously. 

If any task generates an exception during its clean-up phase this is printed to 
the log, even though this exception is handled by the main task.


-- Expected behavior --

asyncio.run() should first cancel the main task, wait for it to complete its 
shutdown (and possible cancel its own sub-tasks, with exception catching), and 
*afterwards* cancel the remaining tasks.


-- Example Code --

For instance realize a graceful shutdown of a webserver when SIGTERM signal 
handler raises a SystemExit exception.




import os
import asyncio
import logging


async def main():

logging.basicConfig(level=logging.INFO)

async def sub_task():
logging.info('sub_task: enter')
try:
while True:
await asyncio.sleep(1)
logging.info('some_task: action')
finally:
logging.info('sub_task: cleanup')
await asyncio.sleep(3)
logging.info('sub_task: cleanup generates exception')
raise ValueError()
logging.info('sub_task: cleanup end')

task = asyncio.create_task(sub_task())
 
try:
while True:
await asyncio.sleep(1)
except Exception as e:
logging.info(f"Main: exception {repr(e)} received: something went 
wrong: cancelling sub-task")
task.cancel()
finally:
logging.info("Main: cleanup")
try:
await task
except Exception as e:
logging.info(f"Main: catched exception {repr(e)} from await 
sub_task")

try:
asyncio.run( main() )
except KeyboardInterrupt:
pass

-- Script Output with Ctrl+C manually generating an KeyboardInterrupt exception 
--


INFO:root:sub_task: enter
INFO:root:some_task: action
<--- CtrlC pressed here
INFO:root:Main: exception CancelledError() received: something went wrong: 
cancelling sub-task
INFO:root:Main: cleanup
INFO:root:sub_task: cleanup
INFO:root:sub_task: cleanup generates exception
INFO:root:Main: catched exception ValueError() from await sub_task
ERROR:asyncio:unhandled exception during asyncio.run() shutdown
task: .sub_task() done, defined at 
D:\Benutzer\projekte\iep\apps\data_player\_signals_test\test.py:10> 
exception=ValueError()>
Traceback (most recent call last):
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\runners.py", 
line 43, in run
return loop.run_until_complete(main)
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\base_events.py",
 line 574, in run_until_complete
self.run_forever()
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\base_events.py",
 line 541, in run_forever
self._run_once()
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\base_events.py",
 line 1750, in _run_once
event_list = self._selector.select(timeout)
  File "C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\selectors.py", 
line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\selectors.py", 
line 314, in _select
r, w, x = select.select(r, w, w, timeout)
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Benutzer\projekte\iep\apps\data_player\_signals_test\test.py", line 
14, in sub_task
await asyncio.sleep(1)
  File 
"C:\Users\z0013xar\AppData\Local\Continuum\anaconda3\lib\asyncio\tasks.py", 
line 595, in sleep
return await future
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Benutzer\projekte\iep\apps\data_player\_signals_test\test.py", line 
34, in main
await task
  File "D:\Benutzer\projekte\iep\apps\data_player\_signals_test\test.py", line 
20, in sub_task
raise ValueError()
ValueError

-- Expected Output --

Same as above but without

  "ERROR:asyncio:unhandled exception during asyncio.run() shutdown"

and following traceback

--
components: asyncio
messages: 398638
nosy: andreash, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.run does not allow for graceful shutdown of main task
type: behavior

___
Python tracker 


[issue44784] test_importlib uses deprecated SelectableGroups interface

2021-07-31 Thread Jason R. Coombs


Change by Jason R. Coombs :


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

___
Python tracker 

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



[issue4476] compileall fails if current dir has a "types" package

2021-07-31 Thread Felipe Rodrigues


Change by Felipe Rodrigues :


--
nosy: +fbidu
nosy_count: 5.0 -> 6.0
pull_requests: +26023
pull_request: https://github.com/python/cpython/pull/27509

___
Python tracker 

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



[issue44784] test_importlib uses deprecated SelectableGroups interface

2021-07-31 Thread miss-islington


miss-islington  added the comment:


New changeset 1cf8424a62db38a041d421a46618e025bbb87f89 by Jason R. Coombs in 
branch 'main':
bpo-44784: Apply changes from importlib_metadata 4.6.3 (GH-27508)
https://github.com/python/cpython/commit/1cf8424a62db38a041d421a46618e025bbb87f89


--
nosy: +miss-islington

___
Python tracker 

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



[issue44784] test_importlib uses deprecated SelectableGroups interface

2021-07-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26024
pull_request: https://github.com/python/cpython/pull/27510

___
Python tracker 

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



[issue44779] Checkouts stale following changes to .gitattributes

2021-07-31 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
nosy: +eamanu

___
Python tracker 

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Adding __parameters__ and __getitem__ in TypeVar and ParamSpec allows to 
generalize and simplify the code (especially the C code) and allows to add more 
runtime checks. It may open ways for further simplification.

Unfortunately it is not compatible with issue44098, so the latter changes 
should be reverted.

--
components: Library (Lib)
messages: 398640
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Add __parameters__ and __getitem__ in TypeVar and ParamSpec
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +Merge tests for typing.Callable and collection.abc.Callable

___
Python tracker 

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue44098] Remove ParamSpec from __parameters__ of most typing generics

2021-07-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See issue44796.

--

___
Python tracker 

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



[issue42815] new thread doesn't copy context of the parent thread

2021-07-31 Thread Jesús Cea Avión

Change by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue42815] new thread doesn't copy context of the parent thread

2021-07-31 Thread Guido van Rossum


Guido van Rossum  added the comment:

Trust me, it's too late to fix this in 3.10.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue44766] [easy doc] Remove redundant info in README.valgrind

2021-07-31 Thread Felipe Rodrigues


Change by Felipe Rodrigues :


--
keywords: +patch
nosy: +fbidu
nosy_count: 2.0 -> 3.0
pull_requests: +26026
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27509

___
Python tracker 

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



[issue4476] compileall fails if current dir has a "types" package

2021-07-31 Thread Felipe Rodrigues


Felipe Rodrigues  added the comment:

sorry about the noise, everyone. Missed an '6' in the end of the issue name

--

___
Python tracker 

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



[issue4476] compileall fails if current dir has a "types" package

2021-07-31 Thread Felipe Rodrigues


Change by Felipe Rodrigues :


--
pull_requests:  -26023

___
Python tracker 

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



[issue44797] test_socket should expect warnings in truncated-data tests

2021-07-31 Thread Irit Katriel


New submission from Irit Katriel :

I believe these warnings are a feature so the tests should expect them. Patch 
included.


% ./python.exe -E -We -m test -v test_socket

==
ERROR: testSecondCmsgTruncInData 
(test.test_socket.RecvmsgRFC3542AncillaryUDP6Test)
--
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 4176, 
in testSecondCmsgTruncInData
msg, ancdata, flags, addr = self.doRecvmsg(
^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 2701, 
in doRecvmsg
result = sock.recvmsg(bufsize, *args)
 
RuntimeWarning: received malformed or improperly-truncated ancillary data

==
ERROR: testSingleCmsgTruncInData 
(test.test_socket.RecvmsgRFC3542AncillaryUDP6Test)
--
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 4072, 
in testSingleCmsgTruncInData
msg, ancdata, flags, addr = self.doRecvmsg(
^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 2701, 
in doRecvmsg
result = sock.recvmsg(bufsize, *args)
 
RuntimeWarning: received malformed or improperly-truncated ancillary data

==
ERROR: testSecondCmsgTruncInData 
(test.test_socket.RecvmsgIntoRFC3542AncillaryUDP6Test)
--
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 4176, 
in testSecondCmsgTruncInData
msg, ancdata, flags, addr = self.doRecvmsg(
^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 2792, 
in doRecvmsg
result = sock.recvmsg_into([buf], *args)
 ^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data

==
ERROR: testSingleCmsgTruncInData 
(test.test_socket.RecvmsgIntoRFC3542AncillaryUDP6Test)
--
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 4072, 
in testSingleCmsgTruncInData
msg, ancdata, flags, addr = self.doRecvmsg(
^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 2792, 
in doRecvmsg
result = sock.recvmsg_into([buf], *args)
 ^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data

==
ERROR: testCmsgTruncLen0 (test.test_socket.RecvmsgSCMRightsStreamTest)
--
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 3749, 
in testCmsgTruncLen0
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(0), maxdata=0)
^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 3729, 
in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 2701, 
in doRecvmsg
result = sock.recvmsg(bufsize, *args)
 
RuntimeWarning: received malformed or improperly-truncated ancillary data

==
ERROR: testCmsgTruncLen0Plus1 (test.test_socket.RecvmsgSCMRightsStreamTest)
--
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 3755, 
in testCmsgTruncLen0Plus1
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(0) + 1, maxdata=1)
^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 3729, 
in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_socket.py", line 2701, 
in doRecvmsg
result = sock.recvmsg(bufsize, *args)
 
RuntimeWarning: received malformed or improperly-truncated ancillary da

[issue44791] Substitution of ParamSpec in Concatenate

2021-07-31 Thread Ken Jin


Ken Jin  added the comment:

Should Concatenate support substitution to begin with? PEP 612 doesn't say 
anything, and I am fairly certain it's a special typing form, not a generic. So 
I don't really understand what it means to substitute Concatenate.

Then again, Callable with a nested Concatenate can be substituted, and we 
currently implement that by using Concatenate's substitution behavior as proxy. 
But again, the meaning isn't clear to me.

I also noticed this strange part in PEP 612 about user-defined generic classes:

"`Generic[P]` makes a class generic on `parameters_expressions` (when P is a 
ParamSpec)":

...
class X(Generic[T, P]):
  f: Callable[P, int]
  x: T

def f(x: X[int, Concatenate[int, P_2]]) -> str: ...  # Accepted (KJ: What?)
...

The grammar for `parameters_expression` is:

parameters_expression ::=
  | "..."
  | "[" [ type_expression ("," type_expression)* ] "]"
  | parameter_specification_variable
  | concatenate "["
   type_expression ("," type_expression)* ","
   parameter_specification_variable
"]"

I'm very confused. Does this mean Concatenate is valid when substituting user 
generics? Maybe I should ask the PEP authors?

My general sense when I implemented the PEP was that it was intended primarily 
for static type checking only. IMO, runtime correctness wasn't its concern.

--

___
Python tracker 

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



[issue44797] test_socket should expect warnings in truncated-data tests

2021-07-31 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue44797] test_socket should expect warnings in truncated-data tests

2021-07-31 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +ncoghlan, vstinner

___
Python tracker 

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



[issue37880] For argparse add_argument with action='store_const', const should default to None.

2021-07-31 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 0ad173249d287794d53e6a1fe2d58bb2adee2276 by Jack DeVries in 
branch 'main':
bpo-37880: for argparse add_argument with action='store_const', const now 
defaults to None. (GH-26707)
https://github.com/python/cpython/commit/0ad173249d287794d53e6a1fe2d58bb2adee2276


--

___
Python tracker 

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



[issue44798] test_enum emits a deprecation warning from test_custom_strenum_with_warning

2021-07-31 Thread Irit Katriel


New submission from Irit Katriel :

% ./python.exe -E -We -m test -v test_enum


==
ERROR: test_custom_strenum_with_warning (test.test_enum.TestEnum)
--
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_enum.py", line 2324, in 
test_custom_strenum_with_warning
self.assertEqual(OkayEnum.one, '{}'.format(OkayEnum.one))
   ^
  File "/Users/iritkatriel/src/cpython-1/Lib/enum.py", line 1006, in __format__
warnings.warn(
^^
DeprecationWarning: in 3.12 format() will use the enum member, not the enum 
member's value;
use a format specifier, such as :d for an integer-based Enum, to maintain the 
current display

--

--
components: Tests
messages: 398647
nosy: ethan.furman, iritkatriel
priority: normal
severity: normal
status: open
title: test_enum emits a deprecation warning from 
test_custom_strenum_with_warning

___
Python tracker 

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



[issue44798] test_enum emits a deprecation warning from test_custom_strenum_with_warning

2021-07-31 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If Callable is nested, it works as expected:

>>> typing.List[C][int, str, float]
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/typing.py", line 309, in inner
return func(*args, **kwds)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 1028, in __getitem__
_check_generic(self, params, len(self.__parameters__))
^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 231, in _check_generic
raise TypeError(f"Too {'many' if alen > elen else 'few'} parameters for 
{cls};"

^^^
TypeError: Too many parameters for typing.List[typing.Callable[~P, ~T]]; actual 
3, expected 2

collections.abc.Callable raises an error too.

--

___
Python tracker 

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



[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset be4cb9089aaf58d5f90da5f9fa66dc3c6763b5a2 by Serhiy Storchaka in 
branch 'main':
bpo-44794: Merge tests for typing.Callable and collection.abc.Callable 
(GH-27507)
https://github.com/python/cpython/commit/be4cb9089aaf58d5f90da5f9fa66dc3c6763b5a2


--

___
Python tracker 

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



[issue44799] typing.get_type_hints() raises TypeError for a variable annotated by dataclasses.InitVar

2021-07-31 Thread Komiya Takeshi


New submission from Komiya Takeshi :

I found `typing.get_type_hints()` raises TypeError for a variable annotated by 
`dataclasses.InitVar` when lazy annotations evaluation-feature is enabled 
(a.k.a `__future__.annotations`).

```
$ cat test.py
from __future__ import annotations
from dataclasses import dataclass, InitVar
from typing import get_type_hints

@dataclass
class Foo:
attr: InitVar[int]


get_type_hints(Foo)
```

```
$ python -V
Python 3.9.6
$ python test.py
Traceback (most recent call last):
  File "/Users/tkomiya/work/sphinx/test.py", line 10, in 
get_type_hints(Foo)
  File "/Users/tkomiya/.pyenv/versions/3.9.6/lib/python3.9/typing.py", line 
1424, in get_type_hints
value = _eval_type(value, base_globals, localns)
  File "/Users/tkomiya/.pyenv/versions/3.9.6/lib/python3.9/typing.py", line 
290, in _eval_type
return t._evaluate(globalns, localns, recursive_guard)
  File "/Users/tkomiya/.pyenv/versions/3.9.6/lib/python3.9/typing.py", line 
545, in _evaluate
type_ =_type_check(
  File "/Users/tkomiya/.pyenv/versions/3.9.6/lib/python3.9/typing.py", line 
164, in _type_check
raise TypeError(f"{msg} Got {arg!r:.100}.")
TypeError: Forward references must evaluate to types. Got 
dataclasses.InitVar[int].
```

It goes well if lazy annotations evaluation is disabled.

--
components: Library (Lib)
messages: 398650
nosy: tkomiya
priority: normal
severity: normal
status: open
title: typing.get_type_hints() raises TypeError for a variable annotated by 
dataclasses.InitVar
versions: Python 3.10, 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



[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread miss-islington


miss-islington  added the comment:


New changeset 76903ff9ce2d28f542c44ba97aa043dde8b55daa by Miss Islington (bot) 
in branch '3.10':
bpo-44794: Merge tests for typing.Callable and collection.abc.Callable 
(GH-27507)
https://github.com/python/cpython/commit/76903ff9ce2d28f542c44ba97aa043dde8b55daa


--

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread Brandt Bucher


Brandt Bucher  added the comment:

Reopening as a release blocker.

It appears that this new rule is far too eager, and matches a much wider range 
of inputs than intended. Here is a case where it changes an IndentationError 
into a SyntaxError:

$ cat bug.py
print()
boom

On 3.9 (correct):

$ ./python.exe --version
Python 3.9.6+
$ ./python.exe bug.py
  File "/Users/brandtbucher/Desktop/GitHub/cpython/bug.py", line 2
boom
IndentationError: unexpected indent

On 3.10 (incorrect):

$ ./python.exe --version
Python 3.10.0b4+
$ ./python.exe bug.py
  File "/Users/brandtbucher/Desktop/GitHub/cpython/bug.py", line 1
print()
^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

On 3.11 (incorrect):

$ ./python.exe --version
Python 3.11.0a0
$ ./python.exe bug.py
  File "/Users/brandtbucher/Desktop/GitHub/cpython/bug.py", line 1
print()
^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

I recommend that this either be fixed or reverted before the RC.

--
components: +Parser -Interpreter Core
nosy: +brandtbucher
priority: normal -> release blocker
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
type: enhancement -> behavior

___
Python tracker 

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



[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue44788] Possibility to specify port in __init__ of ftplib.FTP

2021-07-31 Thread Marty


Marty  added the comment:

Well, if it's possible to connect to ftp server within __init__, I think that 
adding port parameter makes sense.
I mostly don't need to handle connect() and login() separately. All I need is 
to connect to ftp server and work with it. If there is some trouble with 
connection or login, the code still can't continue in this case.

I haven't discussed this idea there. I'm going to create a topic for it and I 
will add the link here.

--

___
Python tracker 

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



[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is also similar bug in Generic:

>>> from typing import *
>>> T = TypeVar("T")
>>> P = ParamSpec("P")
>>> class X(Generic[T, P]):
... f: Callable[P, int]
... x: T
... 
>>> P_2 = ParamSpec("P_2")
>>> X[int, P_2, str]
__main__.X[int, ~P_2]

--

___
Python tracker 

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



[issue44794] Merge tests for typing.Callable and collection.abc.Callable

2021-07-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
Removed message: https://bugs.python.org/msg398654

___
Python tracker 

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is also similar bug in Generic:

>>> from typing import *
>>> T = TypeVar("T")
>>> P = ParamSpec("P")
>>> class X(Generic[T, P]):
... f: Callable[P, int]
... x: T
... 
>>> P_2 = ParamSpec("P_2")
>>> X[int, P_2, str]
__main__.X[int, ~P_2]

--

___
Python tracker 

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2021-07-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
Removed message: https://bugs.python.org/msg398655

___
Python tracker 

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



[issue44793] Arguments ignored in substitution in typing.Callable

2021-07-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is also similar bug in Generic:

>>> from typing import *
>>> T = TypeVar("T")
>>> P = ParamSpec("P")
>>> class X(Generic[T, P]):
... f: Callable[P, int]
... x: T
... 
>>> P_2 = ParamSpec("P_2")
>>> X[int, P_2, str]
__main__.X[int, ~P_2]

--

___
Python tracker 

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



[issue44792] Improve syntax errors for invalid if expressions

2021-07-31 Thread Andre Roberge


Change by Andre Roberge :


--
nosy: +aroberge

___
Python tracker 

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



[issue44797] test_socket should expect warnings in truncated-data tests

2021-07-31 Thread Ned Deily


Ned Deily  added the comment:

Duplicate of Issue23828

--
nosy: +ned.deily

___
Python tracker 

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



[issue23828] test_socket testCmsgTruncLen0 gets "received malformed or improperly-truncated ancillary data" warning under OS X

2021-07-31 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6, Python 3.7, Python 
3.8

___
Python tracker 

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



[issue44797] test_socket should expect warnings in truncated-data tests

2021-07-31 Thread Irit Katriel


Irit Katriel  added the comment:

Indeed, thanks.

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> test_socket fails in MacOS High Sierra when running with -Werror

___
Python tracker 

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



[issue23828] test_socket testCmsgTruncLen0 gets "received malformed or improperly-truncated ancillary data" warning under OS X

2021-07-31 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 5.0 -> 6.0
pull_requests: +26031
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/27512

___
Python tracker 

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



[issue23828] test_socket testCmsgTruncLen0 gets "received malformed or improperly-truncated ancillary data" warning under OS X

2021-07-31 Thread Irit Katriel


Irit Katriel  added the comment:

In PR27512 I tried to make the test expect the warning, but then it fails on 
ubuntu, so this is not the right solution.

--

___
Python tracker 

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



[issue44798] test_enum emits a deprecation warning from test_custom_strenum_with_warning

2021-07-31 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> DeprecationWarning in test_enum over formatting

___
Python tracker 

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



[issue33671] Efficient zero-copy for shutil.copy* functions (Linux, OSX and Win)

2021-07-31 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy: +Anthony Sottile
nosy_count: 19.0 -> 20.0
pull_requests: +26032
pull_request: https://github.com/python/cpython/pull/27516

___
Python tracker 

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



[issue33671] Efficient zero-copy for shutil.copy* functions (Linux, OSX and Win)

2021-07-31 Thread Éric Araujo

Éric Araujo  added the comment:


New changeset b08c48e61745666df9aeee97d8bddbf1e5550627 by Anthony Sottile in 
branch 'main':
bpo-33671 fix orphaned comment in shutil.copyfileobj (GH-27516)
https://github.com/python/cpython/commit/b08c48e61745666df9aeee97d8bddbf1e5550627


--
nosy: +eric.araujo

___
Python tracker 

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



[issue44791] Substitution of ParamSpec in Concatenate

2021-07-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

My understanding is that type expression is valid when substitute TypeVar and 
parameters expression is valid when substitute ParamSpec.

--

___
Python tracker 

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



[issue44791] Substitution of ParamSpec in Concatenate

2021-07-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue44760] Turtle Documentation - Contents Hyperlink conflict

2021-07-31 Thread Éric Araujo

Change by Éric Araujo :


--
keywords: +easy
stage:  -> needs patch
type: enhancement -> behavior
versions:  -Python 3.10, Python 3.6, Python 3.7, 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



[issue41914] test_pdb fails

2021-07-31 Thread Irit Katriel


Irit Katriel  added the comment:

Sumagna,

Thanks for the report. The test is passing on our buildbots, so this is not a 
general problem with it.

It is hard to do anything about this without information about the platform and 
environment on which you saw the failure. If you are still seeing it, please 
create a new issue and include these details.

--
nosy: +iritkatriel
resolution:  -> works for me
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



[issue44789] Code compliance concern in Parser/pegen/pegen.c

2021-07-31 Thread Dennis Clarke

Dennis Clarke  added the comment:

This was an excellent opportunity to review these CFLAGS and to
ponder the value of each. This took me a day to write and was
then reviewed by a team. I hope it answers your question.

---

There is nothing too unusual in the CFLAGS on any system. I have
used this sort of config for many years without too many problems.
There are always some open source software packages that are a bit
"special" and one can not expect strictly portable code everywhere.
However some packages are really critical and Python would be one
of those certainly. We have to agree that the usage of some gnu
extensions breaks "-pedantic" always.

Let us go over these compiler flags for a Solaris 10 SPARC64 system.

beta $ echo $CC
/opt/developerstudio12.6/bin/c99

Clearly that is the C99 compiler. Similar to running f77 in order
to handle Fortran77 code.  However the f77 is just a symlink these
days and it points to f90.  Such is life in the modern world.


CFLAGS ?

I guess we can go over these one by one however they are all clearly
documented in the "Oracle(R) Developer Studio 12.6: C User's Guide" which
we may see here :

https://docs.oracle.com/cd/E77782_01/html/E77788/index.html

There is a fairly extensive discussion regarding "Features of C 99" :

https://docs.oracle.com/cd/E77782_01/html/E77788/bjayy.html

OKay lets look at these flags that I have used almost everywhere for
many years :

-Xc  is seen in section B.2.84 :

(c = conformance) Issues errors and warnings for programs
that use non-ISO C constructs. This option is strictly
conformant ISO C without K&R C compatibility extensions.

As a side comment here the compiler in use is C99 and this
option is somewhat similar to saying "-pedantic" and yes I
really do mean iso9899:1999 without any special flavour
sauce added :)

The documentation states :

   See D.1 for a discussion of supported 1999 ISO/IEC features.
   See Appendix H for a discussion of differences between
   ISO/IEC C and K&R C.

   All of that discussion is in the links above.


-errtags=yes -errwarn=%none -errfmt=error
-erroff=%none -errshort=full

Lets look at these as a group of options that ensure we get a
really verbose error message when needed.

From section B.2.12 we see -errfmt[=[no%]error] which is used
if you want to prefix the string "error:" to the beginning of
error messages so they are more easily distinguishable from
warning messages. The prefix is also attached to warnings that
are converted to errors by -errwarn.

Section B.2.17 we see -errwarn[=t] where I use t=%none such that
"... any warning message from causing the compiler to exit with
 a fatal status should any warning message be issued."

Around the same section we see -errtags=a for a being either a
yes or no. From the manual "Displays the message tag for each
warning message of the C compiler that can be suppressed with
the -erroff option or made a fatal error with the -errwarn
option."

This brings us to the -erroff flag discussed in section B.2.14
where it simply says %none enables all warning messages.

Finally there is -errshort which will determine how much data we
get from an error message. The option "full" should be pretty clear
and the section B.2.15 states "Error messages are printed with
tag names for types which have tag names. If there is no tag
name, the type is shown in expanded form."

-m64 -xarch=sparc

These are trivial and merely specify that we are building for a
64 bit platform and the target architecture is a SPARC. In this
specific case we are using a Fujitsu SPARC64 based server where
the full cpu description would be SPARC64-VII+ clock 2860 MHz.

-xO0 -g -xs

The -xO0 option is similar to what we see from GCC and LLVM/Clang
and other compilers. The compiler optimization level where here
we use a zero and this is not documented. It is in fact the default
and the compiler accepts this flag just fine. Any other number from
1 upwards to 5 indicates a level of optimization that is ever more
complex. To be blunt the use of a debugging switch -g with any level
of optimization above 2 will result in limited debug data. Section
B.2.150 lays out everything one would want to know for the SPARC and
AMD64 platforms.

The -xs option is a bit special in that it allows debug information
to be encoded into the executable binaries. Section B.2.172 shows
us the default is in fact -xs=yes. This is the same and simply -xs
by itself. When the compile command forces linking (that is, -c is
  

[issue44789] Code compliance concern in Parser/pegen/pegen.c

2021-07-31 Thread Dennis Clarke


Dennis Clarke  added the comment:

Minor note. I am going to change the component to the Parser.

--
components: +Parser -C API

___
Python tracker 

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



[issue41983] Missing Documentation AF_PACKET

2021-07-31 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 3.0 -> 4.0
pull_requests: +26034
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27519

___
Python tracker 

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



[issue41983] Missing Documentation AF_PACKET

2021-07-31 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I've put up the PR here that makes availability clearer in the docs: 
https://github.com/python/cpython/pull/27519/files

--

___
Python tracker 

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



[issue41983] Missing Documentation AF_PACKET

2021-07-31 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue44765] Misspelled Word In Docs

2021-07-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Eesa, when responding by email, please delete the message you are responding 
to.  When posted on the web page, the quoted copy becomes noisy and 
distracting.  Visit https://bugs.python.org/issue44765 to see the result.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue20703] RuntimeError caused by lazy imports in pdb

2021-07-31 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 5.0 -> 6.0
pull_requests: +26035
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27520

___
Python tracker 

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



[issue20703] RuntimeError caused by lazy imports in pdb

2021-07-31 Thread Irit Katriel


Irit Katriel  added the comment:

I agree with both Eric and Xavier - any library calling a function that 
modifies sys.modules will see this issue, but pdb should try not to modify 
program semantics like this. 

It's fixed if we move the readline import as Louie suggested (the _bootlocale 
import was probably removed by now, I don't see it).

--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue35673] Loader for namespace packages

2021-07-31 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue42839] SourceFileLoader does not (fully) accept path-like objects

2021-07-31 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue44789] Code compliance concern in Parser/pegen/pegen.c

2021-07-31 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

You cannot compile CPython with `-pedantic`. For example, if i add that to my 
collection of CFLAGS with gcc 11, many object files do not compile (too many to 
report here). That is not a supported compilation flag and certainly this 
problem is not only about the parser.

I would suggest to close this issue and maybe reopen another one regarding 
"CPython doesn't compile with -pedantic".

--

___
Python tracker 

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



[issue44789] Code compliance concern in Parser/pegen/pegen.c

2021-07-31 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

For example, if I remove -Werror, you will get tons of warnings that will 
eventually become errors even if the parser code is "fixed":

./Modules/posixmodule.c:13781:18: note: (near initialization for 
‘DirEntryType_slots[1].pfunc’)
./Modules/posixmodule.c: In function ‘ScandirIterator_dealloc’:
./Modules/posixmodule.c:14198:26: warning: ISO C forbids initialization between 
function pointer and ‘void *’ [-Wpedantic]
14198 | freefunc free_func = PyType_GetSlot(tp, Py_tp_free);
  |  ^~
./Modules/posixmodule.c: At top level:
./Modules/posixmodule.c:14211:21: warning: ISO C forbids initialization between 
function pointer and ‘void *’ [-Wpedantic]
14211 | {Py_tp_dealloc, ScandirIterator_dealloc},
  | ^~~
./Modules/posixmodule.c:14211:21: note: (near initialization for 
‘ScandirIteratorType_slots[0].pfunc’)
./Modules/posixmodule.c:14212:22: warning: ISO C forbids initialization between 
function pointer and ‘void *’ [-Wpedantic]
14212 | {Py_tp_finalize, ScandirIterator_finalize},
  |  ^~~~
./Modules/posixmodule.c:14212:22: note: (near initialization for 
‘ScandirIteratorType_slots[1].pfunc’)
./Modules/posixmodule.c:14213:18: warning: ISO C forbids initialization between 
function pointer and ‘void *’ [-Wpedantic]
14213 | {Py_tp_iter, PyObject_SelfIter},
  |  ^
./Modules/posixmodule.c:14213:18: note: (near initialization for 
‘ScandirIteratorType_slots[2].pfunc’)
./Modules/posixmodule.c:14214:22: warning: ISO C forbids initialization between 
function pointer and ‘void *’ [-Wpedantic]
14214 | {Py_tp_iternext, ScandirIterator_iternext},
  |  ^~~~
./Modules/posixmodule.c:14214:22: note: (near initialization for 
‘ScandirIteratorType_slots[3].pfunc’)
./Modules/posixmodule.c:15802:19: warning: ISO C forbids initialization between 
function pointer and ‘void *’ [-Wpedantic]
15802 | {Py_mod_exec, posixmodule_exec},
  |   ^~~~
./Modules/posixmodule.c:15802:19: note: (near initialization for 
‘posixmodile_slots[0].value’)
make: *** [Makefile:2045: Modules/posixmodule.o] Error 1

odules/gcmodule.c:2034:19: note: (near initialization for 
‘gcmodule_slots[0].value’)
gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall  -pedantic  
-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration
 -fvisibility=hidden  -I./Include/internal  -I. -I./Include
-DPy_BUILD_CORE_BUILTIN  -DPy_BUILD_CORE_BUILTIN -I./Include/internal -c 
./Modules/posixmodule.c -o Modules/posixmodule.o
In file included from ./Include/Python.h:51,
 from ./Modules/posixmodule.c:12:
./Modules/posixmodule.c:6838:11: error: array size missing in 
‘os_sched_param__doc__’
 6838 | PyDoc_VAR(os_sched_param__doc__);

Python/ceval.c:1223:25: warning: ISO C forbids ‘goto *expr;’ [-Wpedantic]
 1223 | #define DISPATCH_GOTO() goto *opcode_targets[opcode]
  | ^~~~
Python/ceval.c:1236:9: note: in expansion of macro ‘DISPATCH_GOTO’
 1236 | DISPATCH_GOTO(); \
  | ^
Python/ceval.c:4205:13: note: in expansion of macro ‘DISPATCH’
 4205 | DISPATCH();
  | ^~~~
Python/ceval.c:1223:25: warning: ISO C forbids ‘goto *expr;’ [-Wpedantic]
 1223 | #define DISPATCH_GOTO() goto *opcode_targets[opcode]
  | ^~~~
Python/ceval.c:1236:9: note: in expansion of macro ‘DISPATCH_GOTO’
 1236 | DISPATCH_GOTO(); \
  | ^
Python/ceval.c:4252:13: note: in expansion of macro ‘DISPATCH’
 4252 | DISPATCH();

--

___
Python tracker 

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



[issue44789] Code compliance concern in Parser/pegen/pegen.c

2021-07-31 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I'm removing the parser component, as this is a general problem (the only 
reason you see the parser is because with -Werror that is reported first).

--

___
Python tracker 

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



[issue44789] CPython cannot be compiled with -pedantic

2021-07-31 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
title: Code compliance concern in Parser/pegen/pegen.c -> CPython cannot be 
compiled with -pedantic

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Is not about the eagerness, the problem is that it matches *first*, the parser 
never gets to the indentation error in the second phase.

For example, with:

print(3) $ 34

❯ ./python bug.py
  File "/home/pablogsal/github/python/main/bug.py", line 1
print(3) $ 34
^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

The problem is that is matching the (3) as print + a number between 
parentheses. We just need to disallow to continue matching on the right
if it finds a '('.

--

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +26036
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/27521

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-31 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



[issue42028] Regression in mimetypes for image/bmp

2021-07-31 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This was fixed in https://github.com/python/cpython/pull/26300
so the issue can be closed as fixed, and the PR can also be closed.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 208a7e957b812ad3b3733791845447677a704f3e by Pablo Galindo Salgado 
in branch 'main':
bpo-34013: Don't consider a grouped expression when reporting legacy print 
syntax errors (GH-27521)
https://github.com/python/cpython/commit/208a7e957b812ad3b3733791845447677a704f3e


--

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26037
pull_request: https://github.com/python/cpython/pull/27522

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2021-07-31 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



[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread miss-islington


miss-islington  added the comment:


New changeset 35035bc35a9cb8617ab9fe9aac38aaf67c926aef by Miss Islington (bot) 
in branch '3.10':
bpo-34013: Don't consider a grouped expression when reporting legacy print 
syntax errors (GH-27521)
https://github.com/python/cpython/commit/35035bc35a9cb8617ab9fe9aac38aaf67c926aef


--

___
Python tracker 

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



[issue44800] Code readability: rename interpreter frames to execution frames

2021-07-31 Thread Nick Coghlan


New submission from Nick Coghlan :

When merging the bpo-44590 changes into my PEP 558 implementation branch, I 
found it very hard to follow when the code was referring to the new interpreter 
frames rather than the existing Python frame objects that were historically 
used for both execution and introspection.

The "interpreter frame" name was also a little confusing, since the 
introspection frames are still associated with a specific interpreter, they're 
just not required for code execution anymore, only for code introspection APIs 
that call for a full Python object.

So, inspired by the "gi_xframe" (etc) attributes added in 
https://github.com/python/cpython/pull/27077, I'm proposing the following 
internal refactoring:

* Rename "pycore_frame.h" to "pycore_xframe.h"
* Rename the _interpreter_frame struct to _execution_frame
* Rename the type from InterpreterFrame to ExecFrame
* Use "xf_" rather than "f_" as the struct field prefix on execution frames
* Use "xframe" and "xf" rather than "frame" and "f" for execution frame 
variables
* Consistently use _PyExecFrame as the access function prefix, rather than a 
confusing mixture of _PyFrame and _PyInterpreterFrame
* Rename _PyThreadState_PushFrame to _PyThreadState_PushExecFrame
* Rename _PyThreadState_PopFrame to _PyThreadState_PopExecFrame

--
messages: 398675
nosy: Mark.Shannon, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Code readability: rename interpreter frames to execution frames
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue44800] Code readability: rename interpreter frames to execution frames

2021-07-31 Thread Nick Coghlan


Change by Nick Coghlan :


--
dependencies: +Create frame objects lazily when needed

___
Python tracker 

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



[issue44800] Code readability: rename interpreter frames to execution frames

2021-07-31 Thread Nick Coghlan


Change by Nick Coghlan :


--
assignee:  -> ncoghlan

___
Python tracker 

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



[issue42053] fwalk: incorrect boolean test for non-fd arguments

2021-07-31 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

dubiousjim: I agree, it should be `and` or have the form `not (isinstance(..) 
or hasattr(..))`.

If you would like to make the patch, I can review.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44206] Add a version number to dict keys.

2021-07-31 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Reopening this and marking as a release blocker. Seems that a buildbot has 
found some cases where an assert fails:

https://buildbot.python.org/all/#/builders/562/builds/110/steps/5/logs/stdio

..python: Objects/dictobject.c:350: dictkeys_set_index: Assertion 
`keys->dk_version == 0' failed.
Fatal Python error: Aborted
Current thread 0x7f7dba340740 (most recent call first):
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/test_importlib/test_api.py",
 line 290 in test_reload_location_changed
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/case.py",
 line 549 in _callTestMethod
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/case.py",
 line 592 in run
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/case.py",
 line 652 in __call__
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 122 in run
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/suite.py",
 line 84 in __call__
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/unittest/runner.py",
 line 176 in run
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/support/__init__.py",
 line 979 in _run_suite
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/support/__init__.py",
 line 1104 in run_unittest
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/runtest.py",
 line 261 in _test_module
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/refleak.py",
 line 90 in dash_R
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/runtest.py",
 line 295 in _runtest_inner2
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/runtest.py",
 line 335 in _runtest_inner
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/runtest.py",
 line 215 in _runtest
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/runtest.py",
 line 245 in runtest
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/main.py",
 line 334 in rerun_failed_tests
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/main.py",
 line 712 in _main
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/main.py",
 line 655 in main
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/libregrtest/main.py",
 line 733 in main
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/test/__main__.py",
 line 2 in 
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/runpy.py",
 line 86 in _run_code
  File 
"/home/buildbot/buildarea/3.x.cstratak-RHEL7-x86_64.refleak/build/Lib/runpy.py",
 line 196 in _run_module_as_main

--
priority: normal -> release blocker
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



[issue44784] test_importlib uses deprecated SelectableGroups interface

2021-07-31 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset 21d5897982698a461215203ab51f56ad05648001 by Miss Islington (bot) 
in branch '3.10':
bpo-44784: Apply changes from importlib_metadata 4.6.3 (GH-27508) (#27510)
https://github.com/python/cpython/commit/21d5897982698a461215203ab51f56ad05648001


--

___
Python tracker 

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



[issue44784] test_importlib uses deprecated SelectableGroups interface

2021-07-31 Thread Jason R. Coombs


Change by Jason R. Coombs :


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



[issue42053] fwalk: incorrect boolean test for non-fd arguments

2021-07-31 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

By the way I confirmed that fixing this doesn't break any tests (perhaps 
unsurprising ;) )

--

___
Python tracker 

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



[issue43468] functools.cached_property incorrectly locks the entire descriptor on class instead of per-instance locking

2021-07-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Antti Haapala, I agree that this situation is catastrophic and that we need 
some way to avoid blocking parallel calculations of cached values for distinct 
instances of the same class. 

Here's an idea that might possibly work.  Perhaps, hold one lock only briefly 
to atomically test and set a variable to track which instances are actively 
being updated.  

If another thread is performing the update, use a separate condition condition 
variable to wait for the update to complete.

If no other thread is doing the update, we don't need to hold a lock while 
performing the I/O bound underlying function.  And when we're done updating 
this specific instance, atomically update the set of instances being actively 
updated and notify threads waiting on the condition variable to wake-up.

The key idea is to hold the lock only for variable updates (which are fast) 
rather than for the duration of the underlying function call (which is slow).  
Only when this specific instance is being updated do we use a separate lock 
(wrapped in a  condition variable) to block until the slow function call is 
complete.

The logic is hairy, so I've added Serhiy and Tim to the nosy list to help think 
it through.

--- Untested sketch -

class cached_property:
def __init__(self, func):
self.update_lock = RLock()
self.instances_other_thread_is_updating = {}
self.cv = Condition(RLock())
...

def __get__(self, instance, owner=None):
if instance is None:
return self
if self.attrname is None:
raise TypeError(
"Cannot use cached_property instance without calling 
__set_name__ on it.")
try:
cache = instance.__dict__
except AttributeError:  # not all objects have __dict__ (e.g. class 
defines slots)
msg = (
f"No '__dict__' attribute on {type(instance).__name__!r} "
f"instance to cache {self.attrname!r} property."
)
raise TypeError(msg) from None

val = cache.get(self.attrname, _NOT_FOUND)
if val is not _NOT_FOUND:
return val

# Now we need to either call the function or wait for another thread to 
do it
with self.update_lock:
# Invariant: no more than one thread can report
# that the instance is actively being updated
other_thread_is_updating = instance in instance_being_updated
if other_thread_is_updating:
instance_being_updated.add(instance)

# ONLY if this is the EXACT instance being updated
# will we block and wait for the computed result.
# Other instances won't have to wait
if other_thread_is_updating:
with self.cv:
while instance in instance_being_updated:
self.cv.wait()
return cache[self.attrname]

# Let this thread do the update in this thread
val = self.func(instance)
try:
cache[self.attrname] = val
except TypeError:
msg = (
f"The '__dict__' attribute on {type(instance).__name__!r} 
instance "
f"does not support item assignment for caching 
{self.attrname!r} property."
)
raise TypeError(msg) from None
with self.update_lock:
instance_being_updated.discard(instance)
self.cv.notify_all()
return val   

# XXX What to do about waiting threads when an exception occurs? 
# We don't want them to hang.  Should they repeat the underlying
# function call to get their own exception to propagate upwards?

--
nosy: +serhiy.storchaka, tim.peters

___
Python tracker 

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



[issue42053] fwalk: incorrect boolean test for non-fd arguments

2021-07-31 Thread Hasan


Change by Hasan :


--
keywords: +patch
nosy: +AliyevH
nosy_count: 2.0 -> 3.0
pull_requests: +26038
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27523

___
Python tracker 

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



[issue42053] fwalk: incorrect boolean test for non-fd arguments

2021-07-31 Thread Hasan


Change by Hasan :


--
pull_requests: +26039
pull_request: https://github.com/python/cpython/pull/27524

___
Python tracker 

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



[issue42053] fwalk: incorrect boolean test for non-fd arguments

2021-07-31 Thread Hasan


Change by Hasan :


--
pull_requests:  -26038

___
Python tracker 

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



[issue44800] Code readability: rename interpreter frames to execution frames

2021-07-31 Thread Nick Coghlan


Nick Coghlan  added the comment:

As a side effect of working on this, I noticed some changes that are needed to 
adapt the GDB integration hooks to the new frame state layout.

--
nosy: +pablogsal

___
Python tracker 

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



[issue43758] dict.config TimedRotatingFileHandler filename .suffix does not function

2021-07-31 Thread Vinay Sajip


Vinay Sajip  added the comment:

This is not the place for asking questions like this - please use Stack 
Overflow or the python-users mailing list.

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



[issue44186] TimedRotatingFileHandler overwrite log

2021-07-31 Thread Vinay Sajip


Change by Vinay Sajip :


Added file: https://bugs.python.org/file50194/log_44186.py

___
Python tracker 

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



[issue44186] TimedRotatingFileHandler overwrite log

2021-07-31 Thread Vinay Sajip


Vinay Sajip  added the comment:

I modified the provided test script (-> test_44186.py) and added a test shell 
script which runs it twice in succession. What it printed was:

6 51 43
TEST > [INFO] [2021-08-01 06:51:43] : foo 2021-08-01T06:51:43.091681
6 51 43
TEST > [INFO] [2021-08-01 06:51:43] : bar 2021-08-01T06:51:43.138274

and the log files created were

$ more test.log*
::
test.log
::
bar 2021-08-01T06:51:43.138274
::
test.log.2021-07-31
::
foo 2021-08-01T06:51:43.091681

So from what I can see, both logged messages are present and nothing has been 
lost. Can you describe the problem more clearly? I can't see one.

--
Added file: https://bugs.python.org/file50195/test.sh

___
Python tracker 

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



[issue40469] TimedRotatingFileHandler rotating on use not time

2021-07-31 Thread Vinay Sajip


Change by Vinay Sajip :


Added file: https://bugs.python.org/file50196/config.json

___
Python tracker 

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



[issue40469] TimedRotatingFileHandler rotating on use not time

2021-07-31 Thread Vinay Sajip


Vinay Sajip  added the comment:

With this slightly modified test script and the JSON configuration based on the 
YAML, I got the following results after running for a while:

$ more info.log*
::
info.log
::
2021-08-01 07:13:45 INFO Message no. 9
2021-08-01 07:14:15 INFO Message no. 10
::
info.log.2021-08-01_07-09
::
2021-08-01 07:09:45 INFO Message no. 1
2021-08-01 07:10:15 INFO Message no. 2
::
info.log.2021-08-01_07-10
::
2021-08-01 07:10:45 INFO Message no. 3
2021-08-01 07:11:15 INFO Message no. 4
::
info.log.2021-08-01_07-11
::
2021-08-01 07:11:45 INFO Message no. 5
2021-08-01 07:12:15 INFO Message no. 6
::
info.log.2021-08-01_07-12
::
2021-08-01 07:12:45 INFO Message no. 7
2021-08-01 07:13:15 INFO Message no. 8

The test script logs every 30 seconds, so I don't see what the problem is. Can 
you describe it more clearly?

--
keywords:  -patch
Added file: https://bugs.python.org/file50197/log_40469.py

___
Python tracker 

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



[issue37880] For argparse add_argument with action='store_const', const should default to None.

2021-07-31 Thread Vinay Sajip


Change by Vinay Sajip :


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



[issue44489] _handle_existing_loggers should respect loggers that were manually disabled

2021-07-31 Thread Vinay Sajip


Vinay Sajip  added the comment:

Why couldn't you just do the logging configuration first, then disable any 
loggers you need to after that?

You can pass a custom configuration dict when instantiating a Sanic app. That 
could contain a setting for the ddtrace logger, e.g. to set its level to 
logging.CRITICAL + 1.

--

___
Python tracker 

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



[issue43749] venv module does not copy the correct python exe

2021-07-31 Thread Vinay Sajip


Change by Vinay Sajip :


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



  1   2   >