[issue41457] Implement random.shuffled

2020-08-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is a duplicate of issue26393 and issue27964.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> random.shuffled

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Look at the next subsection for example with 1. and 2.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue41458] Avoid overflow/underflow in math.prod()

2020-08-02 Thread Raymond Hettinger

New submission from Raymond Hettinger :

For float inputs, the math.prod() function could be made smarter about avoiding 
overflow() and underflow().  That would also improve commutativity as well.

Other tools like math.hypot() already take measures to avoid overflow/underflow 
and to improve commutativity.  This makes them nicer to use than näive 
implementations.

The recipe that I've been using for years is shown below.  It certainly isn't 
the best way, but it is O(n) and always avoids overflow and underflow when 
possible.  It has made for a nice primitive when implementing other functions 
that need to be as robust as possible.  For example, in the quadratic formula, 
the √(b²-4ac) factors to b√(1-4ac/b²) and the rightmost term gets implemented 
in Python as product([4.0, a, c, 1.0/b, 1.0/b]).

>>> from math import prod, fabs
>>> from collections import deque
>>> from itertools import permutations

>>> def product(seq):
s = deque()
for x in seq:
s.appendleft(x) if fabs(x) < 1.0 else s.append(x)
while len(s) > 1:
x = s.popleft() * s.pop()
s.appendleft(x) if fabs(x) < 1.0 else s.append(x)
return s[0] if s else 1.0

>>> data = [2e300, 2e200, 0.5e-150, 0.5e-175]
>>> for factors in permutations(data):
print(product(factors), prod(factors), sep='\t')


1e+175  inf
1.0001e+175 inf
1e+175  inf
1e+175  1e+175
1.0001e+175 inf
1.0001e+175 1.0001e+175
1.0001e+175 inf
1e+175  inf
1.0001e+175 inf
1.0001e+175 1.0001e+175
1e+175  inf
1e+175  1e+175
1e+175  inf
1e+175  1e+175
1.0001e+175 inf
1.0001e+175 1.0001e+175
1e+175  0.0
1.0001e+175 0.0
1.0001e+175 inf
1.0001e+175 1.0001e+175
1e+175  inf
1e+175  1e+175
1.0001e+175 0.0
1e+175  0.0

For math.prod(), I think a better implementation would be to run normally until 
an underflow or overflow is detected, then back up a step and switch-over to 
pairing low and high magnitude values.  Since this is fallback code, it would 
only affect speed to the extent that we test for overflow or underflow at every 
step.  Given how branch prediction works, the extra tests might even be free or 
at least very cheap.

The math module functions usually go the extra mile to be more robust (and 
often faster) than a näive implementation.  These are the primary reasons we 
teach people to prefer sqrt() over x**2, log1p(x) over log(1+x), prod(seq) over 
reduce(mul, seq, 1.0), log2(x) over log(x, 2), fsum(seq) over sum(seq), and 
hypot(x,y) over sqrt(x**2 + y**2).  In each case, the library function is some 
combination of more robust, more accurate, more commutative, and/or faster than 
a user can easily create for themselves.

--
components: Library (Lib)
messages: 374693
nosy: mark.dickinson, pablogsal, rhettinger, tim.peters
priority: normal
severity: normal
status: open
title: Avoid overflow/underflow in math.prod()
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



[issue41440] os.cpu_count doesn't work on VxWorks RTOS

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Do you know if any core devs have experience with VxWorks?  It is not even 
listed in https://devguide.python.org/experts/#platforms.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Nathan Maynes


Nathan Maynes  added the comment:

I'd like to create a pull request for this issue. Should be able to complete it 
this evening.

--
nosy: +nmaynes

___
Python tracker 

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



[issue41459] pickle.load raises SystemError on malformed input

2020-08-02 Thread Larry Hastings


Change by Larry Hastings :


--
nosy:  -larry

___
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 failures on OS without os.fork

2020-08-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: some test cases in test_uuid.py and test_ssl.py fail on some operating 
systems because of no os.fork support -> test_uuid.py and test_ssl.py failures 
on OS without os.fork

___
Python tracker 

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



[issue26185] zipfile.ZipInfo slots can raise unexpected AttributeError

2020-08-02 Thread Mickaël Schoentgen

Mickaël Schoentgen  added the comment:

The ticket could be closed, right? The fix was merged quite some time ago.

--
nosy: +Tiger-222

___
Python tracker 

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



[issue41459] pickle.load raises SystemError on malformed input

2020-08-02 Thread Guillaume


New submission from Guillaume :

pickle.load() raises a criptic SystemError with malformed input, whereas I 
would have expected an UnpicklingError. 

"SystemError: deallocated bytearray object has exported buffers"

Because pickle is not meant for use on untrusted input, this likely would not 
be considered a servere issue. 

Reproducing: 

import pickle
f = open("crash-95c0cb965cb66f5eebc778a1d2304eaffb72f1aa", "rb")
d = pickle.load(f)

--
components: Argument Clinic
files: crash-95c0cb965cb66f5eebc778a1d2304eaffb72f1aa
messages: 374695
nosy: Guillaume, larry
priority: normal
severity: normal
status: open
title: pickle.load raises SystemError on malformed input
versions: Python 3.8
Added file: 
https://bugs.python.org/file49358/crash-95c0cb965cb66f5eebc778a1d2304eaffb72f1aa

___
Python tracker 

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



[issue7291] urllib2 cannot handle https with proxy requiring auth

2020-08-02 Thread Alexey Namyotkin


Alexey Namyotkin  added the comment:

It has been 5 years, now the urllib3 is actively used, but it also inherited 
this problem: if no authentication data has been received, then the method 
_tunnel raises an exception OSError that does not contain response headers. 
Accordingly, this exception cannot be handled. And perhaps this is an obstacle 
to building a convenient system of authentication on a proxy server in a widely 
used library requests (it would be nice to be able to just provide an argument 
proxy_auth, similar to how it is done for server authorization). Now, if a user 
wants to send a https request through a proxy that requires complex 
authentication (Kerberos, NTLM, Digest, other) using the urllib3, he must first 
send a separate request to the proxy, receive a response, extract the necessary 
data to form the header Proxy-Authorization, then generate this header and pass 
it to the ProxyManager. And if we are talking about Requests, then the 
situation there is worse, because you cannot pass proxy headers directly 
 (https://github.com/psf/requests/issues/2708).
If we were to aim to simplify the authentication procedure on the proxy server 
for the user, then where would we start, do we need to change the http.client 
so that the error returned by the method _tunnel contains headers? Or maybe 
it's not worth changing anything at all and the path with preliminary 
preparation by user of the header Proxy-Authorization is the only correct one? 
Martin Panter, could you also give your opinion? Thank you in advance.

--

___
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 failures on OS without os.fork

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Are this and similar issues theoretical ("if Python were implemented on such 
systems...") or actual ("python is implemented on one such system (VxWorks?) 
and these tests fail").  If the latter, does the test suite pass at least with 
respect to, in this case, os.fork?  I expect that there are other tests that 
depend on os.fork, but maybe they are already guarded.

--
nosy: +terry.reedy

___
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

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Similar issues:
#41440 os.cpu_count
#41442 unix shell
#41443 some posix.x functions

PR 21684 is fine as far as it goes, and I could merge and backport, but I don't 
know about our test policy with respect to need and minimized OSes.  We do not 
put conditions for unsupported oses in production code, but I don't know about 
skips for such systems in tests.

Victor, do you know, or know who would?

--
nosy: +vstinner
title: test_uuid.py and test_ssl.py failures on OS without os.fork -> 
test_uuid.py and test_ssl.py failure on OSes without os.fork

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue41459] pickle.load raises SystemError on malformed input

2020-08-02 Thread Guillaume


Guillaume  added the comment:

Updated Components. I believe pickle fit in the Library category. 

Note this was discovered with python 3.8.5

--
components: +Library (Lib) -Argument Clinic

___
Python tracker 

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



[issue41455] Python Devguide differs from python docs

2020-08-02 Thread Yaroslav


Yaroslav  added the comment:

As I can see here 
https://github.com/python/devguide/blob/master/garbage_collector.rst#collecting-the-oldest-generation

> the GC only triggers a full collection of the oldest generation if the ratio 
> long_lived_pending / long_lived_total is above a given value (hardwired to 
> 25%)

But in the python docs here 
https://docs.python.org/3.10/library/gc.html#gc.set_threshold

> When the number of allocations minus the number of deallocations exceeds 
> threshold0, collection starts. Initially only generation 0 is examined. If 
> generation 0 has been examined more than threshold1 times since generation 1 
> has been examined, then generation 1 is examined as well. Similarly, 
> threshold2 controls the number of collections of generation 1 before 
> collecting generation 2.

As I can see here: 
https://github.com/python/cpython/blob/master/Modules/gcmodule.c#L1456 the 
first one is correct.

We should probably fix python docs accordingly.

--

___
Python tracker 

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



[issue41455] Python Devguide differs from python docs

2020-08-02 Thread Yaroslav


Yaroslav  added the comment:

Here's opened PR. https://github.com/python/cpython/pull/21703

--
nosy:  -python-dev

___
Python tracker 

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



[issue38628] Issue with ctypes in AIX

2020-08-02 Thread David Edelsohn


David Edelsohn  added the comment:

I thought that the ctypes documentation mentioned that Arrays passed by Value 
are converted to Structures.  I cannot find it in the ctypes documentation at 
the moment.  But Modules/_ctypes/stgdict.c has a large comment about passing 
Arrays by Value as Structs.

* See bpo-22273. Arrays are normally treated as pointers, which is
* fine when an array name is being passed as parameter, but not when
* passing structures by value that contain arrays. On 64-bit Linux,
* small structures passed by value are passed in registers, and in
* order to do this, libffi needs to know the true type of the array
* members of structs. Treating them as pointers breaks things.

The comment proceeds to discuss 64-bit Linux, which means x86_64 Linux. Python 
ctypes coerces the array into a structure, which works on x86_64 Linux.  
Something about the libffi descriptor created by Python ctypes does not work 
correctly for AIX, and it may be a fundamental difference in the alignment and 
padding rules for passing Arrays versus Structures.  Python ctypes assumes that 
Arrays and Structures are interchangeable with respect to argument passing.

And, again, the initial example was completely wrong and illegal and not 
expected to work because it created a data object that doesn't match the 
function signature, which happened to behave correctly on x86.  The initial 
example in the bug report repeatedly confuses people because they continually 
try to debug an incorrect use of ctypes.

--

___
Python tracker 

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



[issue38628] Issue with ctypes in AIX

2020-08-02 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

David, is the issue you mention in your message at 2020-02-05 reproducible with 
valid usage of ctypes (that is, by calling a C function with the correct 
signature)? 

What do you mean with "this is documented in Python ctypes"?

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue41456] loop.run_in_executor creat thread but not destory it after the task run over

2020-08-02 Thread Guo Xiyong


New submission from Guo Xiyong :

code like this:

import asyncio

import time

import threading


def sync_test():
time.sleep(1)

async def run_test():
loop = asyncio.get_event_loop()

for _ in range(10):
# r = await loop.getaddrinfo('wq.io', 443)
# print(r)

loop.run_in_executor(None, sync_test)

for t in threading.enumerate():
print(t)


while True:
await asyncio.sleep(1)


asyncio.run(run_test())


after run, the 10 thread will always exist

--
components: asyncio
messages: 374679
nosy: asvetlov, cielpy, yselivanov
priority: normal
severity: normal
status: open
title: loop.run_in_executor creat thread but not destory it after the task run 
over
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



[issue41410] Opening a file in binary mode makes a difference on all platforms in Python 3

2020-08-02 Thread Rishav Kundu


Change by Rishav Kundu :


--
keywords: +patch
nosy: +xrisk
nosy_count: 3.0 -> 4.0
pull_requests: +20844
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21701

___
Python tracker 

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



[issue41457] Implement random.shuffled

2020-08-02 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +mark.dickinson, rhettinger

___
Python tracker 

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



[issue41457] Implement random.shuffled

2020-08-02 Thread Ram Rachum


Change by Ram Rachum :


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

___
Python tracker 

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



[issue41457] Implement random.shuffled

2020-08-02 Thread Ram Rachum


New submission from Ram Rachum :

Writing the patch now.

Thread: 
https://mail.python.org/archives/list/python-id...@python.org/thread/OHLXVKIBMNSQO6BCFK6LEHSYNXDB6OQJ/

--
components: Library (Lib)
messages: 374683
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Implement random.shuffled
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



[issue41410] Opening a file in binary mode makes a difference on all platforms in Python 3

2020-08-02 Thread Rishav Kundu


Rishav Kundu  added the comment:

Submitted a PR. Please let me know if I missed something :)

--

___
Python tracker 

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



[issue41395] pickle and pickletools cli interface doesn't close input and output file.

2020-08-02 Thread Amir Mohamadi


Change by Amir Mohamadi :


--
nosy: +Amir
nosy_count: 6.0 -> 7.0
pull_requests: +20845
pull_request: https://github.com/python/cpython/pull/21702

___
Python tracker 

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



[issue41455] Python Devguide differs from python docs

2020-08-02 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 2.0 -> 3.0
pull_requests: +20846
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21703

___
Python tracker 

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



[issue26185] zipfile.ZipInfo slots can raise unexpected AttributeError

2020-08-02 Thread Ned Deily


Ned Deily  added the comment:

Fixed in 3.9.0

--
nosy: +ned.deily
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue40978] Document that typing.SupportsXXX protocols are runtime checkable

2020-08-02 Thread Luciano Ramalho


Luciano Ramalho  added the comment:

The merged PR that fixed https://bugs.python.org/issue40979 also fixes this 
issue.

It is now documented that these protocols are runtime checkable, with caveats.

--

___
Python tracker 

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



[issue41398] cgi module, parse_multipart fails

2020-08-02 Thread Guido van Rossum

Guido van Rossum  added the comment:

So per the stackoverflow explanation you shouldn’t do that? Should we close 
this?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Nathan Maynes


Change by Nathan Maynes :


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

___
Python tracker 

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



[issue41390] Errors and warnings on generate bytecode files

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

You're going to have to ignore that status or skip the offending files.

--
nosy: +gvanrossum
resolution:  -> wont fix
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



[issue41459] pickle.load raises SystemError on malformed input

2020-08-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

As a rule, we don't put a lot of effort into handling malformed pickle input. 
Is this causing some practical problem?

--
nosy: +eric.smith

___
Python tracker 

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



[issue41335] free(): invalid pointer in list_ass_item() in Python 3.7.3

2020-08-02 Thread Howard A. Landman


Howard A. Landman  added the comment:

Made some progress. By running it under gdb and breaking in malloc_printerr(), 
I got a better stack trace:

Breakpoint 1, malloc_printerr (str=0x76e028f8 "free(): invalid pointer")
at malloc.c:5341
5341malloc.c: No such file or directory.
(gdb) bt
#0  malloc_printerr (str=0x76e028f8 "free(): invalid pointer") at malloc.c:5341
#1  0x76d44d50 in _int_free (av=0x76e1f7d4 , 
p=0x43417c , have_lock=)
at malloc.c:4165
#2  0x001b4f40 in list_dealloc (op=0x760ef288) at ../Objects/listobject.c:324
#3  0x001be784 in frame_dealloc (
f=Frame 0x765fcc30, for file 
/home/pi/src/QTD/src/tdc7201/tdc7201/__init__.py, line 719, in read_regs24 
(i=40, reg=28)) at ../Objects/frameobject.c:470
#4  function_code_fastcall (globals=, nargs=, 
args=, co=) at ../Objects/call.c:291
#5  _PyFunction_FastCallKeywords (func=, stack=, 
nargs=, kwnames=) at ../Objects/call.c:408
#6  0x0011f984 in call_function (kwnames=0x0, oparg=, 
pp_stack=0x7effed40) at ../Python/ceval.c:4554
#7  _PyEval_EvalFrameDefault (f=, throwflag=)
at ../Python/ceval.c:3110
#8  0x0011d63c in PyEval_EvalFrameEx (throwflag=0, 
f=Frame 0x760e8960, for file 
/home/pi/src/QTD/src/tdc7201/tdc7201/__init__.py, line 962, in measure 
(self=, reg1=[130, 66, 0, 7, 255, 
255, 6, 64, 0, 1, 65535, 1600, Breakpoint 1, malloc_printerr (str=0x76e028f8 
"free(): invalid pointer")
at malloc.c:5341
5341malloc.c: No such file or directory.
(gdb) bt
#0  malloc_printerr (str=0x76e028f8 "free(): invalid pointer") at malloc.c:5341
#1  0x76d44d50 in _int_free (av=0x76e1f7d4 , 
p=0x43417c , have_lock=)
at malloc.c:4165
#2  0x001b4f40 in list_dealloc (op=0x760ef288) at ../Objects/listobject.c:324
#3  0x001be784 in frame_dealloc (
f=Frame 0x765fcc30, for file 
/home/pi/src/QTD/src/tdc7201/tdc7201/__init__.py, line 719, in read_regs24 
(i=40, reg=28)) at ../Objects/frameobject.c:470
#4  function_code_fastcall (globals=, nargs=, 
args=, co=) at ../Objects/call.c:291
#5  _PyFunction_FastCallKeywords (func=, stack=, 
nargs=, kwnames=) at ../Objects/call.c:408
#6  0x0011f984 in call_function (kwnames=0x0, oparg=, 
pp_stack=0x7effed40) at ../Python/ceval.c:4554
#7  _PyEval_EvalFrameDefault (f=, throwflag=)
at ../Python/ceval.c:3110
#8  0x0011d63c in PyEval_EvalFrameEx (throwflag=0, 
f=Frame 0x760e8960, for file 
/home/pi/src/QTD/src/tdc7201/tdc7201/__init__.py, line 962, in measure 
(self=, reg1=[130, 66, 0, 7, 255, 
255, 6, 64, 0, 1, 65535, 1600, 1, None, None, None, 1284, 322, 2371, 0, 0, 0, 
0, 0, 0, 0, 0, 2322, 23172, None], chip_select=1, sclk=23, miso=21, mosi=19, 
cs1=24, cs2=26, enable=12, osc_enable=16, trig1=7, int1=37, trig2=None, 
int2=None, start=18, stop=22, meas_mode=2, cal_pers=10, cal_count=, norm_lsb=, tof1=, tof2=, tof3=0, tof4=0, tof5=0) 
at remote 0x76191750>, simulate=True, error_prefix='59835 ', 
log_file=<_io.TextIOWrapper at remote 0x761df4b0>, cf1=130, timeout=, n_stop=3, threshold=, pulse=2))
at ../Python/ceval.c:3930
1, None, None, None, 1284, 322, 2371, 0, 0, 0, 0, 0, 0, 0, 0, 2322, 23172, 
None], chip_select=1, sclk=23, miso=21, mosi=19, cs1=24, cs2=26, enable=12, 
osc_enable=16, trig1=7, int1=37, trig2=None, int2=None, start=18, stop=22, 
meas_mode=2, cal_pers=10, cal_count=, 
norm_lsb=, tof1=, 
tof2=, tof3=0, tof4=0, tof5=0) at remote 
0x76191750>, simulate=True, error_prefix='59835 ', log_file=<_io.TextIOWrapper 
at remote 0x761df4b0>, cf1=130, timeout=, n_stop=3, 
threshold=, pulse=2))
at ../Python/ceval.c:3930
...

read_regs24 (i=40, reg=28) performs an SPI read of 13 24-bit registers (so 39 
bytes); the corresponding Python code is:

def read_regs24(self):
"""Read all 24-bit chip registers, using auto-increment feature."""
result24 = self._spi.xfer([self.MINREG24|self._AI,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
#print("AI read 24-bits =", result24)
#print("length =", len(result24))
i = 1
for reg in range(self.MINREG24, self.MAXREG24+1):
# Data comes in MSB first.
self.reg1[reg] = (result24[i] << 16) | (result24[i+1] << 8) | 
result24[i+2]
i += 3

The zero padding is necessary to make sure that enough SPI clock cycles are 
sent for the data bytes to get clocked back in. The _AI flag turns on 
auto-increment, so each byte is from the next address.

So it looks like the bug is either in the spidev library, or in Python 
deallocation of this frame. I'll try pulling the sent data list outside the 
method, since it is always the same; that will avoid the list alloc/dealloc, 
and may 

[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Guido van Rossum

Guido van Rossum  added the comment:

Maybe you’ll get some explanation or pointers on python-list. Or were you 
volunteering to write something?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +20852
pull_request: https://github.com/python/cpython/pull/21708

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20853
pull_request: https://github.com/python/cpython/pull/21709

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset ecaf949cc487887883c14dff7a96e09ac9404994 by Nathan M in branch 
'master':
bpo-41424: Remove extra words in Tkinter-Packer documentation (GH-21707)
https://github.com/python/cpython/commit/ecaf949cc487887883c14dff7a96e09ac9404994


--

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords:  -patch
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



[issue40979] typing module docs: keep text, add subsections

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset ab72fdeb82c3ab045b480cd4bb4f928c12653ecb by Luciano Ramalho in 
branch 'master':
bpo-40979: refactored typing.rst; (mostly) same content, new sub-sections and 
ordering (#21574)
https://github.com/python/cpython/commit/ab72fdeb82c3ab045b480cd4bb4f928c12653ecb


--

___
Python tracker 

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



[issue40979] typing module docs: keep text, add subsections

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thank you so much for your hard work and flexibility! The chapter is in much 
better shape now.

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



[issue40978] Document that typing.SupportsXXX protocols are runtime checkable

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks, I was looking for this.

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

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +20849
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21706

___
Python tracker 

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



[issue41447] Resource Tracker in Multiprocessing Shared Memory not working correctly

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Looks like a duplicate of https://bugs.python.org/issue38119

--
nosy: +gvanrossum
resolution:  -> duplicate
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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread miss-islington


miss-islington  added the comment:


New changeset 905c7de6e4bbccf8c3dfa593fa287aecac497472 by Miss Islington (bot) 
in branch '3.9':
bpo-41424: Remove extra words in Tkinter-Packer documentation (GH-21707)
https://github.com/python/cpython/commit/905c7de6e4bbccf8c3dfa593fa287aecac497472


--

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread miss-islington


miss-islington  added the comment:


New changeset 45d37cbb04279a52c63dd180aacda7d35e02a0ef by Miss Islington (bot) 
in branch '3.8':
bpo-41424: Remove extra words in Tkinter-Packer documentation (GH-21707)
https://github.com/python/cpython/commit/45d37cbb04279a52c63dd180aacda7d35e02a0ef


--

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +20854
pull_request: https://github.com/python/cpython/pull/21710

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't think that waiting another six months is going to make this happen 
either. Maybe you can petition realpython.com to publish something about this.

Honestly it sounds like this ties too many different topics together to easily 
fit in the library docs: in order to make a large number of different use cases 
easy, how I/O works under the hood in Python is truly complex.

So I'm going to close this rather than have it add to our issue count.

--
resolution:  -> wont fix
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



[issue41210] Docs: More description of reason about LZMA1 data handling with FORMAT_ALONE

2020-08-02 Thread Hiroshi Miura


Hiroshi Miura  added the comment:

Here is a draft of additional text


Usage of :const:`FILTER_LZMA1` with :const:`FORMAT_RAW` is not recommended.
Because it may produce a wrong output in a certain condition, decompressing 
a combination of :const:`FILTER_LZMA1` and BCJ filters in :const:`FORMAT_RAW`.
It is because LZMA1 format sometimes lacks End of Stream (EOS) mark that
lead BCJ filters can not be flushed.


I've tried to write without a description of liblzma implementation, but only a 
nature of API and file format specification.

--

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Anatoli Babenia


Anatoli Babenia  added the comment:

Not sure I can volunteer - need to find a sustenance ASAP. But given that 
nothing moved in this direction over the past 6 months, another week spent not 
writing this stuff won't change anything.

In any case it would start with the following problem - "Logs don't show up if 
running in Kubernetes" - https://github.com/bottlepy/bottle/issues/1130

I've encountered it a 3 days session on adding CI to my favourite cheat sheet 
server 
https://github.com/chubin/cheat.sh/pull/224/commits/10bfaab38cc649d765637bf4af4791266d21a3f7
 and I am still not sure I am right. That's why I want to read something about 
it.

--

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 4bc8445c392e22fb926eeea50d3e943b6241affa by Miss Islington (bot) 
in branch '3.8':
bpo-41425: Make tkinter doc example runnable (GH-21706)
https://github.com/python/cpython/commit/4bc8445c392e22fb926eeea50d3e943b6241affa


--

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Anatoli Babenia


Anatoli Babenia  added the comment:

To avoid too much outside reference, the commit message I am unsure of is this.

> Run Python 3 in unbuffered mode to see lines in `docker logs` as soon as they 
> appear. When Python 3 is not attached to a terminal, it turns on the 
> buffering, like when `docker` runs in a background.

I am not sure.

1. How Python detects it is attached to terminal or not.
2. That it is Python that turns on stdout buffering.
3. What happens to stdout with child processes when they run with docker in 
different modes - foreground, background (-d), interactive (-i), with tty (-t) 
and without tty.

--
resolution: wont fix -> 
status: closed -> open

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't know anything about Docker, so I can't help you there. Please don't 
reopen the issue again.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Anatoli Babenia


Anatoli Babenia  added the comment:

The point is that without a clear description of buffering in Python 3, it is 
impossible to understand what goes when Python is wrapped by Docker, 
supervisord, redirected to file etc.

--

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Anatoli Babenia


Anatoli Babenia  added the comment:

I didn't reopen the issue explicitly. Just pressed the submit button again when 
the notification about edited bug appeared.

--

___
Python tracker 

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



[issue41260] datetime: strftime method takes different keyword argument: fmt (pure) or format (C)

2020-08-02 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +20856
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/21712

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-08-02 Thread Shantanu


Shantanu  added the comment:

Just bumping this issue, as per dev guide, since 
https://github.com/python/cpython/pull/19612 has been ready for about two 
months. Would be grateful for review :-)

--

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset c36dbac588e1d99975f285a874bb20e9f5040af4 by Ankit Chandawala in 
branch 'master':
bpo-41425: Make tkinter doc example runnable (GH-21706)
https://github.com/python/cpython/commit/c36dbac588e1d99975f285a874bb20e9f5040af4


--

___
Python tracker 

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



[issue41210] Docs: More description(warning) about LZMA1 + BCJ with FORMAT_RAW

2020-08-02 Thread Hiroshi Miura


Change by Hiroshi Miura :


--
title: Docs: More description of reason about LZMA1 data handling with 
FORMAT_ALONE -> Docs: More description(warning) about LZMA1 + BCJ with 
FORMAT_RAW

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords:  -patch
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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 3c4fc864ce931db90214c54d742062a80dbef7c4 by Miss Islington (bot) 
in branch '3.9':
bpo-41425: Make tkinter doc example runnable (GH-21706)
https://github.com/python/cpython/commit/3c4fc864ce931db90214c54d742062a80dbef7c4


--

___
Python tracker 

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



[issue29269] test_socket failing in solaris

2020-08-02 Thread Brian Vandenberg


Brian Vandenberg  added the comment:

Solaris will be around for at least another 10-15 years.

The least you could do is look into it and offer some speculations.

--

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20855
pull_request: https://github.com/python/cpython/pull/21711

___
Python tracker 

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



[issue41460] Translation Error in in Functional Programming HOWTO page

2020-08-02 Thread 李冰

New submission from 李冰 :

There seems a translation error in Python Documentation in Functional 
Programming HOWTO page.

The page's English version's url is 
https://docs.python.org/3/howto/functional.html
And the Japanese version's url is 
https://docs.python.org/ja/3/howto/functional.html.

In English version, there is a paragraph: 

"In declarative languages, you write a specification that describes the problem 
to be solved, and the language implementation figures out how to perform the 
computation efficiently. SQL is the declarative language you’re most likely to 
be familiar with; a SQL query describes the data set you want to retrieve, and 
the SQL engine decides whether to scan tables or use indexes, which subclauses 
should be performed first, etc."

The corresponding Japanses translation is this:

"宣言型 言語で書くのは、解くべき問題を説明する仕様書であって、それを効率的に計算処理する方法を見付けるのは言語実装の役目です。SQL 
はおそらく一番よく知られた宣言型言語です; SQL 
のクエリは取得したいデータセットを説明しているだけで、テーブルを走査するかインデックスを使うか、どのサブクローズから実行するか等々を決めるのは SQL 
エンジンなのです。"

In the above paragraph, I think the translator translate the word "subclauses" 
to "サブクローズ", which is wrong.

In Japanese, サブ means sub and クローズ means close, so it is just "subclose", not 
"subclause".

That is all. Thank you.

--
messages: 374713
nosy: mydairyyao
priority: normal
severity: normal
status: open
title: Translation Error in in Functional Programming HOWTO page
type: enhancement

___
Python tracker 

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