[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



numpy/python (image) problem

2020-12-08 Thread Paulo da Silva
Hi!

I am looking at some code, that I found somewhere in the internet, to
compute DCT for each 8x8 block in an gray (2D) image (512x512).

This is the code:

def dct2(a):
return
scipy.fft.dct(scipy.fft.dct(a,axis=0,norm='ortho'),axis=1,norm='ortho')

imsize=im.shape
dct=np.zeros(imsize)

# Do 8x8 DCT on image (in-place)
for i in r_[:imsize[0]:8]: # Seems the same as "for i in
np.arange(0,imsize[0],8)"!
for j in r_[:imsize[1]:8]:
dct[i:(i+8),j:(j+8)]=dct2(im[i:(i+8),j:(j+8)])

I tried to do the same thing with:

imsize=im.shape
im8=im.reshape(imsize[0]*imsize[1]//8//8,8,8)
dct_test=np.asarray([dct2(im8x) for im8x in im8])
dct_test=dct_test.reshape(imsize)

so that dct_test should be equal to (previous) dct.
But they are completely different.

What am I doing wrong?

Thanks a lot.
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



PyCA cryptography 3.3 released

2020-12-08 Thread Paul Kehrer
PyCA cryptography 3.3 has been released to PyPI. cryptography includes both
high level recipes and low level interfaces to common cryptographic
algorithms such as symmetric ciphers, asymmetric algorithms, message
digests, X509, key derivation functions, and much more. We support Python
2.7, Python 3.6+, and PyPy.

Please note that this is the final version that will support Python 2.7!

Changelog (https://cryptography.io/en/latest/changelog/):
* BACKWARDS INCOMPATIBLE: Support for Python 3.5 has been removed due to
low usage and maintenance burden.
* BACKWARDS INCOMPATIBLE: The GCM and AESGCM now require 64-bit to 1024-bit
(8 byte to 128 byte) initialization vectors. This change is to conform with
an upcoming OpenSSL release that will no longer support sizes outside this
window.
* BACKWARDS INCOMPATIBLE: When deserializing asymmetric keys we now raise
ValueError rather than UnsupportedAlgorithm when an unsupported cipher is
used. This change is to conform with an upcoming OpenSSL release that will
no longer distinguish between error types.
* BACKWARDS INCOMPATIBLE: We no longer allow loading of finite field
Diffie-Hellman parameters of less than 512 bits in length. This change is
to conform with an upcoming OpenSSL release that no longer supports smaller
sizes. These keys were already wildly insecure and should not have been
used in any application outside of testing.
* Updated Windows, macOS, and manylinux wheels to be compiled with OpenSSL
1.1.1i.
* Python 2 support is deprecated in cryptography. This is the last release
that will support Python 2.
* Added the recover_data_from_signature() function to RSAPublicKey for
recovering the signed data from an RSA signature.

-Paul Kehrer (reaperhulk)
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-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



Property type hints?

2020-12-08 Thread Paul Bryan
Would this be a reasonably correct way to annotate a property with a
type hint?

>>> class Foo:
... bar: int
... @property
... def bar(self):
... return 1
... 
>>> foo = Foo()
>>> import typing
>>> typing.get_type_hints(foo)
{'bar': }

I could also decorate the property method return value:
... def bar(self) -> int:

I don't see the point though, because you can't access it with get_type_hints.
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



cx_Oracle 8.1

2020-12-08 Thread Anthony Tuininga
What is cx_Oracle?

cx_Oracle is a Python extension module that enables access to Oracle
Database for Python and conforms to the Python database API 2.0
specifications with a number of enhancements.


Where do I get it?
https://oracle.github.io/python-cx_Oracle

The easiest method to install/upgrade cx_Oracle is via pip as in

python -m pip install cx_Oracle --upgrade


What's new?

See the full release notes for all of the details:
https://cx-oracle.readthedocs.io/en/latest/release_notes.html#version-8-1-december-2020

Please provide any feedback via GitHub issues (
https://github.com/oracle/python-cx_Oracle/issues).
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-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



Re: linear algebric equations

2020-12-08 Thread Christian Gollwitzer

Am 07.12.20 um 17:59 schrieb Tito Sanò:

Regarding the solution of linear algebraic equations I noticed a big
difference in the computation

time in Python compared to the old fortran language.

I have compared both the linelg and lapack.dgesv-lapack.zgesv modules with
the fortan: dgelg and f04adf.

The difference in computation time is enormous:

for example for 430 degrees of freedom it is about 24 min in Python versus
about 1 sec in fortran.


There must be something seriously wrong. If I understand correctly, you 
want to solve an 430x430 matrix with LU decompositino (that is what 
dgesv from LAPACK does). The following code takes less than a second on 
my machine:


==430.py==
import numpy as np

# create a 430x430 random matrix
A = np.random.randn(430,430)

# right hand side
b = np.ones(430)

# solve it

x = np.linalg.solve(A, b)

print(x)



time python3 430.py
real0m0.318s
user0m0.292s
sys 0m0.046s

If it takes longer than 1s, there is something wrong with your system.

Christian
--
https://mail.python.org/mailman/listinfo/python-list


[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



Re: linear algebric equations

2020-12-08 Thread Marco Sulla
On Mon, 7 Dec 2020 at 20:38, Tito Sanò  wrote:
> Is it possible to get better performance in Python?

Have you installed BLAS for Scipy? What OS do you have?
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



RE: linear algebric equations

2020-12-08 Thread Schachner, Joseph
Yes.  Import os, and use  os.system( ) to call your Fortran (or C) executable.  
If the executable saves results in a file or files, Python can read them in an 
format a nice overall report.  In html or xml, if you like.

Using Python as glue,  the execution time will be exactly what it was for your 
executable, because Python will call it; and in a second of so after it 
finishes Python can read in results and format whatever report you like.

--- Joseph S.

-Original Message-
From: Tito Sanò  
Sent: Monday, December 7, 2020 11:59 AM
To: python-list@python.org
Subject: linear algebric equations

Regarding the solution of linear algebraic equations I noticed a big difference 
in the computation

time in Python compared to the old fortran language.

I have compared both the linelg and lapack.dgesv-lapack.zgesv modules with the 
fortan: dgelg and f04adf. 

The difference in computation time is enormous:

for example for 430 degrees of freedom it is about 24 min in Python versus 
about 1 sec in fortran.

Is it possible to get better performance in Python?

Thanks in advance  

Tito Sano' 

Roma Italy

Cell: 339 6903895

 


-- 
https://mail.python.org/mailman/listinfo/python-list


PyDev 8.1.0 Released

2020-12-08 Thread Fabio Zadrozny
 PyDev 8.1.0 Release Highlights

   -

   *Interactive Console*
   - The selection for which console to open may be saved. (*#PyDev-1112*)
  - When the *current editor* option is selected, the related
  interpreter is no longer asked. (*#PyDev-1112*)
   -

   *Debugger* (updated to pydevd 2.2.0)
   - Better support for Python flags when auto-attaching to subprocesses.
  - Fixes to path translation (when debugging in a different machine).
  - Catch warnings related to *imp* import from *pkg_resources*.
  - No longer crashing when running with *Pyjion* (patch by Anthony
  Shaw).
   -

   *Others*
   - Code analysis now supports *from __future__ import anotations*. (
  *#PyDev-1040*)
  - AST pretty-printing supports printing slices. (*#PyDev-1106*)
  - Code-completion with auto imports for the builtin module is no
  longer shown. (*#PyDev-1117*)
  - MyPy messages from a different file are no longer shown in the
  current editor. (*#PyDev-1114*)

About PyDev

PyDev is an open-source Python IDE on top of Eclipse for Python, Jython and
IronPython development, now also available for Python on Visual Studio Code.

It comes with goodies such as code completion, syntax highlighting, syntax
analysis, code analysis, refactor, debug, interactive console, etc.

It is also available as a standalone through LiClipse with goodies such as
multiple cursors, theming and support for many other languages, such as
Django Templates, Jinja2, Html, JavaScript, etc.

Links:

PyDev: http://pydev.org
PyDev Blog: http://pydev.blogspot.com
PyDev on VSCode: http://pydev.org/vscode
LiClipse: http://www.liclipse.com
PyVmMonitor - Python Profiler: http://www.pyvmmonitor.com/

Cheers,

Fabio Zadrozny
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


PyDev 8.1.0 Released

2020-12-08 Thread Fabio Zadrozny
 PyDev 8.1.0 Release Highlights

   -

   *Interactive Console*
   - The selection for which console to open may be saved. (*#PyDev-1112*)
  - When the *current editor* option is selected, the related
  interpreter is no longer asked. (*#PyDev-1112*)
   -

   *Debugger* (updated to pydevd 2.2.0)
   - Better support for Python flags when auto-attaching to subprocesses.
  - Fixes to path translation (when debugging in a different machine).
  - Catch warnings related to *imp* import from *pkg_resources*.
  - No longer crashing when running with *Pyjion* (patch by Anthony
  Shaw).
   -

   *Others*
   - Code analysis now supports *from __future__ import anotations*. (
  *#PyDev-1040*)
  - AST pretty-printing supports printing slices. (*#PyDev-1106*)
  - Code-completion with auto imports for the builtin module is no
  longer shown. (*#PyDev-1117*)
  - MyPy messages from a different file are no longer shown in the
  current editor. (*#PyDev-1114*)

About PyDev

PyDev is an open-source Python IDE on top of Eclipse for Python, Jython and
IronPython development, now also available for Python on Visual Studio Code.

It comes with goodies such as code completion, syntax highlighting, syntax
analysis, code analysis, refactor, debug, interactive console, etc.

It is also available as a standalone through LiClipse with goodies such as
multiple cursors, theming and support for many other languages, such as
Django Templates, Jinja2, Html, JavaScript, etc.

Links:

PyDev: http://pydev.org
PyDev Blog: http://pydev.blogspot.com
PyDev on VSCode: http://pydev.org/vscode
LiClipse: http://www.liclipse.com
PyVmMonitor - Python Profiler: http://www.pyvmmonitor.com/

Cheers,

Fabio Zadrozny
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



Re: [RELEASE] Python 3.9.1 is now available, together with 3.10.0a3 and 3.8.7rc1

2020-12-08 Thread Terry Reedy

On 12/7/2020 8:33 PM, Pablo Galindo Salgado wrote:

It's starting to get very cold (at least on the Northern hemisphere) so we
have been carefully packaging a total of three new Python releases to keep
you warm these days!

Python 3.9.1 is the first maintenance release of Python 3.9, and also the
first version of Python to support macOS 11 Big Sur natively on Apple
Silicon. Go get it here:

https://www.python.org/downloads/release/python-391/


On my Windows 10 machine, only test_locale failed.
https://bugs.python.org/issue37945
has not come to a conclusion yet.


Maintenance releases for the 3.9 series will continue at regular bi-monthly
intervals, with **3.9.2** planned for Monday, 2021-02-08.

Python 3.10a3 is the third alpha release of Python 3.10. You can get it
here:

https://www.python.org/downloads/release/python-3100a3/


test_os test_pydoc test_webbrowser also fail for me


Python 3.10a3 is the release preview of the next maintenance release of


This should be 3.8.7rc1 ...


Python 3.8. You can get it here:

https://www.python.org/downloads/release/python-387rc1/


test_compileall also fails for me


Assuming no critical problems are found prior to **2020-12-21** , the
currently scheduled release date for **3.8.7** , no code changes are
planned between this release candidate and the final release. That being
said, please keep in mind that this is a pre-release of 3.8.7 and as such
its main purpose is testing

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


[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



Re: Letter replacer - suggestions?

2020-12-08 Thread Thomas Jollans

On 07/12/2020 16:48, Bischoop wrote:

I worked on my wee script that replaces a letters: https://bpa.st/OYBQ .
I would like to have some suggestions about the code from more
experienced programmers, the code does work and do its job but perhaps
could work in a better way.

Thanks



Sure!

First of all, the code could be simplified by using the replace() method 
of the str class 
(https://docs.python.org/3/library/stdtypes.html#str.replace).


Now a few comments on the code specifically:

    while True:

What is this for? It looks like all it does is cause the program to get 
caught in an infinite loop if there's an exception...


    for element in word_list:
    for x in change_this_list:

You can loop over strings as well - there's no need to convert them to 
lists.


    to = word_list.index(element)

There's a nice trick to get the index while looping: write

    for (idx, character) in enumerate(word):

then you don't have to use the index method. This also works if a 
character appears multiple times in the word, in which case I think your 
code will fail (but I haven't tried it)


(Obviously apply this to the other loop as well, mutadis mutandis, to 
get rid of both index() calls)


    word_list[to] = replace_with_list[replace]

Okay, this is something you can't do with a str because they're 
immutable. Generally I'd avoid modifying the thing you're looping over; 
it works in this case when you're replacing elements of a list, but it 
probably won't do what you want if you're deleting or adding items.


I'd put

new_word_list = []

somewhere at the top, and build it up element by element with 
new_word_list.append(). But what you're doing is fine too as long as you 
keep in mind that changing the thing you're looping over can be 
dangerous in other cases.



Hope this helps


Thomas


--
https://mail.python.org/mailman/listinfo/python-list


[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



  1   2   >