[issue31904] Python should support VxWorks RTOS

2020-12-08 Thread Peixing Xin


Change by Peixing Xin :


--
pull_requests: +22578
pull_request: https://github.com/python/cpython/pull/23716

___
Python tracker 

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



[issue42504] Failure to build with MACOSX_DEPLOYMENT_TARGET=11 on Big Sur

2020-12-08 Thread mattip


mattip  added the comment:

It seems the approach that "The code for sysconfig.get_config_var() has a 
pretty clear intent: it will try to cast its return value to an int." has been 
accepted as true even though other parts of the code assumed the returned value 
was a string, and the CPython code was updated appropriately. This is causing 
problems for downstream libraries like NumPy, see 
https://github.com/numpy/numpy/pull/17906. If CPython does not wish to 
reconsider this decision, it should at least be documented clearly via a type 
hint and/or in the documentation for sysconfig.get_config_var 
https://docs.python.org/3/library/sysconfig.html#sysconfig.get_config_var

--
nosy: +mattip

___
Python tracker 

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



[issue39791] New `files()` api from importlib_resources.

2020-12-08 Thread Shantanu


Change by Shantanu :


--
nosy: +hauntsaninja
nosy_count: 8.0 -> 9.0
pull_requests: +22577
pull_request: https://github.com/python/cpython/pull/23715

___
Python tracker 

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



[issue42567] Enum: manually call __init_subclass__ after members are added

2020-12-08 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +22576
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23714

___
Python tracker 

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



[issue42456] Logical Error

2020-12-08 Thread Tim Peters


Tim Peters  added the comment:

Please ask for help on StackOverflow or the general Python mailing list. Your 
understanding of the operations is incorrect.

"&" is NOT a logical operator ("and" is). It's a bitwise operator on integers.

>>> 10 & 10
10
>>> bin(10)
'0b1010'

The last bit is 0, so when you "&" the result with True (which is equivalent to 
integer 1) the result is 0:

>>> (10 & 10) & True
0

and the integer 0 is treated as False in a Boolean context.

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue42456] Logical Error

2020-12-08 Thread Nishant Gautam


Nishant Gautam  added the comment:

a = 10

b = 10


if (a >= b) & (a & b) & (a == b):

print("Yes")

else:

print("No")

Output: No

This is the bug because all then condition in if is true but it print No, This 
is the vulnerability of this code.

--
resolution: not a bug -> 
status: closed -> open
versions: +Python 3.6, Python 3.7, Python 3.9
Added file: https://bugs.python.org/file49662/main.py

___
Python tracker 

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



[issue42607] raw strings SyntaxError

2020-12-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

This is a FAQ: 
https://docs.python.org/3/faq/design.html#why-can-t-raw-strings-r-strings-end-with-a-backslash

Raw strings can't end with an odd number of backslashes.

--
components:  -Windows
nosy: +eric.smith
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



[issue42607] raw strings SyntaxError

2020-12-08 Thread 安迷

New submission from 安迷 :

[test@test ~]# python3 -c 'print(r"\n")'
\n
[test@test ~]# python3 -c 'print(r"n\")'
  File "", line 1
print(r"n\")
   ^
SyntaxError: EOL while scanning string literal

--
components: Windows
messages: 382785
nosy: anmikf, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: raw strings SyntaxError
type: behavior
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue42606] Support POSIX atomicity guarantee of O_APPEND on Windows

2020-12-08 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue42606] Support POSIX atomicity guarantee of O_APPEND on Windows

2020-12-08 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

On POSIX-conforming systems, O_APPEND flag for open() must ensure that no 
intervening file modification occurs between changing the file offset and the 
write operation[1]. In effect, two processes that independently opened the same 
file with O_APPEND can't overwrite each other's data. On Windows, however, the 
Microsoft C runtime implements O_APPEND as an lseek(fd, 0, SEEK_END) followed 
by write(), which obviously doesn't provide the above guarantee. This affects 
both os.open() and the builtin open() Python functions, which rely on _wopen() 
from MSVCRT. A demo is attached.

While POSIX O_APPEND doesn't guarantee the absence of partial writes, the 
guarantee of non-overlapping writes alone is still useful in cases such as 
debug logging from multiple processes without file locking or other 
synchronization. Moreover, for local filesystems, partial writes don't really 
occur in practice (barring conditions such as ENOSPC or EIO).

Windows offers two ways to achieve non-overlapping appends:

1. WriteFile()[2] with OVERLAPPED structure with Offset and OffsetHigh set to 
-1. This is essentially per-write O_APPEND.

2. Using a file handle with FILE_APPEND_DATA access right but without 
FILE_WRITE_DATA access right.

While (1) seems easy to add to FileIO, there are some problems:

* os.write(fd) can't use it without caller's help because it has no way to know 
that the fd was opened with O_APPEND (there is no fcntl() in MSVCRT)

* write() from MSVCRT (currently used by FileIO) performs some additional 
remapping of error codes and checks after it calls WriteFile(), so we'd have to 
emulate that behavior or risk breaking compatibility.

I considered to go for (2) by reimplementing _wopen() via CreateFile(), which 
would also allow us to solve a long-standing issue of missing FILE_SHARE_DELETE 
on file handles, but hit several problems:

* the most serious one is rather silly: we need to honor the current umask to 
possibly create a read-only file, but there is no way to query it without 
changing it, which is not thread-safe. Well, actually, I did discover a way: 
_umask_s(), when called with an invalid mask, returns both EINVAL error and the 
current umask. But this behavior directly contradicts MSDN, which claims that 
_umask_s() doesn't modify its second argument on failure[3]. So I'm not willing 
to rely on this until Microsoft fixes their docs.

* os module exposes some MSVCRT-specific flags for use with os.open() (like 
O_TEMPORARY), which a reimplementation would have to support. It seems easy in 
most cases, but there is O_TEXT, which enables some obscure legacy behavior in 
MSVCRT such as removal of a trailing byte 26 (Ctrl-Z) when a file is opened 
with O_RDWR. More generally, it's unclear to me whether os.open() is explicitly 
intended to be a gateway to MSVCRT and thus support all current and future 
flags or is just expected to work similarly to MSVCRT in common cases.

So in the end I decided to let _wopen() create the initial fd as usual, but 
then fix it up via DuplicateHandle() -- see the PR.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html
[2] 
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-writefile
[3] 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/umask-s?view=msvc-160

--
components: IO, Windows
files: test.py
messages: 382784
nosy: eryksun, izbyshev, paul.moore, steve.dower, tim.golden, vstinner, 
zach.ware
priority: normal
severity: normal
status: open
title: Support POSIX atomicity guarantee of O_APPEND on Windows
type: enhancement
versions: Python 3.10
Added file: https://bugs.python.org/file49661/test.py

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

> boost https://bugzilla.redhat.com/show_bug.cgi?id=1896382

I proposed https://github.com/boostorg/python/pull/330 fix.

See also https://github.com/boostorg/python/pull/329

--

___
Python tracker 

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



[issue42605] dir_util.copy_tree crashes if folder it previously created is removed

2020-12-08 Thread Aleksey Vlasenko


New submission from Aleksey Vlasenko :

Minimal example:

import os
import shutil
from distutils import dir_util

shutil.rmtree('folder1')

os.makedirs('folder1/folder2/folder3/')
with open('folder1/folder2/folder3/data.txt', 'w') as fp:
fp.write('hello')

print(os.path.exists('folder1/new_folder2')) # -> prints false
dir_util.copy_tree('folder1/folder2', 'folder1/new_folder2') # -> works

shutil.rmtree('folder1/new_folder2')
print(os.path.exists('folder1/new_folder2')) # -> prints false
dir_util.copy_tree('folder1/folder2', 'folder1/new_folder2') # -> crashes

---
FileNotFoundError Traceback (most recent call last)
/opt/conda/lib/python3.7/distutils/file_util.py in _copy_file_contents(src, 
dst, buffer_size)
 40 try:
---> 41 fdst = open(dst, 'wb')
 42 except OSError as e:

FileNotFoundError: [Errno 2] No such file or directory: 
'folder1/new_folder2/folder3/data.txt'

dir_util caches folders it previously created in a static global variable 
_path_created which is a bad idea:
https://github.com/python/cpython/blob/master/Lib/distutils/dir_util.py

--
components: Distutils
messages: 382782
nosy: dstufft, eric.araujo, vlasenkoalexey
priority: normal
severity: normal
status: open
title: dir_util.copy_tree crashes if folder it previously created is removed
type: crash
versions: 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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

> bitarray https://bugzilla.redhat.com/show_bug.cgi?id=1897536

I created https://github.com/ilanschnell/bitarray/pull/109

--

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

> pyside2 https://bugzilla.redhat.com/show_bug.cgi?id=1898974

I proposed a fix upstream: https://bugreports.qt.io/browse/PYSIDE-1436 I also 
wrote a fix in Fedora: 
https://src.fedoraproject.org/rpms/python-pyside2/pull-request/7 The issue is 
now tracked in Fedora as: https://bugzilla.redhat.com/show_bug.cgi?id=1902618

--

___
Python tracker 

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



[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-08 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Great approach :)

--

___
Python tracker 

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



[issue41559] Add support for PEP 612 to typing.py

2020-12-08 Thread Ken Jin


Ken Jin  added the comment:

I have a one question:
Should ParamSpec be treated as a type of TypeVar? This mostly pertains to
adding it to __parameters__ of generic aliases. Type substitution/chaining,
seems inappropiate for it right now.

Thanks for your help!

--

___
Python tracker 

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



[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 23711 (for bpo-32381) which removes half of the problem: it removes 
_Py_fopen() :-)

--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22574
pull_request: https://github.com/python/cpython/pull/23711

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 550e4673be538d98b6ddf5550b3922539cf5c4b2 by Victor Stinner in 
branch 'master':
bpo-32381: Add _PyRun_SimpleFileObject() (GH-23709)
https://github.com/python/cpython/commit/550e4673be538d98b6ddf5550b3922539cf5c4b2


--

___
Python tracker 

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



[issue41442] test_posix.PosixTester.test_getgroups fail on operating systems without supporting unix shell

2020-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
superseder:  -> Python should support VxWorks RTOS

___
Python tracker 

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



[issue41443] some test cases in test_posix.py fail if some os attributes are not supported

2020-12-08 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



[issue41439] test_uuid.py and test_ssl.py failure on OSes without os.fork (VxWorks RTOS)

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Peixing Xin, I merged your fix.

Terry:
> I could merge and backport

I don't think that it's worth it to backport to 3.9: Python 3.9 doesn't support 
VxWorks. I prefer to only merge VxWorks changes in the master branch.

Terry:
> We do not put conditions for unsupported oses in production code, but I don't 
> know about skips for such systems in tests.

The final change is not specific to VxWorks and so reasonable.

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



[issue41439] test_uuid.py and test_ssl.py failure on OSes without os.fork (VxWorks RTOS)

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 98a54171932584883cb3973f78dd30f92d7a3a78 by pxinwr in branch 
'master':
bpo-41439: Skip test_ssl and test_uuid tests if fork() is not supported 
(GH-21684)
https://github.com/python/cpython/commit/98a54171932584883cb3973f78dd30f92d7a3a78


--
nosy: +vstinner

___
Python tracker 

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



[issue41443] some test cases in test_posix.py fail if some os attributes are not supported

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset eb7594f85741ef809b1ee337ee3431df20e6f8bb by pxinwr in branch 
'master':
bpo-41443:  Add more attribute checking in test_posix (GH-21688)
https://github.com/python/cpython/commit/eb7594f85741ef809b1ee337ee3431df20e6f8bb


--
nosy: +vstinner

___
Python tracker 

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



[issue42572] Better path handling with argparse

2020-12-08 Thread paul j3


paul j3  added the comment:

One caution - the type parameter is a callable (function) that takes one string 
as argument.  I proposed `pathlib.Path` because it does that, returning a Path 
object.  It's a class instance creator.  I believe the module has other class 
initiators.

bool() has confused many users.  While it returns a bool class instance, True 
or False, the only string that returns False is the empty one, with argparse 
can't supply. It does not convert strings like 'False' or 'no' to boolean False.

--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22573
pull_request: https://github.com/python/cpython/pull/23709

___
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

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fe6e5e7cfd68eeaa69fd1511f354a1b4d8d90990 by Victor Stinner in 
branch 'master':
bpo-35134: Add Include/cpython/pythonrun.h file (GH-23701)
https://github.com/python/cpython/commit/fe6e5e7cfd68eeaa69fd1511f354a1b4d8d90990


--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 815506d852daabc40e14ff0987c1142c0205fbe7 by Victor Stinner in 
branch 'master':
bpo-32381: Rewrite PyErr_ProgramText() (GH-23700)
https://github.com/python/cpython/commit/815506d852daabc40e14ff0987c1142c0205fbe7


--

___
Python tracker 

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



[issue42603] Tkinter: pkg-config is not used to get location of tcl and tk headers/libraries

2020-12-08 Thread Manolis Stamatogiannakis


Manolis Stamatogiannakis  added the comment:

I already have a patch to fix this. Waiting for my CLA to be registered before 
creating a PR.

--

___
Python tracker 

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



[issue42604] EXT_SUFFIX too short on FreeBSD and AIX

2020-12-08 Thread mattip


Change by mattip :


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

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-12-08 Thread Michael Felt


Michael Felt  added the comment:

Sorry Victor - family matters - so I was not watching for several days.

--

___
Python tracker 

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



[issue42604] EXT_SUFFIX too short on FreeBSD and AIX

2020-12-08 Thread mattip


New submission from mattip :

Continuation of bpo 39825, this time for FreeBSD and AIX. As commented there, 
the test added in the fix to 39825 fails on FreeBSD and AIX:

FAIL: test_EXT_SUFFIX_in_vars (test.test_sysconfig.TestSysConfig)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_sysconfig.py",
 line 368, in test_EXT_SUFFIX_in_vars
self.assertEqual(vars['EXT_SUFFIX'], _imp.extension_suffixes()[0])
AssertionError: '.so' != '.cpython-310d.so'
- .so
+ .cpython-310d.so

So somehow EXT_SUFFIX is being set to .so rather than .cpython-310d.so.

It seems the difference in EXT_SUFFIX comes from this stanza in configure:

case $ac_sys_system in
Linux*|GNU*|Darwin|VxWorks)
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
*)
EXT_SUFFIX=${SHLIB_SUFFIX};;
esac

where $ac_sys_system is `uname -s`. On FREEBSD, this is "FreeBSD", and I think 
on AIX it is "AIX". My preference would be to always set EXT_SUFFIX to 
${SOABI}${SHLIB_SUFFIX}, with no option for setting it to a different value. 
Does that seem right?

--
components: Build
messages: 382767
nosy: mattip, vstinner
priority: normal
severity: normal
status: open
title: EXT_SUFFIX too short on FreeBSD and AIX
versions: Python 3.10, 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



[issue42572] Better path handling with argparse

2020-12-08 Thread Austin Scola


Austin Scola  added the comment:

I think that type=pathlib.Path is probably all that I was looking for here. I 
was unaware types could be passed easily like that and so updated documentation 
would definitely be helpful. The predicates such as existence would just have 
been nice-to-haves, but not necessary (and eric.smith brings up a good point 
about race conditions).

--

___
Python tracker 

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



[issue42572] Better path handling with argparse

2020-12-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Agreed that we should not include new functionality here and instead just 
update the docs to show what can currently be done.

I'll write-up a documentation patch for this.

--
assignee:  -> rhettinger
components: +Documentation -Library (Lib)
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



[issue42603] Tkinter: pkg-config is not used to get location of tcl and tk headers/libraries

2020-12-08 Thread E. Paine


Change by E. Paine :


--
components: +Build
nosy: +epaine, serhiy.storchaka
type: compile error -> enhancement
versions:  -Python 3.8, Python 3.9

___
Python tracker 

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



[issue41559] Add support for PEP 612 to typing.py

2020-12-08 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks for working on this -- let me know when you have a question for me. Once 
this is ready we should also add it to the typing_extensions module so people 
can use it on older Python versions. 
(https://github.com/python/typing/tree/master/typing_extensions)

--

___
Python tracker 

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



[issue41907] Regression in IntFlag behaviour in f-string

2020-12-08 Thread Ethan Furman


Change by Ethan Furman :


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



[issue41907] Regression in IntFlag behaviour in f-string

2020-12-08 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset cbfcc67170d459bcf3e9d63d2f44eadec740bf69 by Miss Islington (bot) 
in branch '3.8':
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497) (GH-23704)
https://github.com/python/cpython/commit/cbfcc67170d459bcf3e9d63d2f44eadec740bf69


--

___
Python tracker 

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



[issue41907] Regression in IntFlag behaviour in f-string

2020-12-08 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 14eaa7d75282d8458455c41e9e871c56db8b9a10 by Miss Islington (bot) 
in branch '3.9':
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497) (GH-23703)
https://github.com/python/cpython/commit/14eaa7d75282d8458455c41e9e871c56db8b9a10


--

___
Python tracker 

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



[issue24110] zipfile.ZipFile.write() does not accept bytes arcname

2020-12-08 Thread Irit Katriel


Irit Katriel  added the comment:

That part of the documentation was updated here by Serhiy: 
https://github.com/python/cpython/pull/10592

--
nosy: +iritkatriel

___
Python tracker 

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



[issue42572] Better path handling with argparse

2020-12-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

The more I think about this, the more I think it shouldn't be in the stdlib. 
paul.j3 is correct that the simple case is just type=pathlib.Path.

For something more adventurous you could start with:

@dataclass(eq=True, frozen=True)
class ArgumentPath:
must_exist: bool = False
# Add other conditions as needed.

def __call__(self, val):
result = Path(val)
if self.must_exist:
if not result.exists():
raise ValueError(f"path {result} must exist")
return result

The reason I think this shouldn't be in the stdlib is that there are race 
conditions here between when you inspect the filesystem and when you'd actually 
use the path. What if the file was deleting, or it went from being a directory 
to a file?

I think the best advice is to use type=pathlib.Path, and handle anything else 
when you try to cd, or open, or whatever it is you're doing with the path.

It probably wouldn't hurt to document type=pathlib.Path in the argparse docs.

--

___
Python tracker 

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



[issue41907] Regression in IntFlag behaviour in f-string

2020-12-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22571
pull_request: https://github.com/python/cpython/pull/23704

___
Python tracker 

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



[issue41907] Regression in IntFlag behaviour in f-string

2020-12-08 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +22570
pull_request: https://github.com/python/cpython/pull/23703

___
Python tracker 

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



[issue41907] Regression in IntFlag behaviour in f-string

2020-12-08 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 37440eef7f9a0c27e13fc9ce0850574bb00688b0 by Ethan Furman in 
branch 'master':
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497)
https://github.com/python/cpython/commit/37440eef7f9a0c27e13fc9ce0850574bb00688b0


--

___
Python tracker 

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



[issue42572] Better path handling with argparse

2020-12-08 Thread paul j3


paul j3  added the comment:

The pathlib.Path is new since I paid much attention to os matters (I cut my 
teeth on py2.5).

Off hand it looks like the user could

import pathlib
parser.add_argument('-p', type=pathlib.Path)

to convert a string into a Path object.

A custom type function could call this, and apply any desired methods before 
returning the Path object. But that should be up to the user, not the 
`argparse` developers.

Importing path specific modules such as pathlib (which in turn has a lot of 
imports) goes against the attempt to reduce the number of unnecessary imports 
with modules like argparse.

https://bugs.python.org/issue30152
Reduce the number of imports for argparse

After this diet argparse still imports os, and uses:

os.path.basename

I might also note that argparse has only one custom 'type' function, the 
FileType factory.  Other common type functions like 'int' and 'float' are 
Python builtin's.  Adding a custom 'bool' (to be used instead of the builtin 
'bool') has been rejected.

https://bugs.python.org/issue37564

json, yaml, and datetime types have also been rejected
https://bugs.python.org/issue35005

--

___
Python tracker 

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



[issue42059] TypedDict(...) as function does not respect "total" when setting __required_keys__ and __optional_keys__

2020-12-08 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue40600] Add option to disallow > 1 instance of an extension module

2020-12-08 Thread hai shi


hai shi  added the comment:

> another solution is to move the "module state" into the interpreter,

OK, I am agree victor's solution too. It's a more simpler way.

--

___
Python tracker 

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



[issue42603] Tkinter: pkg-config is not used to get location of tcl and tk headers/libraries

2020-12-08 Thread Manolis Stamatogiannakis


New submission from Manolis Stamatogiannakis :

This is indirectly related to 42541: If pkg-config settings are honoured, it is 
made easier to compile Python against a modern version of TCL/TK.

--
components: Tkinter
messages: 382756
nosy: m000
priority: normal
severity: normal
status: open
title: Tkinter: pkg-config is not used to get location of tcl and tk 
headers/libraries
type: compile error
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



[issue41910] Document that object.__eq__ implements `a is b`

2020-12-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset a3a4bf3b8dc79e4ec4f24f59bd1e9e2a75229112 by Terry Jan Reedy in 
branch '3.9':
[3.9] bpo-41910: move news entry (GH-23697)
https://github.com/python/cpython/commit/a3a4bf3b8dc79e4ec4f24f59bd1e9e2a75229112


--

___
Python tracker 

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



[issue41910] Document that object.__eq__ implements `a is b`

2020-12-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset b947b305a6833cc059214d5bdd2065edd65024c4 by Terry Jan Reedy in 
branch '3.8':
[3.8] bpo-41910: move news entry (GH-23698)
https://github.com/python/cpython/commit/b947b305a6833cc059214d5bdd2065edd65024c4


--

___
Python tracker 

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



[issue42602] seekable() returns True on pipe objects in Windows

2020-12-08 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Yes, despite that MSVCRT knows the type of the file descriptor because it calls 
GetFileType() on its creation, it doesn't check it in lseek() implementation 
and simply calls SetFilePointer(), which spuriously succeeds for pipes. MSDN 
says the following[1]:

Calling the SetFilePointer function with a handle to a non-seeking device such 
as a pipe or a communications device is not supported, even though the 
SetFilePointer function may not return an error. The behavior of the 
SetFilePointer function in this case is undefined.

[1] 
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfilepointer

--
components: +Windows
nosy: +eryksun, izbyshev, paul.moore, steve.dower, tim.golden, vstinner, 
zach.ware
versions: +Python 3.10, Python 3.8

___
Python tracker 

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



[issue41559] Add support for PEP 612 to typing.py

2020-12-08 Thread Ken Jin


Change by Ken Jin :


--
keywords: +patch
nosy: +kj
nosy_count: 1.0 -> 2.0
pull_requests: +22569
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23702

___
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

2020-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22568
pull_request: https://github.com/python/cpython/pull/23701

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Thanks for the fix and backports!

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

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22567
pull_request: https://github.com/python/cpython/pull/23700

___
Python tracker 

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



[issue40600] Add option to disallow > 1 instance of an extension module

2020-12-08 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +22566
pull_request: https://github.com/python/cpython/pull/23699

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

It's now fixed in 3.8, 3.9 and master branches.

Thanks for the bug report tianjg.

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

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b5cf308de8b19bf8f77053013f7e8a944159e1aa by Victor Stinner in 
branch '3.8':
bpo-32381: Fix PyRun_SimpleFileExFlags() encoding (GH-23642) (GH-23692) 
(GH-23696)
https://github.com/python/cpython/commit/b5cf308de8b19bf8f77053013f7e8a944159e1aa


--

___
Python tracker 

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



[issue42111] Make the xxlimited module an example of best extension module practices

2020-12-08 Thread miss-islington


miss-islington  added the comment:


New changeset c168b5078f88874b9acd993ac886f82269c780dd by Petr Viktorin in 
branch 'master':
bpo-42111: Make the xxlimited module an example of best extension module 
practices (GH-23226)
https://github.com/python/cpython/commit/c168b5078f88874b9acd993ac886f82269c780dd


--
nosy: +miss-islington

___
Python tracker 

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



[issue40600] Add option to disallow > 1 instance of an extension module

2020-12-08 Thread Dong-hee Na


Dong-hee Na  added the comment:

> another solution is to move the "module state" into the interpreter,

I am +1 on this solution if this module is a very special case.

--

___
Python tracker 

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



[issue40600] Add option to disallow > 1 instance of an extension module

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not 100% sure that preventing to create multiple module instances is 
needed. For the atexit module, another solution is to move the "module state" 
into the interpreter, as it has been done for other modules like _warnings.

--

___
Python tracker 

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



[issue42602] seekable() returns True on pipe objects in Windows

2020-12-08 Thread Myungbae Son


New submission from Myungbae Son :

>>> import os
>>> r, w = os.pipe()
>>> os.lseek(w, 10, 0)
10
>>> wf = open(w, 'w')
>>> wf.seekable()
True

This happens on Windows. Consequently seek() works for these objects but they 
seems to be no-op. This may confuse libraries that depend on seeking.

The named pipe objects (via CreateNamedPipe -> open_osfhandle -> open()) 
exhibit the same behavior.

--
components: IO
messages: 382746
nosy: nedsociety
priority: normal
severity: normal
status: open
title: seekable() returns True on pipe objects in Windows
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue41910] Document that object.__eq__ implements `a is b`

2020-12-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +22565
pull_request: https://github.com/python/cpython/pull/23698

___
Python tracker 

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



[issue40600] Add option to disallow > 1 instance of an extension module

2020-12-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

Are there any other examples?

In my view, atexit is very special, and very closely tied to interpreter. I 
don't think it's good to design general API for one module.

--

___
Python tracker 

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



[issue41910] Document that object.__eq__ implements `a is b`

2020-12-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +22564
pull_request: https://github.com/python/cpython/pull/23697

___
Python tracker 

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



[issue41910] Document that object.__eq__ implements `a is b`

2020-12-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 4aa67853cc7d6ed4f9ebb726ceaa2c89f9feabda by Terry Jan Reedy in 
branch 'master':
 bpo-41910: move news entry  (GH-23695)
https://github.com/python/cpython/commit/4aa67853cc7d6ed4f9ebb726ceaa2c89f9feabda


--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22563
pull_request: https://github.com/python/cpython/pull/23696

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f0e42ae03c41ec32fcb3064772f46ff7f2c5ff3b by Victor Stinner in 
branch '3.9':
bpo-32381: Fix PyRun_SimpleFileExFlags() encoding (GH-23642) (GH-23692)
https://github.com/python/cpython/commit/f0e42ae03c41ec32fcb3064772f46ff7f2c5ff3b


--

___
Python tracker 

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



[issue40600] Add option to disallow > 1 instance of an extension module

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

> static int loaded = 0;

I would like to limit an extension to once instance *per interpreter*.

See the atexit module for an example.

--

___
Python tracker 

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



[issue39825] EXT_SUFFIX inconsistent between sysconfig and distutils.sysconfig (Windows)

2020-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue41910] Document that object.__eq__ implements `a is b`

2020-12-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +22562
pull_request: https://github.com/python/cpython/pull/23695

___
Python tracker 

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



[issue42599] Remove PyModule_GetWarningsModule() in pylifecycle.c

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

> When was the visibility changed to hidden?

In Python 3.9:

commit 0b60f64e4343913b4931dc27379d9808e5b78fe1
Author: Vinay Sajip 
Date:   Tue Oct 15 08:26:12 2019 +0100

bpo-11410: Standardize and use symbol visibility attributes across POSIX 
and Windows. (GH-16347)


Symbols which are not declared with PyAPI_FUNC() are no longer exported when 
using GCC or clang (any compiler supporting -fvisibility=hidden).


PyModule_GetWarningsModule() was not documented nor exported.

I merged the PR. If it breaks too many packages, we can consider to revert the 
change. But I expect that there are zero project using it.

Note: PyModule_GetWarningsModule() was not part of PC/python3dll.c neither, 
hopefully ;-)

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



[issue42599] Remove PyModule_GetWarningsModule() in pylifecycle.c

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0f91f586ae9b76c3bb44559bd8cd473b1b8de5ff by Hai Shi in branch 
'master':
bpo-42599: Remove useless PyModule_GetWarningsModule() (GH-23691)
https://github.com/python/cpython/commit/0f91f586ae9b76c3bb44559bd8cd473b1b8de5ff


--

___
Python tracker 

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



[issue37945] test_locale.TestMiscellaneous.test_getsetlocale_issue1813() fails

2020-12-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This seemingly useless test is the only test failure for me with installed 
3.9.1.  Why keep it, at least on Windows.

The failure with "locale.Error: unsupported locale setting" is not limited to 
Windows.  #25191 and duplicate #31636 report the same error on user machines 
(non-buildbot, as here). #25191proposes the following patch to skip this 
failure.

-locale.setlocale(locale.LC_CTYPE, loc)
-self.assertEqual(loc, locale.getlocale(locale.LC_CTYPE))
+try:
+locale.setlocale(locale.LC_CTYPE, loc)
+self.assertEqual(loc, locale.getlocale(locale.LC_CTYPE))
+except locale.Error:
+# Unsupported locale setting
+self.skipTest('unsupported locale setting')

I believe that this is effectively the same as deleting the test.  But if we 
believe it is being skipped on at least Windows buildbots, then we should do 
the same at least on user Windows machines.  Or, if we could detect user 
manchines, skip on them.

--
nosy: +serhiy.storchaka
title: [Windows] locale.getdefaultlocale() issues on Windows: 
test_locale.test_getsetlocale_issue1813() -> 
test_locale.TestMiscellaneous.test_getsetlocale_issue1813() fails

___
Python tracker 

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



[issue25191] test_getsetlocale_issue1813 failed on OpenBSD

2020-12-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The problem with this patch is that the second assert is the point of the test. 
 Do get/set_locale work in the TR locale?

Although this issue came first, I am closing it as a duplicate of #37945 as the 
latter has extensive, but to date inconclusive, analysis and discussion.

--
nosy: +terry.reedy
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> [Windows] locale.getdefaultlocale() issues on Windows: 
test_locale.test_getsetlocale_issue1813()

___
Python tracker 

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



[issue40600] Add option to disallow > 1 instance of an extension module

2020-12-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

Is it really necessary to add a slot/flag for this?
It can be done in about 10 lines as below, without complications like a global 
(or per-interpreter) registry of singleton modules.
Are there many modules that need to be per-interpreter singletons, but may be 
loaded in multiple interpreters? In my experience, it is really hard to ensure 
modules behave that way; if (if!) we need to add a dedicated API for this, I'd 
go for once-per-process.


static int loaded = 0;

static int
exec_module(PyObject* module)
{
if (loaded) {
PyErr_SetString(PyExc_ImportError,
"cannot load module more than once per process");
return -1;
}
loaded = 1;
// ... rest of initialization
}

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue42601] [doc] add more examples and additional explanation to re.sub

2020-12-08 Thread Harvastum


New submission from Harvastum :

This entire page:
https://docs.python.org/3.10/library/re.html
does not have a single occurrence of the word "lambda".
In my humble opinion it's a pretty important trick to utilize capture groups in 
lambdas to e.g. use them to access value in a dictionary.
Examples are available here: https://stackoverflow.com/a/18737927/6380791
and here:
https://www.oreilly.com/library/view/python-cookbook/0596001673/ch03s15.html
but somehow not in the documentation.
There is a mention about referencing groups from different contexts, but the 
lambda is quite unique and although I think it does fall under "when processing 
match object m", I think it still is worth its own entry.

Btw. it's my first contribution here, sorry for any faux pas I may have 
commited, please point it out if I did!

--
assignee: docs@python
components: Documentation
messages: 382736
nosy: docs@python, harvastum
priority: normal
severity: normal
status: open
title: [doc] add more examples and additional explanation to re.sub
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22561
pull_request: https://github.com/python/cpython/pull/23692

___
Python tracker 

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



[issue31636] test_locale failure on OpenBSD

2020-12-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

PR-9178 was for #31608.  I corrected the PR and unlinked it from here.

This is a duplicate of #25191, with proposed patch.  #37945 is the same issue 
for Windows, with extensive discussion.

--
nosy: +terry.reedy
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> test_getsetlocale_issue1813 failed on OpenBSD

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b6d98c10fff6f320f8fdf595c3f9a05d8be4e31d by Victor Stinner in 
branch 'master':
bpo-32381: Fix PyRun_SimpleFileExFlags() encoding (GH-23642)
https://github.com/python/cpython/commit/b6d98c10fff6f320f8fdf595c3f9a05d8be4e31d


--

___
Python tracker 

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



[issue31636] test_locale failure on OpenBSD

2020-12-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -8617

___
Python tracker 

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



[issue40652] Test test_locale failed when running cpython test on Windows 10 x64 for version 3.9.0a6+

2020-12-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> [Windows] locale.getdefaultlocale() issues on Windows: 
test_locale.test_getsetlocale_issue1813()

___
Python tracker 

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



[issue41617] __builtin_bswap16 is used without checking it is supported

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

> Confirmed fixed in 3.9.1 and 3.10.0a3. Thanks Victor!

Wt!

--

___
Python tracker 

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



[issue31608] crash in methods of a subclass of _collections.deque with a bad __new__()

2020-12-08 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +22560
pull_request: https://github.com/python/cpython/pull/9178

___
Python tracker 

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



[issue42600] Cancelling tasks waiting for asyncio.Conditions crashes w/ RuntimeError: Lock is not acquired.

2020-12-08 Thread Hynek Schlawack


New submission from Hynek Schlawack :

This is something I've been procrastinating on for almost a year and working 
around it using my own version of asyncio.Condition because I wasn't sure how 
to describe it. So here's my best take:

Consider the following code:

```
import asyncio


async def tf(con):
async with con:
await asyncio.wait_for(con.wait(), 60)


async def f(loop):
con = asyncio.Condition()

t = loop.create_task(tf(con))

await asyncio.sleep(1)
t.cancel()

async with con:
con.notify_all()

await t


loop = asyncio.get_event_loop()
loop.run_until_complete(f(loop))
```

(I'm using old-school APIs because I wanted to verify whether it was a 
regression. I ran into the bug with new-style APIs: 
https://gist.github.com/hynek/387f44672722171c901b8422320e8f9b)

`await t` will crash with:


```
Traceback (most recent call last):
  File "/Users/hynek/t.py", line 6, in tf
await asyncio.wait_for(con.wait(), 60)
  File 
"/Users/hynek/.asdf/installs/python/3.9.0/lib/python3.9/asyncio/tasks.py", line 
466, in wait_for
await waiter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/hynek/t.py", line 24, in 
loop.run_until_complete(f(loop))
  File 
"/Users/hynek/.asdf/installs/python/3.9.0/lib/python3.9/asyncio/base_events.py",
 line 642, in run_until_complete
return future.result()
  File "/Users/hynek/t.py", line 20, in f
await t
  File "/Users/hynek/t.py", line 6, in tf
await asyncio.wait_for(con.wait(), 60)
  File 
"/Users/hynek/.asdf/installs/python/3.9.0/lib/python3.9/asyncio/locks.py", line 
20, in __aexit__
self.release()
  File 
"/Users/hynek/.asdf/installs/python/3.9.0/lib/python3.9/asyncio/locks.py", line 
146, in release
raise RuntimeError('Lock is not acquired.')
RuntimeError: Lock is not acquired.

```

If you replace wait_for with a simple await, it works and raises an 
asyncio.exceptions.CancelledError:

```
Traceback (most recent call last):
  File "/Users/hynek/t.py", line 6, in tf
await con.wait()
  File 
"/Users/hynek/.asdf/installs/python/3.9.0/lib/python3.9/asyncio/locks.py", line 
290, in wait
await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/hynek/t.py", line 20, in f
await t
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/hynek/t.py", line 24, in 
loop.run_until_complete(f(loop))
  File 
"/Users/hynek/.asdf/installs/python/3.9.0/lib/python3.9/asyncio/base_events.py",
 line 642, in run_until_complete
return future.result()
asyncio.exceptions.CancelledError
```

I have verified, that this has been broken at least since 3.5.10. The current 
3.10.0a3 is affected too.

--
components: asyncio
messages: 382732
nosy: asvetlov, hynek, lukasz.langa, yselivanov
priority: normal
severity: normal
status: open
title: Cancelling tasks waiting for asyncio.Conditions crashes w/ RuntimeError: 
Lock is not acquired.
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



[issue41617] __builtin_bswap16 is used without checking it is supported

2020-12-08 Thread Joshua Root


Joshua Root  added the comment:

Confirmed fixed in 3.9.1 and 3.10.0a3. Thanks Victor!

--

___
Python tracker 

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



[issue42599] Remove PyModule_GetWarningsModule() in pylifecycle.c

2020-12-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

When was the visibility changed to hidden?

--

___
Python tracker 

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



[issue42599] Remove PyModule_GetWarningsModule() in pylifecycle.c

2020-12-08 Thread hai shi


hai shi  added the comment:

> But it would not harm to document the removal in 
> https://docs.python.org/dev/whatsnew/3.10.html#id4 section.

Copy that. I will update it soon.

--

___
Python tracker 

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



[issue42599] Remove PyModule_GetWarningsModule() in pylifecycle.c

2020-12-08 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue42599] Remove PyModule_GetWarningsModule() in pylifecycle.c

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

It's not part of the C API and it's no longer exported in libpython since we 
(the default visibility was changed to "hidden"). IMHO it's safe to remove the 
function. But it would not harm to document the removal in 
https://docs.python.org/dev/whatsnew/3.10.html#id4 section.

--

___
Python tracker 

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



[issue42599] Remove PyModule_GetWarningsModule() in pylifecycle.c

2020-12-08 Thread hai shi


New submission from hai shi :

PyModule_GetWarningsModule() of pylifecycle.c is useless when _warning module 
was converted to a builtin module in 2.6. So move it directly now is OK.

--
components: Interpreter Core
messages: 382727
nosy: petr.viktorin, shihai1991, vstinner
priority: normal
severity: normal
status: open
title: Remove PyModule_GetWarningsModule() in pylifecycle.c
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



[issue42598] Some configure checks rely on implicit function declaration

2020-12-08 Thread Joshua Root


Change by Joshua Root :


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

___
Python tracker 

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



[issue42598] Some configure checks rely on implicit function declaration

2020-12-08 Thread Joshua Root


New submission from Joshua Root :

There are several cases in the configure script of exit being used without 
including stdlib.h, and one case of close being used without including 
unistd.h. A compiler that does not allow implicit function declaration, such as 
clang in Xcode 12, will error out due to this, which may cause the affected 
checks to give incorrect results.

--
components: Build
messages: 382726
nosy: jmr
priority: normal
severity: normal
status: open
title: Some configure checks rely on implicit function declaration
type: compile error
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



[issue42560] Improve Tkinter Documentation

2020-12-08 Thread E. Paine


E. Paine  added the comment:

See issue34154. I'm personally against such changes because we don't know what 
Tk version to write them for. Our documentation could be both outdated and too 
recent, including kwargs not available to some people (because they are running 
an older version).

The documentation available on third-party websites is pretty good and the 
official docs link to those. It is a shame Effbot is currently down, but the 
content is still available on 
https://web.archive.org/web/2020145627/http://effbot.org/

--
nosy: +epaine, serhiy.storchaka

___
Python tracker 

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



[issue21627] Concurrently closing files and iterating over the open files directory is not well specified

2020-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

Linux 5.9 added close_range() syscall that we can use.

Linux 5.10 may get a new CLOSE_RANGE_CLOEXEC flag for close_range().
https://lwn.net/Articles/837816/

We may use close_range() rather than iterating on /proc/self/fd/ in user space. 
It may be faster and safer.

--

___
Python tracker 

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



[issue39825] EXT_SUFFIX inconsistent between sysconfig and distutils.sysconfig (Windows)

2020-12-08 Thread Michael Felt


Michael Felt  added the comment:

Looking at https://github.com/python/cpython/pull/22088/files

imho: the patch forced Windows behavior ("""Initialize the module as 
appropriate for NT""") to be equivalent to vars['SO'] - which is what the test 
used to compare.

So, likely the change to the tests would be to have one for NT (per the comment 
in Lib/sysconfig.py) and the prior test set to be skipped if the platform is 
`NT` aka non_posix.

--

___
Python tracker 

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



[issue31601] Availability of utimensat, futimens not checked correctly on macOS

2020-12-08 Thread Joshua Root


Joshua Root  added the comment:

Looks like this is fixed as of 3.9.1.

--
resolution:  -> fixed
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



[issue42597] Improve documentation of locals() w.r.t. "free variables" vs. global variables

2020-12-08 Thread Dominik V.


New submission from Dominik V. :

The documentation of locals() mentions that:

> Free variables are returned by locals() when it is called in function blocks 
> [...]

The term "free variable" is defined in the documentation about the execution 
model 
(https://docs.python.org/3/reference/executionmodel.html#binding-of-names):

> If a variable is used in a code block but not defined there, it is a free 
> variable.

That definition includes global variables (and builtin ones), but these are not 
returned by locals(). For example compare the following:

```
x = 1
def foo():
# global x
x = 1
def bar():
print(locals())
y = x
bar()
foo()
```

If the `global x` is commented then it prints {'x': 1}, and if it is 
uncommented it prints {}. The same holds for names of builtins.

So the documentation of locals() could mention this in the following way 
(emphasis added):

> Free variables *of enclosing functions* are returned by locals() when it is 
> called in function blocks [...]

-

There is also a StackOverflow question, that describes this confusion: 
https://stackoverflow.com/questions/12919278/how-to-define-free-variable-in-python

By the way, would it be helpful to add the term "free variable" to the glossary 
(https://docs.python.org/3/glossary.html)?

--
assignee: docs@python
components: Documentation
messages: 382721
nosy: Dominik V., docs@python
priority: normal
severity: normal
status: open
title: Improve documentation of locals() w.r.t. "free variables" vs. global 
variables
type: enhancement
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



[issue39825] EXT_SUFFIX inconsistent between sysconfig and distutils.sysconfig (Windows)

2020-12-08 Thread Michael Felt


Michael Felt  added the comment:

On Windows - in distutils (?) did they perhaps make a change only for windows, 
for whatever reason.

I don't have a python3.7 pr a 3.8 handy atm.

Not sure what 'distutils' pip updates either - but with py36 and pip 20.2.4 and 
setuptools 40.6.2 I get:

Python 3.6.12 (default, Sep 23 2020, 08:27:01) [C] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig.get_config_var('EXT_SUFFIX')
'.so'
>>> from distutils import sysconfig
>>> sysconfig.get_config_var('EXT_SUFFIX')
'.so'

I am guessing that distutils has not updated - whatever - for AIX, FreeBSD, and 
perhaps others.

@mattip: is the problem perhaps with distutils rather than a particular 
platform. I also admit, I do not know what 'EXT_SUFFIX' is suppossed to return. 
From past behavior I took it to mean a file 'tag' for files that are accessed 
using dlopen().

Is it - perhaps - that different platforms have different needs or abilities - 
and the error is not the platform - but the adequacy of tests to differentiate 
platform behavior. I am guessing now - but maybe that is why distutils has not 
changed AIX and FreeBSD and maybe more.

--
nosy: +Michael.Felt

___
Python tracker 

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



  1   2   >