[issue42559] random.getrandbits: Should it be explicit that it returns unsigned/non-negative integer?

2020-12-07 Thread Paul Sokolovsky


Paul Sokolovsky  added the comment:

Raymond Hettinger: Thanks for acking it would be a useful change!

ZackerySpytz: Thanks for making a patch!

--

___
Python tracker 

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



[issue41889] enum: Mixin and int base class regression in 3.8.6

2020-12-07 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset c266736ec1f9ebef38b134ceb4832df015711b38 by Ethan Furman in 
branch 'master':
bpo-41889: [Enum] fix multiple-inheritance regression (GH-22487)
https://github.com/python/cpython/commit/c266736ec1f9ebef38b134ceb4832df015711b38


--

___
Python tracker 

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



[issue41889] enum: Mixin and int base class regression in 3.8.6

2020-12-07 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +22538
pull_request: https://github.com/python/cpython/pull/23672

___
Python tracker 

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



[issue41889] enum: Mixin and int base class regression in 3.8.6

2020-12-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22539
pull_request: https://github.com/python/cpython/pull/23673

___
Python tracker 

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



[issue42578] Add tip when encountering UnicodeDecode/EncodeError in open()

2020-12-07 Thread Inada Naoki


Inada Naoki  added the comment:

How do you think about PEP-597?
https://www.python.org/dev/peps/pep-0597/

--
nosy: +methane

___
Python tracker 

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



[issue42583] JSON.dumps() creates invalid JSON with single quotes

2020-12-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue38660] Checking if two regexes are equal should test if they are functionally equivalent

2020-12-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue42584] Upgrade macOS and Windows installers to use SQLite 3.34.0

2020-12-07 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

SQLite 3.34.0 was released 2020-12-01: 
https://www.sqlite.org/releaselog/3_34_0.html

Compiles fine on master, and tests are completing without error.

--
components: Library (Lib)
messages: 382625
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: Upgrade macOS and Windows installers to use SQLite 3.34.0
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



[issue42584] Upgrade macOS and Windows installers to use SQLite 3.34.0

2020-12-07 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue42584] Upgrade macOS and Windows installers to use SQLite 3.34.0

2020-12-07 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +22541
pull_request: https://github.com/python/cpython/pull/23675

___
Python tracker 

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



[issue42584] Upgrade macOS and Windows installers to use SQLite 3.34.0

2020-12-07 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +ned.deily, steve.dower

___
Python tracker 

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



[issue30459] PyList_SET_ITEM could be safer

2020-12-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0ef96c2b2a291c9d2d9c0ba42bbc1900a21e65f3 by Victor Stinner in 
branch 'master':
bpo-30459: Cast the result of PyCell_SET to void (GH-23654)
https://github.com/python/cpython/commit/0ef96c2b2a291c9d2d9c0ba42bbc1900a21e65f3


--

___
Python tracker 

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



[issue30459] PyList_SET_ITEM could be safer

2020-12-07 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Espie Marc for the bug report, it's now fixed in the master branch. IMO 
not only clang users will benefit of a better defined API. For example, it 
should help other Python implementation to implement such API, without the 
weird side effects of a macro.

--

___
Python tracker 

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



[issue30459] PyList_SET_ITEM could be safer

2020-12-07 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue42584] Upgrade macOS and Windows installers to use SQLite 3.34.0

2020-12-07 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Steve Dower: It should be fairly easy to add a CI check that validates the 
source checksums, so you don't need to do it manually every time. I can throw 
up a simple GH workflow for the sqlite branch if you want.

--

___
Python tracker 

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



[issue42585] Segmentation fault on Linux with multiprocess queue

2020-12-07 Thread Stegle, Julien


New submission from Stegle, Julien :

Hi,

I'm experiencing segmentation fault issues when running inside a Docker 
container (tested with python:3.8.6, python:3.8.6-slim, python:3.6.8 & 
python:3.6.8-slim).

On windows everything works fine, but when running on Docker when I try to put 
a string into my queue I'm experiencing the following error:

GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...(no debugging symbols found)...done.
Starting program: /usr/local/bin/python -m ge.xxx.core.runners.exec basic 
reader /home/executor/xxx/exemple1.ini
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 12]
[New Thread 0x7f11f66c7700 (LWP 13)]
[New Thread 0x7f11f3ec6700 (LWP 14)]
[New Thread 0x7f11f16c5700 (LWP 15)]
[New Thread 0x7f11eeec4700 (LWP 16)]
[New Thread 0x7f11ec6c3700 (LWP 17)]
[New Thread 0x7f11e9ec2700 (LWP 18)]
[New Thread 0x7f11e76c1700 (LWP 19)]
[New Thread 0x7f11e4ec0700 (LWP 20)]
[New Thread 0x7f11e26bf700 (LWP 21)]
[New Thread 0x7f11dfebe700 (LWP 22)]
[New Thread 0x7f11df6bd700 (LWP 23)]
[Thread 0x7f11e9ec2700 (LWP 18) exited]
[Thread 0x7f11e76c1700 (LWP 19) exited]
[Thread 0x7f11ec6c3700 (LWP 17) exited]
[Thread 0x7f11eeec4700 (LWP 16) exited]
[Thread 0x7f11f16c5700 (LWP 15) exited]
[Thread 0x7f11f3ec6700 (LWP 14) exited]
[Thread 0x7f11f66c7700 (LWP 13) exited]
[Thread 0x7f11e26bf700 (LWP 21) exited]
[Thread 0x7f11dfebe700 (LWP 22) exited]
[Thread 0x7f11e4ec0700 (LWP 20) exited]
[Thread 0x7f11df6bd700 (LWP 23) exited]
[Detaching after fork from child process 24]
[Detaching after fork from child process 25]
[New Thread 0x7f11df6bd700 (LWP 26)]
[New Thread 0x7f11dfebe700 (LWP 27)]
[New Thread 0x7f11e26bf700 (LWP 28)]
[New Thread 0x7f11e4ec0700 (LWP 29)]
[New Thread 0x7f11cc893700 (LWP 30)]
[New Thread 0x7f11ca092700 (LWP 31)]
[New Thread 0x7f11c7891700 (LWP 32)]
[New Thread 0x7f11c5090700 (LWP 33)]
[New Thread 0x7f11c488f700 (LWP 34)]
[New Thread 0x7f11c208e700 (LWP 35)]
[New Thread 0x7f11bd88d700 (LWP 36)]
[New Thread 0x7f11b5def700 (LWP 37)]
[Thread 0x7f11e4ec0700 (LWP 29) exited]
[Thread 0x7f11c7891700 (LWP 32) exited]
[Thread 0x7f11ca092700 (LWP 31) exited]
[Thread 0x7f11c488f700 (LWP 34) exited]
[Thread 0x7f11c5090700 (LWP 33) exited]
[Thread 0x7f11cc893700 (LWP 30) exited]
[Thread 0x7f11e26bf700 (LWP 28) exited]
[Thread 0x7f11dfebe700 (LWP 27) exited]
[Thread 0x7f11df6bd700 (LWP 26) exited]
[Thread 0x7f11bd88d700 (LWP 36) exited]
[Thread 0x7f11c208e700 (LWP 35) exited]
[Detaching after fork from child process 38]
[Thread 0x7f11b5def700 (LWP 37) exited]
2020-12-07T09:16:12.760+ - ge.xxx.inputs - INFO - Filesystem input 
"ge.xxx.core.inputs.reader.dicom" initialized, target: /data/dicoms
2020-12-07T09:16:12.780+ - ge.xxx.parsers - INFO - Dicom data parser 
initialized
2020-12-07T09:16:12.918+ - alembic.env - INFO - Migrating database 
engine_data
2020-12-07T09:16:12.927+ - alembic.env - INFO - Migrating database 
engine_application
2020-12-07T09:16:12.933+ - alembic.env - INFO - Migrating database 
engine_enhancement
2020-12-07T09:16:12.956+ - ge.xxx.core - INFO - Duct 'default' initialized
2020-12-07T09:16:12.957+ - ge.xxx.inputs - INFO - Start filesystem input 
thread "ge.xxx.core.inputs.reader.dicom"
[Detaching after fork from child process 39]
[Detaching after fork from child process 40]
2020-12-07T09:16:13.639+ - ge.xxx.inputs - DEBUG - Start reading file system
2020-12-07T09:16:13.666+ - ge.xxx.inputs - DEBUG - File 
/data/dicoms/1/XXX.dcm did not match filters
2020-12-07T09:16:15.881+ - ge.xxx.inputs - DEBUG - ADDING DICOMREADER W/ TO 
QUEUE 
Fatal Python error: Segmentation fault

Current thread 0x7f0cb732f740 (most recent call first):
  File "/usr/local/lib/python3.6/multiprocessing/queues.py", line 82 in put
  File 
"/home/executor/ge.xxx.extractor/ge/xxx/extractor/input/filesystem/reader.py", 
line 36 in feed
  File "/home/executor/ge.xxx.duct/ge/xxx/duct/input/filesystem/reader.py", 
line 58 in scan
  File "/usr/local/lib/python3.6/multiprocessing/process.py", line 93 in run
  File "/usr/local/lib/python3.6/multiprocessing/process.py", line 258 in 

[issue42532] spec_arg's __bool__ is called while initializing NonCallableMock

2020-12-07 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests: +22542
pull_request: https://github.com/python/cpython/pull/23676

___
Python tracker 

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



[issue28964] AST literal_eval exceptions provide no information about line number

2020-12-07 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +22543
pull_request: https://github.com/python/cpython/pull/23677

___
Python tracker 

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



[issue28964] AST literal_eval exceptions provide no information about line number

2020-12-07 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> Usually literal_eval() is used with short one-line input. For what large 
> documents do you use it?

I kind of agree with Serhiy on this, nearly every use case I've encountered was 
simple, single-line expression. Though, by seeing Irit's patch I think the 
implementation is reasonable enough to do.

--
nosy: +BTaskaya

___
Python tracker 

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



[issue28964] AST literal_eval exceptions provide no information about line number

2020-12-07 Thread Irit Katriel


Irit Katriel  added the comment:

This just came up again in issue42561 so I went ahead and created the PR.

--

___
Python tracker 

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



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2020-12-07 Thread Alex Writer


Alex Writer  added the comment:

Testing with a minimal tkinter app (see code below) gives similar behavior, so 
this appears to be an issue with tkinter https://goo.gl/2DqXGj and/or tcl/tk.


import tkinter
text = tkinter.Text()

--
nosy: +alexwriter2003

___
Python tracker 

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



[issue42585] Segmentation fault on Linux with multiprocess queue

2020-12-07 Thread Stegle, Julien


Stegle, Julien  added the comment:

By removing the use the of "spawn" context for multiprocessing everything works 
fine.
Does the "spawn" context have a different behavior on Linux ?

--

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi


New submission from Valeriu Predoi :

Hey guys, the new unittest.mock.Mock for Python 3.9 can not accept a spec arg 
if it is a numpy array, it'll accept all other types but not ndarray, have a 
look at this quick minimal code:

import numpy as np

from unittest import mock as mg

ob = mg.Mock(spec=[4, 4])
print("spec is list, mock is", ob)

ob = mg.Mock(spec=["4", "4"])
print("spec is list of str, mock is", ob)

ob = mg.Mock(spec=(4, 4))
print("spec is tuple, mock is", ob)

ob = mg.Mock(spec="cow")
print("spec is string, mock is", ob)

ob = mg.Mock(spec=22)
print("spec is int, mock is", ob)

ob = mg.Mock(spec=np.array([4, 4]))
print("spec is ndarray, mock is", ob)

versions:
python  3.9.0 h2a148a8_4_cpythonconda-forge
pytest-mock 3.3.1  pypi_0pypi

Is this intended or it's a buggy-bug?

Cheers muchly! V

--
components: Tests
messages: 382634
nosy: valeriupredoi
priority: normal
severity: normal
status: open
title: unittest.mock.Mock spec can't be array/ndarray in Python 3.9
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



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2020-12-07 Thread E. Paine


E. Paine  added the comment:

Removed Alex from nosy because the link was an advertisement for an essay 
writer.

--
nosy:  -alexwriter2003

___
Python tracker 

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



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2020-12-07 Thread Tal Einat


Change by Tal Einat :


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

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I don't have Python 3.9 with numpy to test this. Does this used to work with 
python 3.8? Does using numpy produce any error or traceback in 3.9?

--
nosy: +xtreak

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi


Valeriu Predoi  added the comment:

Hello mate, yes it used to work fine with Python 3.8, no issue with Python 3.9 
and numpy if you call mock as 

ob = mg.Mock(spec=np.array([4, 4]))

this results in a nice exception being raised:

Traceback (most recent call last):
  File "/home/valeriu/ESMValCore/tmock.py", line 20, in 
ob = mg.Mock(spec=np.array([4, 4]))
  File 
"/home/valeriu/miniconda3/envs/esmvalcore39/lib/python3.9/unittest/mock.py", 
line 409, in __new__
if spec_arg and _is_async_obj(spec_arg):
ValueError: The truth value of an array with more than one element is 
ambiguous. Use a.any() or a.all()

which is pretty normal since that func performs an existence check on an array 
- hope this helps! Cheers

--

___
Python tracker 

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



[issue28964] AST literal_eval exceptions provide no information about line number

2020-12-07 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue42583] JSON.dumps() creates invalid JSON with single quotes

2020-12-07 Thread Kjartan Hrafnkelsson


Change by Kjartan Hrafnkelsson :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks, this looks like a duplicate of https://bugs.python.org/issue42532

--

___
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-07 Thread mattip


mattip  added the comment:

the PR is awaiting approval/merge

--

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi


Valeriu Predoi  added the comment:

Indeed so! Sorry, I only glossed over that one before posting mine, now that I 
looked at it more carefully you are right, it does need a check on None and not 
calling the __bool__ member, which is affecting functionally passing an ndarray 
as spec - what should I do with my issue, close it? Cheers muchly!

--

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi


Valeriu Predoi  added the comment:

Note however, that the need I have for my type of functionality is fulfilled 
and all works fine for Python 3.7 and 3.8, I noticed the problem only for 3.9 - 
the OP in that issue says their versions affected include 3.8 (maybe it creeps 
up for 3.8.6 or larger, I tested with 3.8.5). Cheers!

--

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

It's a problem with 3.9 only as far as I know. The fix has been merged to 
master (3.10) and 3.9 . I will check with 3.8 but I don't think it will be a 
problem since 3.8 has a different code path. You can check the PR merged for 
more discussion.

--

___
Python tracker 

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



[issue42587] test_buffer fails on Python built with GCC 11

2020-12-07 Thread STINNER Victor


New submission from STINNER Victor :

PPC64LE Fedora Rawhide LTO 3.x:
https://buildbot.python.org/all/#/builders/448/builds/433

FAIL: test_memoryview_cast (test.test_buffer.TestBufferProtocol)
FAIL: test_memoryview_cast_1D_ND (test.test_buffer.TestBufferProtocol)
FAIL: test_memoryview_compare_random_formats 
(test.test_buffer.TestBufferProtocol)
FAIL: test_ndarray_format_shape (test.test_buffer.TestBufferProtocol)
FAIL: test_ndarray_format_strides (test.test_buffer.TestBufferProtocol)
FAIL: test_ndarray_getbuf (test.test_buffer.TestBufferProtocol)
FAIL: test_ndarray_index_getitem_single (test.test_buffer.TestBufferProtocol)
FAIL: test_ndarray_random (test.test_buffer.TestBufferProtocol)
FAIL: test_ndarray_slice_assign_single (test.test_buffer.TestBufferProtocol)

Example:

FAIL: test_ndarray_slice_assign_single (test.test_buffer.TestBufferProtocol)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-ppc64le.lto/build/Lib/test/test_buffer.py",
 line 1836, in test_ndarray_slice_assign_single
self.assertEqual(mv, nd)
AssertionError:  != 

--
components: Tests
messages: 382643
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_buffer fails on Python built with GCC 11
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



[issue42587] test_buffer fails on Python built with GCC 11

2020-12-07 Thread STINNER Victor


STINNER Victor  added the comment:

On Python 3.6/x86-64, Python does crash in libregrtest while loading test_code:

0:01:13 load avg: 2.23 [ 56/406] test_code

Fatal Python error: Segmentation fault
Current thread 0x7f5a6864d740 (most recent call first):
  File "/builddir/build/BUILD/Python-3.6.12/Lib/test/test_code.py", line 288 in 

  File "", line 219 in _call_with_frames_removed
  File "", line 678 in exec_module
  File "", line 665 in _load_unlocked
  File "", line 955 in _find_and_load_unlocked
  File "", line 971 in _find_and_load
  File "", line 994 in _gcd_import
  File "/builddir/build/BUILD/Python-3.6.12/Lib/importlib/__init__.py", line 
126 in import_module
  (...)

On Python 3.5/x86-64, test_ctypes.test_callbacks() crashs with a SIGSEGV:

test_callbacks (ctypes.test.test_as_parameter.AsParamPropertyWrapperTestCase) 
...

Fatal Python error: Segmentation fault
Current thread 0x7f5de8322740 (most recent call first):
  File 
"/builddir/build/BUILD/Python-3.5.10/Lib/ctypes/test/test_as_parameter.py", 
line 90 in test_callbacks

The strange part is that the test suite pass on some platforms depending on the 
Python version.

It might be a GCC 11 regression.

--

___
Python tracker 

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



[issue42587] test_buffer fails on Python built with GCC 11

2020-12-07 Thread STINNER Victor

STINNER Victor  added the comment:

Copy of Miro Hrončok's email to Fedora python-devel list:

https://lists.fedoraproject.org/archives/list/python-de...@lists.fedoraproject.org/thread/ADKCB6HXGZHJPYX5LSJ7422FITYSOAL3/


Hello.

I've been notified that many of the Python interpreters started to fail with 
new 
GNU Toolchain (gcc 11, glibc 2.33).

https://koschei.fedoraproject.org/package/pythonX.Y (replace X.Y with version)

Python 3.5
  - test_buffer fails on aarch64
  - test_buffer+test_dbm_gnu fails on ppc64le
  - %check segafults on x86_64

Python 3.6
  - %check segafults on x86_64
  - test_buffer fails on aarch64

Python 3.7
  - test_buffer fails on aarch64+ppc64le

Python 3.8
  - seems to build fine

Python 3.9
  - test_buffer fails on aarch64+ppc64le

Python 3.10
  - seems to build fine

PyPys have not yet been collected by Koschei, Python 2.7 seems fine.



Python is built with LTO+PGO on Fedora.

--

___
Python tracker 

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



[issue42587] test_buffer fails on Python built with GCC 11

2020-12-07 Thread STINNER Victor


STINNER Victor  added the comment:

test_buffer also fails with GCC 11 on Python 3.8 built without LTO nor PGO, 
just -Og (./configure --enable-pydebug).

PPC64LE Fedora Rawhide Refleaks 3.8:
https://buildbot.python.org/all/#/builders/398/builds/101

test.pythoninfo:

sysconfig[CFLAGS]: -Wno-unused-result -Wsign-compare -g -Og -Wall

sysconfig[PY_CFLAGS]: -Wno-unused-result -Wsign-compare -g -Og -Wall

sysconfig[PY_CFLAGS_NODIST]: -std=c99 -Wextra -Wno-unused-result 
-Wno-unused-parameter -Wno-missing-field-initializers 
-Werror=implicit-function-declaration -I./Include/internal

sysconfig[PY_STDMODULE_CFLAGS]: -Wno-unused-result -Wsign-compare -g -Og -Wall 
-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-I./Include/internal -I. -I./Include

Note: I'm not sure why test.pythoninfo didn't log LDFLAGS? It's supposed to log 
them.

--

___
Python tracker 

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



[issue42588] Improvements to graphlib.TopologicalSorter.static_order() documentation

2020-12-07 Thread Ran Benita


New submission from Ran Benita :

One issue and one suggestion.

Issue:

The documentation of prepare() says:

> If any cycle is detected, CycleError will be raised

which is what happens. The documentation of static_order() says that 
static_order() is equivalent to:

def static_order(self):
self.prepare()
while self.is_active():
node_group = self.get_ready()
yield from node_group
self.done(*node_group)

specifically it is said to call self.prepare(), and also says

> If any cycle is detected, CycleError will be raised.

But, this only happens when the result of static_order is *iterated*, not when 
it's called, unlike what is suggested by the code and the comment.

Ideally, I think the call should raise the CycleError already if possible; this 
way, only the call can be wrapped in a try/except instead of the entire 
iteration. But if not, it should be clarified in the documentation.


Suggestion:

The documentation of static_order() says

> Returns an iterable of nodes in a topological order. Using this method does 
> not require to call TopologicalSorter.prepare() or TopologicalSorter.done().

I think the wording "does not require" still implies that they *can* be called, 
but really they can't. If prepare() is called before static_order(), then when 
static_order() is iterated, "ValueError: cannot prepare() more than once" is 
raised.

I suggest this wording:

Returns an iterable of nodes in a topological order. When using this method, 
TopologicalSorter.prepare() and TopologicalSorter.done() should not be called.

--
assignee: docs@python
components: Documentation
messages: 382647
nosy: bluetech, docs@python
priority: normal
severity: normal
status: open
title: Improvements to graphlib.TopologicalSorter.static_order() documentation
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



[issue42588] Improvements to graphlib.TopologicalSorter.static_order() documentation

2020-12-07 Thread Ran Benita


Ran Benita  added the comment:

Hmm I realize after the fact that since the equivalent code snippet (which is 
actually the implementation) is a generator, then it is actually correct that 
prepare() isn't called until it is iterated. So the documentation for this is 
not incorrect.

Still, I think it would be better if the prepare() executes immediately rather 
than in the first iteration.

--

___
Python tracker 

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



[issue42589] doc: Wrong "from" keyword link in Exceptions doc

2020-12-07 Thread Irit Katriel


New submission from Irit Katriel :

In the Exceptions doc:
https://docs.python.org/3/library/exceptions.html#built-in-exceptions

In the sentence 
"The expression following from must be an exception or None."

"from" is a keyword which links to
https://docs.python.org/3/reference/simple_stmts.html#from

But that is related to the from in "from X import Y" rather than "raise X from 
Y".

--
assignee: docs@python
components: Documentation
messages: 382649
nosy: docs@python, iritkatriel
priority: normal
severity: normal
status: open
title: doc: Wrong "from" keyword link in Exceptions doc
type: behavior
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



[issue42590] Something like Rust's std::sync::Mutex – combining a mutex primitive and a piece of data it's protecting

2020-12-07 Thread Jakub Stasiak

New submission from Jakub Stasiak :

I've been wondering if it's worth it to have something like Rust's 
std::sync::Mutex[1] which is used like this:

let data = Mutex::new(0);
{
let mut unlocked = data.lock().unwrap();
*unlocked += 1;
}
// unlocked is no longer available here, we need to use data.lock() again


Our (Python) [R]Lock is typically used like this:

data_to_protect = whatever()
lock = Lock()

# ...
with lock:
data_to_protect.do_something()


The inconvenience of this is obvious to me and it's more error prone if one 
forgets the lock when accessing data_to_protect. I wrote a quick prototype to 
get something like Mutex in Python:

import threading
from contextlib import contextmanager
from typing import Any, cast, Dict, Generator, Generic, Optional, TypeVar

T = TypeVar('T')


class LockedData(Generic[T]):
def __init__(self, data: T, lock: Any = None) -> None:
self._data = data
if lock is None:
lock = threading.Lock()
self._lock = lock

@contextmanager
def unlocked(self, timeout: float = -1.0) -> Generator[T, None, None]:
acquired = None
unlocked = None
try:
acquired = self._lock.acquire(timeout=timeout)
if acquired is False:
raise LockTimeout()
unlocked = UnlockResult(self._data)
yield unlocked
finally:
if acquired is True:
if unlocked is not None:
unlocked._unlocked = False
self._data = unlocked._data
unlocked._data = None
self._lock.release()


class UnlockResult(Generic[T]):
_data: Optional[T]

def __init__(self, data: T) -> None:
self._data = data
self._unlocked = True

@property
def data(self) -> T:
assert self._unlocked
return cast(T, self._data)

@data.setter
def data(self, data: T) -> None:
assert self._unlocked
self._data = data


class LockTimeout(Exception):
pass


if __name__ == '__main__':
locked_dict: LockedData[Dict[str, bool]] = LockedData({})

# Mutating the dictionary
with locked_dict.unlocked() as result:
result.data['hello'] = True

with locked_dict.unlocked() as result:
print(result.data)

# Replacing the dictionary
with locked_dict.unlocked() as result:
result.data = {'a': True, 'b': False}

with locked_dict.unlocked() as result:
print(result.data)

# Trying to access data after context closes
print(result._data)
print(result.data)

Now this is obviously quite far from what Rust offers, as there's nothing to 
prevent a person from doing something like this:

with locked_dict.unlocked() as result:
data = result.data

print('Oh no, look: %r' % (data,))

but it seems to me it's still an improvement.


[1] https://doc.rust-lang.org/std/sync/struct.Mutex.html

--
components: Library (Lib)
messages: 382650
nosy: benjamin.peterson, jstasiak, pitrou, vstinner
priority: normal
severity: normal
status: open
title: Something like Rust's std::sync::Mutex – combining a mutex primitive and 
a piece of data it's protecting
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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2020-12-07 Thread Christian Bachmaier


New submission from Christian Bachmaier :

In Python 3.9.0 and 3.9.1rc1 (Packages from Ubuntu Devel Branch or Fedora) the 
Method
int Py_FrozenMain(int, char**)
is missing in libpython3.9.so

Thus, when trying the provided freeze example via
freeze.py hello.py & make
one gets the linker error
/usr/bin/ld: frozen.o: in function `main': frozen/frozen.c:681: undefined 
reference to `Py_FrozenMain' .

In previous Python 3.8.x the bug does not show.

Thanks,
Chris

--
components: C API
messages: 382651
nosy: chba
priority: normal
severity: normal
status: open
title: Method Py_FrozenMain missing in libpython3.9
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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2020-12-07 Thread Christian Bachmaier


Change by Christian Bachmaier :


--
components: +Library (Lib) -C API

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi


Valeriu Predoi  added the comment:

Great, cheers mate, I read through the PR's (and sorry to have pestered you 
over at the mock backport GitHub too haha) - this looks it will fix the issue 
nicely. Do you know when will the release be available for us using Python from 
Anaconda etc.? Feel free to close this, and thanks for the assistance! Cheers, V

--

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

3.9.1 is in RC1 as per https://www.python.org/dev/peps/pep-0596/#lifespan . It 
will be available as part of 3.9.1 or 3.9.2 . I am not sure about anaconda 
packaging schedule though.

--

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi


Valeriu Predoi  added the comment:

Excellent, just gonna let my team know about this and we'll hold off on 3.9.0 
then - good stuff, mate!

--

___
Python tracker 

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



[issue42588] Improvements to graphlib.TopologicalSorter.static_order() documentation

2020-12-07 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +pablogsal, rhettinger, tim.peters

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi


Change by Valeriu Predoi :


--
status: open -> pending

___
Python tracker 

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



[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi


Valeriu Predoi  added the comment:

Changed status to pending, will close once we've had 3.9.1 in our env and 
tested proper, but should be OK, cheers!

--
status: pending -> open

___
Python tracker 

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



[issue23915] [doc] traceback set with BaseException.with_traceback() pushed back on raise

2020-12-07 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +iritkatriel
nosy_count: 5.0 -> 6.0
pull_requests: +22544
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/23680

___
Python tracker 

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



[issue42573] Installation of Python 3.9 failing with message "User cancelled installation"

2020-12-07 Thread Steve Dower


Steve Dower  added the comment:

Can you try disabling any security/anti-malware software you have running? 
That's normally the only thing (besides a user) that will cause this error.

--

___
Python tracker 

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



[issue23915] [doc] traceback set with BaseException.with_traceback() pushed back on raise

2020-12-07 Thread Irit Katriel


Irit Katriel  added the comment:

The new PR has an alternative suggestion for a change, where I tried to 
incorporate both Travis's and David's points: (1) there are better alternatives 
now for exception chaining (2) the current frame gets pushed on the traceback 
when the exception is raised.

--
stage: patch review -> resolved

___
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-07 Thread Steve Dower


Steve Dower  added the comment:

Good point, we can make it set errno as well. Any generic error is fine (I 
don't know them off the top of my head), because it will chain up to the one 
set by the hook.

--

___
Python tracker 

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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Brandt Bucher


Brandt Bucher  added the comment:

Pablo, maybe you can shed some light on this. It looks like the PEG parser PR 
explicitly sets PYTHON_FOR_REGEN=python3.8 using pyenv in .travis.yml for the 
master (and now 3.9) branches. The change was made in the we-like-parsers repo 
here:

https://github.com/we-like-parsers/cpython/pull/88

Should we be doing this in the other branches as well?

--
nosy: +pablogsal

___
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-07 Thread Steve Dower


Steve Dower  added the comment:


New changeset c0afb7fa0ebd1c0e95c0760bbe75a99a8dd12ea6 by Matti Picus in branch 
'master':
bpo-39825: Fixes sysconfig.get_config_var('EXT_SUFFIX') on Windows to match 
distutils (GH-22088)
https://github.com/python/cpython/commit/c0afb7fa0ebd1c0e95c0760bbe75a99a8dd12ea6


--

___
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-07 Thread Steve Dower


Steve Dower  added the comment:

Thanks!

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



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

2020-12-07 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 10.0 -> 11.0
pull_requests: +22545
pull_request: https://github.com/python/cpython/pull/23681

___
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-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22546
pull_request: https://github.com/python/cpython/pull/23682

___
Python tracker 

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



[issue42592] TypedDict: total=False but still key required

2020-12-07 Thread Paul Bryan


New submission from Paul Bryan :

I believe "a" below should be an optional key, not a required one.

Python 3.9.0 (default, Oct  7 2020, 23:09:01) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing
>>> TD = typing.TypedDict("TD", {"a": str}, total=False)
>>> TD.__total__
False
>>> TD.__required_keys__
frozenset({'a'})
>>> TD.__optional_keys__
frozenset()
>>>

--
components: Library (Lib)
messages: 382662
nosy: gvanrossum, pbryan
priority: normal
severity: normal
status: open
title: TypedDict: total=False but still key required
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



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

2020-12-07 Thread miss-islington


miss-islington  added the comment:


New changeset ca52aa3ddd949ce2d259b4263344339b56db00b7 by Miss Islington (bot) 
in branch '3.8':
bpo-39825: Fixes sysconfig.get_config_var('EXT_SUFFIX') on Windows to match 
distutils (GH-22088)
https://github.com/python/cpython/commit/ca52aa3ddd949ce2d259b4263344339b56db00b7


--

___
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-07 Thread miss-islington


miss-islington  added the comment:


New changeset e9a6dcdefabb6c19074566f4ee0e02daaf57be18 by Miss Islington (bot) 
in branch '3.9':
bpo-39825: Fixes sysconfig.get_config_var('EXT_SUFFIX') on Windows to match 
distutils (GH-22088)
https://github.com/python/cpython/commit/e9a6dcdefabb6c19074566f4ee0e02daaf57be18


--

___
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-07 Thread hai shi


hai shi  added the comment:

>On the other side, defining a Py_mod_exec_once that supports execution > >for 
>just once can be a way.
>Although the usage is little, it will be fine because the use case will >exist.

IMHO, `Py_mod_exec_once` is more like a slot control flag. MAYBE we need add a 
module flag in `PyModuleDef`.

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



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

2020-12-07 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue42592] TypedDict: total=False but still key required

2020-12-07 Thread Brandt Bucher


Brandt Bucher  added the comment:

It looks like the issue is that _TypedDictMeta only respects "total" as a 
keyword argument to __new__, but the TypedDict function passes it along by 
setting __total__ in the generated namespace instead.

This fixes it:

diff --git a/Lib/typing.py b/Lib/typing.py
index 46c54c4..bb0696b 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -2050,7 +2050,7 @@ class body be required.
 except (AttributeError, ValueError):
 pass
 
-return _TypedDictMeta(typename, (), ns)
+return _TypedDictMeta(typename, (), ns, total=total)
 
 _TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {})
 TypedDict.__mro_entries__ = lambda bases: (_TypedDict,)

--
nosy: +brandtbucher

___
Python tracker 

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



[issue42592] TypedDict: total=False but still key required

2020-12-07 Thread Brandt Bucher


Brandt Bucher  added the comment:

I can fix this, Paul, unless you want to take it. Probably deserves a 
regression test or two as well.

--

___
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-07 Thread hai shi


hai shi  added the comment:

> MAYBE we need add a module flag in `PyModuleDef`.
I created a demo in PR 23683.

--

___
Python tracker 

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



[issue42592] TypedDict: total=False but still key required

2020-12-07 Thread Paul Bryan


Paul Bryan  added the comment:

Your patch LGTM, Brandt.

--

___
Python tracker 

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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am a bit confusedwhy is this failing now?

--

___
Python tracker 

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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Brandt Bucher


Brandt Bucher  added the comment:

It has been failing for some time. It's just not a required check, so it's easy 
to miss on a backport branch.

I think the addition of an f-string in PR 23371 a few weeks ago is what started 
making this fail (since the system python can't run clinic anymore). It looks 
like it has been failing ever since.

--

___
Python tracker 

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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Brandt Bucher


Brandt Bucher  added the comment:

So I suppose we can either:

- set PYTHON_FOR_REGEN to something 3.6+ on these backport branches
- use some other string formatting for that one line

I sort of prefer the second, since I *think* this is the only thing keeping 
older Pythons from working here.

--

___
Python tracker 

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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Ammar Askar


Ammar Askar  added the comment:

>From a quick glance at 
>https://github.com/python/cpython/pulls?page=2&q=base%3A3.8+-label%3Atype-documentation

It looks like travis on 3.8 last passed at 
https://github.com/python/cpython/pull/23364 around 19 days ago

The culprit commit is likely 
https://github.com/python/cpython/commit/66dd5338a1ca98921c8e6c51228541ef8ed8076a
 from 19 days ago since it added the first bit of f-string syntax to clinic.py, 
it was committed directly without a PR which is likely why this wasn't caught.

--
nosy: +ammar2

___
Python tracker 

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



[issue39625] Traceback needs more details

2020-12-07 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> stack tracebacks should give the relevant class name

___
Python tracker 

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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Ammar Askar


Ammar Askar  added the comment:

Oh whoops, got sniped by Brandt while investigating :)

--

___
Python tracker 

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



[issue42592] TypedDict: total=False but still key required

2020-12-07 Thread Brandt Bucher


Change by Brandt Bucher :


--
assignee:  -> brandtbucher

___
Python tracker 

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



[issue42585] Segmentation fault on Linux with multiprocess queue

2020-12-07 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
components: +Library (Lib)
nosy: +davin, pitrou
versions:  -Python 3.6

___
Python tracker 

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



[issue42592] TypedDict: total=False but still key required

2020-12-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Some notes on needed TypedDict doc fixes.

https://docs.python.org/3/library/typing.html#typing.TypedDict

"class typing.TypedDict(dict)"

The actual signature from inspect.signature is "(typename, fields=None, /, *, 
total=True, **kwargs)".  I presume fields not None and kwargs != {} are 
mutually exclusive.  AFAIK, the kwargs version of the call alternative is not 
in PEP 589.

"The type info for introspection can be accessed via Point2D.__annotations__ 
and Point2D.__total__."

'__total__' is not indexed.  __required_keys__ and __optional_keys__ are 
neither documented (including not in the PEP, which does not get revised) nor 
indexed.

--
nosy: +terry.reedy
stage:  -> test needed
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



[issue42592] TypedDict: total=False but still key required

2020-12-07 Thread Brandt Bucher


Brandt Bucher  added the comment:

It looks like this is a duplicate of issue 42059. We should just use their 
existing PR instead (PR 22736).

--
resolution:  -> duplicate
stage: test needed -> resolved
status: open -> closed
superseder:  -> TypedDict(...) as function does not respect "total" when 
setting __required_keys__ and __optional_keys__

___
Python tracker 

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



[issue42579] Solution from gh#python/cpython#13236 unnecessarily binds building of documentation to the latest version of Sphinx

2020-12-07 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue42579] Solution from gh#python/cpython#13236 unnecessarily binds building of documentation to the latest version of Sphinx

2020-12-07 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:


New changeset b63a620014b67a6e63d10783149c41baaf59def8 by Matěj Cepl in branch 
'master':
bpo-42579: Make workaround for various versions of Sphinx more robust (GH-23662)
https://github.com/python/cpython/commit/b63a620014b67a6e63d10783149c41baaf59def8


--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-07 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 60463e8e4f79e5b5e96dc43fb83ded373b489e33 by Brandt Bucher in 
branch '3.9':
bpo-42536: GC track recycled tuples (GH-23623) (GH-23651)
https://github.com/python/cpython/commit/60463e8e4f79e5b5e96dc43fb83ded373b489e33


--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-07 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 7c797982383ebfd9cca39c480dcf6132979dd06f by Brandt Bucher in 
branch '3.8':
bpo-42536: GC track recycled tuples (GH-23623) (GH-23652)
https://github.com/python/cpython/commit/7c797982383ebfd9cca39c480dcf6132979dd06f


--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-07 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I would suggest to use some other string formatting for that one line. The 
reason is that technically (although very unlikely) downstream consumers could 
be relying on some old PYTHON_FOR_REGEN in the Makefile for 3.8 and I would not 
like to change that in a patch release.

--

___
Python tracker 

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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +22548
pull_request: https://github.com/python/cpython/pull/23685

___
Python tracker 

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



[issue42593] Consistency in unicode string multiplication with an integer

2020-12-07 Thread syl-nktaylor


New submission from syl-nktaylor :

In 
https://github.com/python/cpython/blob/master/Objects/unicodeobject.c#L12930, 
unicode_repeat does string multiplication with an integer in 3 different ways:
1) one memset call, for utf-8 when string size is 1
2) linear 'for' loops, for utf-16 and utf-32 when string size is 1
3) logarithmic 'while' loop with memcpy calls, for utf-8/utf-16/utf-32 when 
string size > 1 

Is there a performance or correctness reason for which we can't also use the 
3rd way for the second case? I realise depending on architecture, the second 
case could benefit from vectorization, but the memcpy calls will also be 
hardware optimised.

An example of using just the 1st and 3rd methods:

--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -12954,31 +12954,16 @@ unicode_repeat(PyObject *str, Py_ssize_t len)
 assert(PyUnicode_KIND(u) == PyUnicode_KIND(str));

-if (PyUnicode_GET_LENGTH(str) == 1) {
-int kind = PyUnicode_KIND(str);
-Py_UCS4 fill_char = PyUnicode_READ(kind, PyUnicode_DATA(str), 0);
-if (kind == PyUnicode_1BYTE_KIND) {
-void *to = PyUnicode_DATA(u);
-memset(to, (unsigned char)fill_char, len);
-}
-else if (kind == PyUnicode_2BYTE_KIND) {
-Py_UCS2 *ucs2 = PyUnicode_2BYTE_DATA(u);
-for (n = 0; n < len; ++n)
-ucs2[n] = fill_char;
-} else {
-Py_UCS4 *ucs4 = PyUnicode_4BYTE_DATA(u);
-assert(kind == PyUnicode_4BYTE_KIND);
-for (n = 0; n < len; ++n)
-ucs4[n] = fill_char;
-}
-}
-else {
+Py_ssize_t char_size = PyUnicode_KIND(str);
+char *to = (char *) PyUnicode_DATA(u);
+if (PyUnicode_GET_LENGTH(str) == 1 && char_size == PyUnicode_1BYTE_KIND) {
+Py_UCS4 fill_char = PyUnicode_READ(char_size, PyUnicode_DATA(str), 0);
+memset(to, fill_char, len);
+} else {
 /* number of characters copied this far */
 Py_ssize_t done = PyUnicode_GET_LENGTH(str);
-Py_ssize_t char_size = PyUnicode_KIND(str);
-char *to = (char *) PyUnicode_DATA(u);
 memcpy(to, PyUnicode_DATA(str),
   PyUnicode_GET_LENGTH(str) * char_size);
 while (done < nchars) {...

--
components: Unicode
messages: 382681
nosy: ezio.melotti, syl-nktaylor, vstinner
priority: normal
severity: normal
status: open
title: Consistency in unicode string multiplication with an integer
type: behavior
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



[issue42593] Consistency in unicode string multiplication with an integer

2020-12-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

BTW, CPython does not use UTF-8 and UTF-16 encoding in internal representation 
of strings. It uses Latin1, UCS2 and UCS4 (UTF-32).

What benchmarks show? Is your code always faster and how much? If it is slower 
for some data, for what data and how much?

--
nosy: +serhiy.storchaka
type: behavior -> performance

___
Python tracker 

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



[issue41462] os.set_blocking() raises OSError on VxWorks RTOS

2020-12-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 06afac6c5740bb81d2b7ab9639d2b08cccf77d33 by pxinwr in branch 
'master':
bpo-41462: Add os.set_blocking() support for VxWorks RTOS (GH-21713)
https://github.com/python/cpython/commit/06afac6c5740bb81d2b7ab9639d2b08cccf77d33


--
nosy: +vstinner

___
Python tracker 

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



[issue26131] Raise ImportWarning when loader.load_module() is used

2020-12-07 Thread Brett Cannon


Change by Brett Cannon :


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



[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-07 Thread Brett Cannon


Brett Cannon  added the comment:

You could propose your backwards-incompatible proposals on python-ideas, Greg, 
and see if you get any uptake.

--

___
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-07 Thread STINNER Victor


STINNER Victor  added the comment:

This change broke the AMD64 FreeBSD Shared 3.x buildbot:
https://buildbot.python.org/all/#/builders/483/builds/513

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

--
nosy: +vstinner
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



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

2020-12-07 Thread STINNER Victor


STINNER Victor  added the comment:

It also broke POWER6 AIX 3.8:
https://buildbot.python.org/all/#builders/138/builds/125

Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.8.aixtools-aix-power6/build/Lib/test/test_sysconfig.py",
 line 366, in test_EXT_SUFFIX_in_vars
self.assertEqual(vars['EXT_SUFFIX'], _imp.extension_suffixes()[0])
AssertionError: '.so' != '.cpython-38d.so'
- .so
+ .cpython-38d.so

--

___
Python tracker 

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



[issue41462] os.set_blocking() raises OSError on VxWorks RTOS

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



[issue42593] Consistency in unicode string multiplication with an integer

2020-12-07 Thread STINNER Victor


STINNER Victor  added the comment:

+Py_UCS4 fill_char = PyUnicode_READ(char_size, PyUnicode_DATA(str), 0);
+memset(to, fill_char, len);

The second parameter of memset() is a byte (8-bit "octet"). You cannot pass 
Py_UCS4 to memset(), it doesn't work.

--

___
Python tracker 

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



[issue42590] Something like Rust's std::sync::Mutex – combining a mutex primitive and a piece of data it's protecting

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



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

2020-12-07 Thread mattip


mattip  added the comment:

I submitted PR 23684 to try to skip tests to fix this. I don't understand why 
this wasn't caught before merge, and where AIX and FREEBSD are setting 
EXT_SUFFIX improperly.

--
message_count: 9.0 -> 10.0
pull_requests: +22549
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/23684

___
Python tracker 

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



[issue42593] Consistency in unicode string multiplication with an integer

2020-12-07 Thread syl-nktaylor


syl-nktaylor  added the comment:

The build did seem to run, despite memset using fillchar without the explicit 
casting, so I assumed it did an implicit casting, but the original casting can 
be kept of course. With this build, my sample tests for 1-byte, 2-byte and 
4-byte chars also ran ok, so again, I assumed memset did the casting.

As for the benchmarks, I haven't run them, but yes, it's likely the best way to 
find out the performance considerations I was asking about.

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



[issue33066] raise an exception from multiple positions break the traceback frames

2020-12-07 Thread Irit Katriel


Irit Katriel  added the comment:

When an exception has a __traceback__ and you raise it, the current frame is 
added to that traceback. What do you expect the behavior to be when you raise 
the same exception instance twice, from two different locations?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue42594] Provide a way to skip magic-number search in ZipFile(mode='a')

2020-12-07 Thread Bart Robinson


New submission from Bart Robinson :

When a ZipFile object is created with mode='a', the existing file contents are 
checked for the magic number b"PK\005\006" near the end of the file.  If a 
non-zipfile just happens to contain this magic number, it can confuse the 
library into assuming the file is a zipfile when it is not.  It would be great 
if ZipFile.__init__() provided a way to skip the magic-number check and force a 
new central directory to be appended to the file.

This could take the form of an additional named argument like 
ZipFile.__init__(force_append=True), or an additional character in the mode 
string, like 'a+'.  Either of these options should be backward-compatible with 
existing code.

Currently, my company has code that uses monkey-patching to work around the 
lack of this feature in the standard library.  We use mode='a' to append 
metadata to files in existing formats that can contain arbitrary binary data 
and so occasionally include the magic number.

--
components: Library (Lib)
messages: 382691
nosy: Bart Robinson
priority: normal
severity: normal
status: open
title: Provide a way to skip magic-number search in ZipFile(mode='a')
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



[issue42572] Better path handling with argparse

2020-12-07 Thread Austin Scola


Austin Scola  added the comment:

Hey Eric,

Thanks for the response. I'm unfamiliar with the process of adding features to 
the language. Would you mind explaining to me what some of the qualifications 
are for getting something added to the stdlib? And also what role packages on 
PyPI play in that process?

I am also willing (and interested) in helping out in implementing this, but I 
don't want to step on anyone's toes so if the offer for help is rejected I will 
not be upset.

Thanks!

--

___
Python tracker 

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



  1   2   >