[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor

2022-01-23 Thread Ram Rachum


Ram Rachum  added the comment:

Oh that sucks. Logan and Antoine worked on this feature for so long. Thanks for 
reporting Greg.

--

___
Python tracker 

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



[issue46464] concurrent.futures.ProcessPoolExecutor can deadlock when tcmalloc is used

2022-01-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

https://bugs.python.org/issue44733 for 3.11 attempts to build upon the dynamic 
spawning ability and will need reverting unless a non-thread+fork 
implementation is provided.

--

___
Python tracker 

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



[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor

2022-01-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
resolution: fixed -> 

___
Python tracker 

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



[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor

2022-01-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

If we want this feature to stay in, it needs an implementation that does not 
rely on a multithreaded processing calling fork(). I'm going to have to revert 
the existing implementation for bpo-46464.

--
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

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



[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor

2022-01-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

[bpo-46464](https://bugs.python.org/issue46464) describes a deadlock that the 
pre-requisite for this feature causes.

Spawning new children directly via fork() is impossible once a thread in the 
parent process has been started and concurrent.futures.process starts a thread.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue46500] make timeit module accept files

2022-01-23 Thread Arjun


Change by Arjun :


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

___
Python tracker 

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



[issue46500] make timeit module accept files

2022-01-23 Thread Arjun


New submission from Arjun :

currently, timeit accepts programs line by line as commandline arguments. 

it would be convenient to give it a program as a file to benchmark.

--
components: Library (Lib)
messages: 411448
nosy: CCLDArjun
priority: normal
severity: normal
status: open
title: make timeit module accept files
type: enhancement

___
Python tracker 

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



[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue46499] circular impoty

2022-01-23 Thread shukurulloxkomiljonov


New submission from shukurulloxkomiljonov :

ImportError: cannot import name 'Db' from partially initialized module 
'orm_model.db' (most likely due to a circular import) 
(C:\Users\Komil\OneDrive\Desktop\mymodel\orm_model\db.py)


I am making al library!

I have model.py and db.py
in db.py has class Db
in model.py has class Model

db.py imported Model
and model.py imported Db

but i have error 

ImportError: cannot import name 'Db' from partially initialized module 
'orm_model.db' (most likely due to a circular import) 


how can i resolve it please enswer me!

--
components: Library (Lib)
messages: 411447
nosy: KOMILJONOV
priority: normal
severity: normal
status: open
title: circular impoty
type: crash
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue45860] Mutithread leads to Illegal instruction crashing CPython

2022-01-23 Thread Xinmeng Xia


Change by Xinmeng Xia :


--
title: UnboundLocalError leads to Illegal instruction crashing CPython -> 
Mutithread leads to Illegal instruction crashing CPython

___
Python tracker 

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



[issue45860] UnboundLocalError leads to Illegal instruction crashing CPython

2022-01-23 Thread Xinmeng Xia


Xinmeng Xia  added the comment:

A simpler example to reproduce it:
test.py

import threading
import ctypes
from test import test_code

def test_free_different_thread():
f = test_code.CoExtra().get_func()

class ThreadTest(threading.Thread):
def __init__(CoExtra, f, test):
f.test = f

test_code.SetExtra(f.__code__, test_code.FREE_INDEX, ctypes.c_voidp(500))
tt = ThreadTest(f, f)
test_code.CoExtra().assertEqual(test_code.LAST_FREED, 500)

test_free_different_thread()


Just run test.py on Ubuntu 18.04 and you can observe the crash.
version of Python: Python3.11.0a4

--

___
Python tracker 

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



[issue46498] Add new triplets for loongarch64

2022-01-23 Thread Zhang Na


Change by Zhang Na :


--
components: Build
files: loongarch64.diff
keywords: patch
nosy: zhangna01
priority: normal
severity: normal
status: open
title: Add new triplets for loongarch64
type: compile error
versions: Python 3.9
Added file: https://bugs.python.org/file50579/loongarch64.diff

___
Python tracker 

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



[issue46476] Not all memory allocated by _Py_Quicken() is released at Python exit

2022-01-23 Thread Kumar Aditya


Kumar Aditya  added the comment:

> Kumar, I'm not sure I follow your concerns about the bootstrap working 
> differently on Windows than on Unix. Is the problem that on Unix the 
> bootstrap interpreter is linked without deepfreeze.c so there is no 
> definition of the symbol _Py_Deepfreeze_Fini? In that case, you can probably 
> just add a dummy one to _bootstrap_python.c.

Yes, that comment was outdated as I didn't knew that _bootstrap_python.c and 
_freeze_module.c are different executables on Linux. In the latest commit it is 
fixed and there are 0 memory blocks left on Linux and 131 on Windows. The next 
thing to be done is solving how to restore the code objects before it was 
quickened.

--

___
Python tracker 

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



[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Tim Peters


Tim Peters  added the comment:

For any fixed width integer type, the worst case of the dead simple loop (all 
bits are zero) is a fixed upper bound. So you don't mean "constant bounded" 
either. You mean something more like "clever C code that usually runs faster 
than the obvious loop".

See my "if it's not unbearably pedantic" comment earlier ;-) Again, by 
"primitive" I meant HW-level primitive. I agree that's not wholly clear from 
what I wrote, but really don't care - it's a trivial point that makes no 
difference in context. The lack of an integer type in C wide enough to support 
the division the paper uses is _the_ deal-breaker. That C doesn't define a 
count-leading-zero function either is just a flea on the tail of that dog.

--

___
Python tracker 

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



[issue46186] replace `io.IncrementalNewlineDecoder` with non incremental newline decoders

2022-01-23 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

If the old code is incorrect, can you give an example where it fails? Is it 
possible to write a unit test demonstrating that the current behavior is wrong?

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue22859] unittest.TestProgram.usageExit no longer invoked

2022-01-23 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

I suggest we mark the method as deprecated and remove it in 3.13.

Making the argparse objects public can be done in a separate enhancement 
request if there is demand for it.

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46497] IDLE macOS shortcut ctrl+S doesn’t work for show completions

2022-01-23 Thread David Contreras

New submission from David Contreras :

I noticed that selecting Edit>Show Completions works as expected on Python 
3.10.2 and macOS 12.1 after issue 40128 was resolved.

But trying the default keyboard shortcut ctrl+S only highlights the edit menu 
but doesn't work.

I understand that it's supposed to be ctrl+space because that's how it works on 
windows and it also works in macOS after disabling the default behavior for 
ctrl+space but this doesn't highlight the edit menu.

On the original issue this behavior was also described but now the issue is 
closed and the behavior is the same.

So ctrl+S highlights the edit menu but doesn’t show completions and ctrl+space 
shows completions but has a conflict with the default macOS keyboard shortcuts 
and is not the shortcut specified on the edit menu and it doesn’t highlight it.

--
messages: 411441
nosy: dvd101x
priority: normal
severity: normal
status: open
title: IDLE macOS shortcut ctrl+S doesn’t work for show completions

___
Python tracker 

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



[issue41841] idlelib/NEWS.txt for 3.10.0 and backports

2022-01-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
superseder:  -> IDLE subsection of What's New 3.11

___
Python tracker 

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



[issue33983] unify types for lib2to3.pytree.Base.children

2022-01-23 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

lib2to3 is deprecated as of Python 3.11, and there's an available workaround. I 
don't think it still makes sense to change anything here.

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



[issue46496] idlelib/NEWS.txt for 3.11.0 and backports

2022-01-23 Thread Terry J. Reedy


New submission from Terry J. Reedy :

Main became 3.11 as of 3.10.0 beta 1: 2021-05-03.
However, backported IDLE issues continued going under What's New 3.10
on both main and 3.10 until 3.10.0rc1, 2021-08-03.
Subsequent idlelib/NEWS.txt items go under
What's New 3.11.0 on main branch
What's New 3.10.1 on 3.10 branch

In other words, idlelib News is handled as if main were branched off as of 
.0rc1.  This is different from the changelog attached to What's New in 3.x.

Release peps -- needed for proposed and actual release dates.
3.9 PEP 596 https://www.python.org/dev/peps/pep-0596/
3.10 PEP 619 https://www.python.org/dev/peps/pep-0619/
3.11 PEP 664 https://www.python.org/dev/peps/pep-0664/

--
assignee: terry.reedy
messages: 411439
nosy: terry.reedy
priority: normal
severity: normal
status: open
title: idlelib/NEWS.txt for 3.11.0 and backports
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue41846] IDLE subsection of What's New 3.10

2022-01-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
superseder:  -> IDLE subsection of What's New 3.11

___
Python tracker 

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



[issue46495] IDLE subsection of What's New 3.11

2022-01-23 Thread Terry J. Reedy


New submission from Terry J. Reedy :

Following #41846, master issue for IDLE entries in Doc/whatsnew/3.11.rst.  When 
appropriate, add subsection 'idlelib and IDLE' to 'Improved Modules' The 
initial entries include important enhancements to IDLE since 3.10.0.  (Anything 
included in 3.10.0 does not belong here.

Because of IDLE's special backport policy (PEP 434), this initial part 
concludes with "The changes above have been backported to 3.9 maintenance 
releases."  Future subsubsections 'New in 3.10.z:', z >= 1, will follow for 
backports to 3.10.z.  These can precede the backport message as long as it is 
true. This issue will close after the last 3.10 maintenance release.

3.11.rst will always exist in the master branch.  Changes are applied to master 
and backported as needed at the time.  Entries will normally be the same in the 
What's New x.y for all x.y branches that get the enhancement.  However, each 
file needs different backports.  Hence separate PRs are needed for auto 
backport to work.  It seems convenient to have separate issues for each 
whatsnew/ file.

--
assignee: terry.reedy
messages: 411438
nosy: terry.reedy
priority: normal
severity: normal
status: open
title: IDLE subsection of What's New 3.11
versions: Python 3.11

___
Python tracker 

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



[issue41846] IDLE subsection of What's New 3.10

2022-01-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.11

___
Python tracker 

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



[issue41844] IDLE subsection of What's New 3.9

2022-01-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.11

___
Python tracker 

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



[issue46490] Add "follow_symlinks=False" support for "os.utime()" on Windows

2022-01-23 Thread Eryk Sun


Eryk Sun  added the comment:

The Windows API doesn't directly support opening a 'symlink' as Python defines 
it for the follow_symlinks parameter. That problem should be resolved in a 
separate issue. Then updating os.utime() would be relatively trivial.

--
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware
stage:  -> needs patch
type:  -> enhancement

___
Python tracker 

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



[issue33822] IDLE subsection of What's New 3.8

2022-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Backports to 3.8 ended when it went on security status about June 1, 2021.

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



[issue45193] IDLE Show completions pop-up not working on Ubuntu Linux

2022-01-23 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +29025
pull_request: https://github.com/python/cpython/pull/28332

___
Python tracker 

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



[issue46494] Mention typing_extensions in the typing documentation

2022-01-23 Thread Alex Waygood


Alex Waygood  added the comment:

Sounds like a great idea. I like the idea of putting it in the "Relevant PEPs" 
section, as that section already details how the typing module has evolved over 
the past few major versions of Python.

--

___
Python tracker 

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



[issue46494] Mention typing_extensions in the typing documentation

2022-01-23 Thread Jelle Zijlstra


New submission from Jelle Zijlstra :

I've often seen people say things like "I can't use TypeGuard yet, I'm stuck on 
3.9". That's not true, because the typing_extensions package backports all 
typing features to all supported Python versions.

To help make people aware of this option, we should mention typing_extensions 
in https://docs.python.org/3.10/library/typing.html.

Perhaps this can go in the "Relevant PEPs" section, or at the end of the intro 
section.

Suggested wording:

"New features have been added to the typing module in each major version of 
Python. The typing extensions (link to GitHub) package provides backports to 
all supported versions of Python 3 for almost all of these features."

--
assignee: docs@python
components: Documentation
messages: 411434
nosy: AlexWaygood, Jelle Zijlstra, docs@python, gvanrossum, kj, sobolevn, 
srittau
priority: normal
severity: normal
status: open
title: Mention typing_extensions in the typing documentation
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46480] Implement typing.assert_type

2022-01-23 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


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

___
Python tracker 

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



[issue40674] Deprecate urllib.request.urlretrieve() and cleanup()

2022-01-23 Thread Irit Katriel


New submission from Irit Katriel :

Remi, there is no background for this here or on the PR. Can you explain the 
reason for deprecating them?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue42091] strftime returns empty string for -d, -I 3.8.3

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


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



[issue40356] OverflowError: mktime argument out of range

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

3.7 is no longer maintained. I was unable to reproduce this on 3.11 on windows 
or Mac.  Please create a new issue if you are still seeing this on a current 
version.

--
nosy: +iritkatriel
resolution:  -> works for me
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue34429] [doc] On Windows tempfile.TemporaryFile behaves like NamedTemporaryFile

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

The docs and the code are the same now. I would add just the first half of the 
suggested sentence:

"On platforms that are neither Posix nor Cygwin, TemporaryFile behaves exactly 
like NamedTemporaryFile".

--
keywords: +easy
nosy: +iritkatriel
title: On Windows tempfile.TemporaryFile behaves like NamedTemporaryFile -> 
[doc] On Windows tempfile.TemporaryFile behaves like NamedTemporaryFile
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.6, Python 
3.7, Python 3.8

___
Python tracker 

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



[issue40771] Add a platform neutral version of localtime/gmtime

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
title: python3 fromtimestamp generates OSError -> Add a platform neutral 
version of localtime/gmtime
type: behavior -> enhancement
versions: +Python 3.11 -Python 3.10

___
Python tracker 

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



[issue46475] typing.Never and typing.assert_never

2022-01-23 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


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

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2022-01-23 Thread Tim Peters


Tim Peters  added the comment:

OK, here's the last version I had. Preconditions are that d > 0, n > 0, and n % 
d == 0.

This version tries to use the narrowest possible integers on each step. The 
lowermost `good_bits` of dinv at the start of the loop are correct already.

Taking out all the modular stuff, the body of the loop boils down to just

dinv *= 2 - dinv * d

For insight, if

dinv * d = 1 + k*2**i

for some k and i (IOW, if dinv * d = 1 modulo 2**i), then

2 - dinv * d = 1 - k*2**i

and so dinv times that equals 1 - k**2 * 2**(2*i). Or, IOW, the next value of 
dinv is such that d * dinv = 1 modulo 2**(2*i) - it's good to twice as many 
bits.

def ediv(n, d):
assert d

def makemask(n):
return (1 << n) - 1

if d & 1 == 0:
ntz = (d & -d).bit_length() - 1
n >>= ntz
d >>= ntz
bits_needed = n.bit_length() - d.bit_length() + 1
good_bits = 3
dinv = d & 7
while good_bits < bits_needed:
twice = min(2 * good_bits, bits_needed)
twomask = makemask(twice)
fac2 = dinv * (d & twomask)
fac2 &= twomask
fac2 = (2 - fac2) & twomask
dinv = (dinv * fac2) & twomask
good_bits = twice
goodmask = makemask(bits_needed)
return ((dinv & goodmask) * (n & goodmask)) & goodmask

--

___
Python tracker 

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



[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Barry Schwartz


Barry Schwartz  added the comment:

I meant constant bounded

--

___
Python tracker 

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



[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Tim Peters


Tim Peters  added the comment:

I'm not inclined to change anything here. It's a trivial point, and by 
"primitive" I had in mind a dedicated hardware instruction, blazing fast. Yes, 
I was aware of long-winded ways of doing it for specific fixed integer widths. 
But that's not what `O(1)` means. A dead obvious loop testing each bit, one at 
a time, starting with the MSB, until finding the first bit set, is also O(1) 
for any fixed-width int size.

So I'm not doing anything here. If someone else creates a PR with text they 
want to see instead, I'll review it, and if it's not unbearably pedantic ;-) 
I'll merge it.

--

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2022-01-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> But I won't post code (unless someone asks)

Okay, I'll ask.

--

___
Python tracker 

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



[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Barry Schwartz


Barry Schwartz  added the comment:

Yes. Actually the issue is branching, not order of complexity, because looping 
at most 64 times is a linear-bounded operation. The methods I point out involve 
no branching! And so can be rather fast. I don't suggest they be used, but that 
the listsort.txt be revised.

--

___
Python tracker 

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



[issue5404] Cross-compiling CPython - need a buildbot

2022-01-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
title: Cross-compiling Python -> Cross-compiling CPython - need a buildbot
versions: +Python 3.11 -Python 3.4

___
Python tracker 

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



[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Presumably the OP is referring to this text:

"""
`powerloop()` emulates these divisions, 1 bit at a time, using comparisons,
subtractions, and shifts in a loop.

You'll notice the paper uses an O(1) method instead, but that relies on two
things we don't have:

- An O(1) "count leading zeroes" primitive. We can find such a thing as a C
  extension on most platforms, but not all, and there's no uniform spelling
  on the platforms that support it.

- Integer division on an integer type twice as wide as needed to hold the
  list length. But the latter is Py_ssize_t for us, and is typically the
  widest native signed integer type the platform supports.

But since runs in our algorithm are almost never very short, the once-per-run
overhead of `powerloop()` seems lost in the noise.

"""

--
assignee: docs@python -> tim.peters
nosy: +rhettinger

___
Python tracker 

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



[issue46486] Rename DesciptorClassification => DescriptorClassification in specialize.c

2022-01-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for noticing this and submitting a PR.

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



[issue46486] Rename DesciptorClassification => DescriptorClassification in specialize.c

2022-01-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d1beb241d9bdf912682bc8323a59c052f99b82a8 by Kumar Aditya in 
branch 'main':
bpo-46486: Fixed misspelled name DesciptorClassification
https://github.com/python/cpython/commit/d1beb241d9bdf912682bc8323a59c052f99b82a8


--
nosy: +rhettinger

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I would really like this to be left alone.  We've been without a reliable 
version for over a decade.  That is strong evidence that we really don't need 
this unless it can be done perfectly (which it can't).  

Also, PyMapping_Check is just a CPython specific optimization (and a flawed 
one).  Because it can't be made completely reliable, we should not encourage 
people to use it, nor should we enshrine it in the stable API.

And if a modification can potentially break long stable code (such as that it 
the re module), then we absolutely shouldn't do it. x

Further, there is a general design issue.  Abstract base classes were invented 
to solve this specific problem (distinguishing mappings from sequences).  ABCs 
(and typing) are a now well established practice, and it is foolish to try to 
do an end run around using them.

I am strongly opposed to this going forward and request that a PEP be made if 
it is pursued further.   It is an SC level decision to allow stable code to be 
broken, to guarantee a CPython specific API for something that cannot be made 
correct in the general case, and to bypass the intended way to do it.

If the core concern is that isinstance() checks for ABCs are too slow, then 
efforts should be made to optimize them rather than creating an unreliable, 
CPython only alternative.

--

___
Python tracker 

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



[issue46476] Not all memory allocated by _Py_Quicken() is released at Python exit

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

> With the current design, it isn't possible though because the code objects 
> are modified in place so if co_quickened is freed the VM still tries to 
> execute the copied instructions.

Or the cleanup code could also restore co_firstinstr and other things that are 
set by quickened (the co_quickened flag and what else?).

Kumar, I'm not sure I follow your concerns about the bootstrap working 
differently on Windows than on Unix. Is the problem that on Unix the bootstrap 
interpreter is linked without deepfreeze.c so there is no definition of the 
symbol _Py_Deepfreeze_Fini? In that case, you can probably just add a dummy one 
to _bootstrap_python.c.

--

___
Python tracker 

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



[issue46493] Add an API to indicate if the process might have multiple threads

2022-01-23 Thread Gregory P. Smith


New submission from Gregory P. Smith :

It'd be handy to have a function to determine if there are multiple threads in 
the current process or not - at least on POSIXish systems.  This would be 
useful anytime a library is trying to use os.fork(), as fork() is not safe in a 
multi-threaded process.

Motivation: I want to _use_ this API to consider raising RuntimeWarnings in 
libraries that call fork() to highlight the problem to people attempting to use 
that code in multithreaded processes.

As POSIXy OSes don't usually have a simple API to get this information, one 
implementation such as this could make sense:

```
def is_process_multithreaded() -> bool:
"""Are there multiple threads in this process? OSError if no such OS API is 
available."""
threads = 0
ourself = str(os.gettid())
i_feel_seen = False
try:
# Linux, NetBSD, any others?
with os.scandir('/proc/self/task') as tasks:
for task_dir_entry in tasks:
# tid named subdirs should be the only thing that exists.
# We do a simple conformity check just in case.
if task_dir_entry.name.isdigit():
if task_dir_entry.name == ourself:
i_feel_seen = True
threads += 1
if i_feel_seen and threads > 1:
return True  # Multiple threads confirmed.
except EnvironmentError:
raise OSError('Unable to count threads on this platform.')
if i_feel_seen and threads == 1:
return False
else:
raise OSError(f'Unclear. Found {threads} in /proc/self/task and did not 
find ourself.')
```

macOS has mach darwin kernel APIs that can do this. Not well documented but 
they do work - 
https://stackoverflow.com/questions/21478229/how-to-count-number-of-alive-threads-in-ios

FreeBSD has APIs that can do this (see FreeBSD usr.bin/procstat/ source).

configure.ac checks and an extension module would be needed to integrate those.

My use case is not relevant to Windows (a platform unburdened by fork) but 
Windows APIs to answer the question exist if anyone has a reason to want this 
there as well - 
https://stackoverflow.com/questions/3749668/how-to-query-the-thread-count-of-a-process-using-the-regular-windows-c-c-apis

--
components: Library (Lib)
messages: 411420
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: Add an API to indicate if the process might have multiple threads
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue46471] use global singletons for single byte bytes objects in deepfreeze

2022-01-23 Thread Guido van Rossum


Change by Guido van Rossum :


--
resolution:  -> fixed
stage: patch review -> 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



[issue46449] Deep-freezed modules create inconsistency in sys.gettotalrefcount() (_Py_Reftotal)

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

@Kumar do you want to tackle this?

--
nosy: +kumaraditya303

___
Python tracker 

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



[issue46479] Implement typing.reveal_locals

2022-01-23 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


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

___
Python tracker 

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



[issue46457] test_unittest: TestAsyncCase.test_debug_cleanup_same_loop() hangs with gc.set_threshold(500)

2022-01-23 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
assignee:  -> asvetlov

___
Python tracker 

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



[issue46491] typing: allow Annotated in outermost scope

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

+1--
--Guido (mobile)

--

___
Python tracker 

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



[issue45868] xattr support missing in os module under cygwin

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

There isn't currently a maintainer for cpython on cygwin. If someone volunteers 
for this, they can go through the issues listed at the bottom of issue45537.

--
resolution: not a bug -> wont fix
stage:  -> resolved
status: open -> closed
superseder:  -> Cygwin is unsupported - close all open issues and list them 
here.

___
Python tracker 

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



[issue46492] BrokenPipeError when piping to head (linux)

2022-01-23 Thread Roy Assis


Roy Assis  added the comment:

Resolution in this post:
https://stackoverflow.com/questions/26692284/how-to-prevent-brokenpipeerror-when-doing-a-flush-in-python/26738736

code was changed to:

#sample.py
import sys
from time import sleep

try:
for line in sys.stdin:
print(line, flush=True)
sleep(2)
except:
sys.stderr.close()
pass

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



[issue45868] xattr support missing in os module under cygwin

2022-01-23 Thread Oskar Enoksson


Oskar Enoksson  added the comment:

Perhaps it could be supported under cygwin though without too much effort? Most 
likely just a configuration fix?

After all, cygwin is a sort of linux ...

--
status: pending -> open

___
Python tracker 

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



[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.11 -Python 3.8

___
Python tracker 

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



[issue45868] xattr support missing in os module under cygwin

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

This is listed in the docs as a linux-only feature:

https://docs.python.org/3/library/os.html#linux-extended-attributes

--
nosy: +iritkatriel
resolution:  -> not a bug
status: open -> pending
type: crash -> behavior

___
Python tracker 

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



[issue34697] ctypes: Crash if manually-created CField instance is used

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue42543] case sensitivity in open() arguments

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


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



[issue46492] BrokenPipeError when piping to head (linux)

2022-01-23 Thread Roy Assis


New submission from Roy Assis :

problem:
---
Python raises exception when piping to head. Exception is not caught by try 
except.

code:

#sample.py
import sys
from time import sleep

try:
for line in sys.stdin:
print(line, flush=True)
sleep(2)
except:
print("a")

Environment:
--
# Python 3.8.12 (default, Oct 12 2021, 13:49:34)
# [GCC 7.5.0] :: Anaconda, Inc. on linux
# (scanpyEnv3.8) aaa@IP111-11-1-111:~/scripts/short-python-scripts$ uname -srm
# Linux 5.4.0-1063-aws x86_64

code execution
--
# (scanpyEnv3.8) aaa@IP111-11-1-111:~/scripts/short-python-scripts$ echo "a a a 
a" | sed s'/ /\n/g' | python ./sample.py | head -3
# a
#
# a
# Exception ignored in: <_io.TextIOWrapper name='' mode='w' 
encoding='utf-8'>
# BrokenPipeError: [Errno 32] Broken pipe

--
components: IO
messages: 411413
nosy: royroy
priority: normal
severity: normal
status: open
title: BrokenPipeError when piping to head (linux)
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue38039] Segfault when pickling dictionary with large pandas dataframes

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> third party
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



[issue45298] SIGSEGV when access a fork Event in a spawn Process

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

Which python version and system are you seeing this on?

On 3.11 on a Mac I don't get a segfault but rather 

Process SpawnProcess-1:
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/process.py", line 
315, in _bootstrap
self.run()
^^
  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/process.py", line 
108, in run
self._target(*self._args, **self._kwargs)
^
  File "/Users/iritkatriel/src/cpython/tt.py", line 6, in wait_for_event
while not event.is_set():
  ^^
  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/synchronize.py", 
line 328, in is_set
with self._cond:

  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/synchronize.py", 
line 230, in __enter__
return self._lock.__enter__()
   ^^
  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/synchronize.py", 
line 95, in __enter__
return self._semlock.__enter__()
   ^
OSError: [Errno 9] Bad file descriptor


--
nosy: +iritkatriel

___
Python tracker 

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



[issue41403] Uncaught AttributeError in unittest.mock._get_target

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


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



[issue41403] Uncaught AttributeError in unittest.mock._get_target

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 1398dca838529e682c06b496cc1911d91334ff3a by Irit Katriel in 
branch '3.9':
bpo-41403: Improve error message for invalid mock target (GH-30833) (GH-30835)
https://github.com/python/cpython/commit/1398dca838529e682c06b496cc1911d91334ff3a


--

___
Python tracker 

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



[issue41403] Uncaught AttributeError in unittest.mock._get_target

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset e3ade66ec575e0cb4882cfdff155ef962e67c837 by Irit Katriel in 
branch '3.10':
bpo-41403: Improve error message for invalid mock target (GH-30833) (GH-30834)
https://github.com/python/cpython/commit/e3ade66ec575e0cb4882cfdff155ef962e67c837


--

___
Python tracker 

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



[issue33936] OPENSSL_VERSION_1_1 never defined in _hashopenssl.c

2022-01-23 Thread Christian Heimes


Christian Heimes  added the comment:

Yes, it's fixed.

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



[issue46435] MessageID parser raises IndexError: string index out of range

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
title: MessageID parser can crash with IndexError: string index out of range -> 
MessageID parser raises IndexError: string index out of range
type: crash -> behavior
versions: +Python 3.11

___
Python tracker 

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



[issue22211] Remove VMS specific code in expat.h & xmlrole.h

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> third party
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



[issue32343] Leak Sanitizer reports memory leaks while building using ASAN

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

Python 3.7 is not longer maintained, so it is unlikely that anyone will look at 
these. Please create a new issue if you are seeing this problem on a current 
version.

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue40250] unable to comment out r'\u' string with triple quote marks

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


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



[issue30053] Problems building with --enable-profiling on macOS using homebrew GCC

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

3.7 is no longer maintained. Please create a new issue if you are having this 
problem with a current version (>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue37080] Cannot compile Python3.7.3 on Alt-F (ARM)

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

3.7 is no longer maintained. Please create a new issue if you are having this 
problem with a current version (>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue46491] typing: allow Annotated in outermost scope

2022-01-23 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

I support making this change. It looks like the simplest implementation is 
simply to remove the mention of ClassVar and Final in typing._type_check.

--
components: +Library (Lib)
nosy: +Jelle Zijlstra, gvanrossum, kj

___
Python tracker 

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



[issue46491] typing: allow Annotated in outermost scope

2022-01-23 Thread Gregory Beauregard


New submission from Gregory Beauregard :

Currently, `typing.Annotated` (PEP 593) cannot be used at runtime with 
`typing.Final` and `typing.ClassVar` with `Annotated` on the outside:

```
from typing import Annotated, Final
# TypeError: typing.Final[int] is not valid as type argument
var: Annotated[Final[int], "foo"] = 4
```

The only tenuously related mention of this I can find in a PEP is in PEP 593 
(Annotated) which states "The first argument to Annotated must be a valid type".

I believe the runtime behavior should be changed to allow any ordering for 
`Annotated` with `ClassVar` and `Final`. This was discussed in the typing-sig 
PEP 655 thread (TypedDict `Required` and `NotRequired`) where the current plan 
is to allow `Required`/`NotRequired` in any nesting order with `Annotated` 
while suggesting the `ClassVar`/`Final` ordering restriction be lifted: 
https://mail.python.org/archives/list/typing-...@python.org/message/22CJ5TJGIJ563D6ZKB7R3VUZXTZQND5X/

The argument for doing so is on the mailing list: 
https://mail.python.org/archives/list/typing-...@python.org/message/MPMOIBX3XFXCD4ZNDC6AV4CLSI5LN544/

To summarize: adopting an overly strict view of what constitutes a valid type 
for `Annotated` creates difficulties for people who use runtime introspection 
of `Annotated` annotations by requiring them to parse additional typing or 
field annotations (https://bugs.python.org/msg411067). This needlessly 
exacerbates tension between typing and non-typing uses of annotation space. In 
order to be a good citizen to other annotation users, the `Annotated` runtime 
ordering restriction should be lifted.

--
messages: 411404
nosy: GBeauregard
priority: normal
severity: normal
status: open
title: typing: allow Annotated in outermost scope
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue41603] Compilation issue 3.8.5 with Redhat 7.8 and gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

Please create a new issue if you are seeing this problem on a supported version 
(>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue39708] final link stage in compile fails for 3.8.1 with missing CFLAGS

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

Version 3.8 is no longer maintained. Please create a new issue if you are 
having this problem on a current version (>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue39731] ModuleNotFoundError: No module named '_ctypes'

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> third party
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



[issue37886] PyStructSequence_UnnamedField not exported

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> PyStructSequence_UnnamedField unavailable on Windows

___
Python tracker 

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



[issue46449] Deep-freezed modules create inconsistency in sys.gettotalrefcount() (_Py_Reftotal)

2022-01-23 Thread Christian Heimes


Christian Heimes  added the comment:

If you modify the freeze_modules script to generate code like 
https://github.com/python/cpython/compare/main...tiran:split_frozen?expand=1 , 
then I can add a build option to compile Python with only required frozen 
modules.

--

___
Python tracker 

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



[issue41403] Uncaught AttributeError in unittest.mock._get_target

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +29021
pull_request: https://github.com/python/cpython/pull/30835

___
Python tracker 

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



[issue41403] Uncaught AttributeError in unittest.mock._get_target

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +29020
pull_request: https://github.com/python/cpython/pull/30834

___
Python tracker 

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



[issue41403] Uncaught AttributeError in unittest.mock._get_target

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset f7955a82e36d4c32ebdd7b7707cdf0e6ffa7a418 by Irit Katriel in 
branch 'main':
bpo-41403: Improve error message for invalid mock target (GH-30833)
https://github.com/python/cpython/commit/f7955a82e36d4c32ebdd7b7707cdf0e6ffa7a418


--

___
Python tracker 

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



[issue46490] Add "follow_symlinks=False" support for "os.utime()" on Windows

2022-01-23 Thread Delgan


New submission from Delgan :

Hi.

Currently, trying to use "os.utime(path, timestamps, follow_symlinks=False)" 
raises a exception on Windows: "NotImplementedError: utime: follow_symlinks 
unavailable on this platform".

Looking at the Win32 API it seems possible to open a symbolic link by 
specifying the "FILE_FLAG_OPEN_REPARSE_POINT" flag: 
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew#symbolic-link-behavior

Do you think it would be possible to update "os.utime()" implementation and 
optionally pass the flag here: 
https://github.com/python/cpython/blob/ca78130d7eb5265759697639e42487ec6d0a4caf/Modules/posixmodule.c#L5516
 ?

--
components: Library (Lib)
messages: 411399
nosy: Delgan
priority: normal
severity: normal
status: open
title: Add "follow_symlinks=False" support for "os.utime()" on Windows
versions: Python 3.11

___
Python tracker 

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



[issue46471] use global singletons for single byte bytes objects in deepfreeze

2022-01-23 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Can we close this, or are you expecting more changes?

--
nosy: +erlendaasland
status: open -> pending

___
Python tracker 

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



[issue27954] makesetup does not take into account subdirectories

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

David, is this still an issue on current versions? Can you spell out the 
precise steps to reproduce the problem?

--
nosy: +iritkatriel
status: open -> pending

___
Python tracker 

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



[issue46489] webbrowser crashes Ubuntu kernel

2022-01-23 Thread Danylo


New submission from Danylo :

I've been hunting this problem for half a year already. With other hypotheses 
rejected - Linux issue, old PC, PyCharm bug, bad luck, - the webbrowser Python 
lib supposedly makes the Ubuntu kernel panic.

Either from a terminal or within PyCharm (happens on both), I run

```
controller = webbrowser.get('google-chrome')
for link in links_list:  # up to 10 items
controller.open(link)
time.sleep(1)
```

and the system crashes (hangs until a hard or soft reset) after several web 
pages are opened in my Chrome browser as the result of running the program.

All the details you'll find at 
https://askubuntu.com/questions/1370213/ubuntu-hangs-and-becomes-unresponsive-until-reset.
 I first thought it's something wrong with Ubuntu, and I opened a question on 
the forum.

The only detail I've not added there is that after each crash I can move the 
mouse on the screen but cannot interact with anything. That thing always 
puzzled me.

I can neither say the website I'm running the webbrowser nor test it on other 
domains - the issue happens sporadically, once in several hours of me opening 
and closing a Chrome browser controlled by the webbrowser lib.

Python 3.9.7, installed with Anaconda. I've tried older versions of Python.

Ubuntu 20.04 LTS.

--
components: Library (Lib)
messages: 411396
nosy: dizcza
priority: normal
severity: normal
status: open
title: webbrowser crashes Ubuntu kernel
type: crash
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



[issue24046] Incomplete build on AIX

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

2.7 is no longer maintained. Please create new issues for build problems on 
current versions (>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue30510] c_bool type not supported for BigEndianStructure on little-endian machine

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11:

>>> from ctypes import *
>>> class r( BigEndianStructure ):
... _fields_ = [( "d0", c_uint32),
... ( "d1", c_bool )
...  ]
... 
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/iritkatriel/src/cpython-654/Lib/ctypes/_endian.py", line 31, in 
__setattr__
fields.append((name, _other_endian(typ)) + rest)
 ^^
  File "/Users/iritkatriel/src/cpython-654/Lib/ctypes/_endian.py", line 21, in 
_other_endian
raise TypeError("This type does not support other endian: %s" % typ)

TypeError: This type does not support other endian: 

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 2.7

___
Python tracker 

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



[issue46436] Pass the -d/--directory command-line option to http.server.CGIHTTPRequestHandler

2022-01-23 Thread Géry

Géry  added the comment:

Thanks for mentioning this issue @merwok.

As you pointed out, function `test` in module 
[`http.server`](https://github.com/python/cpython/blob/main/Lib/http/server.py) 
expects a real request handler class argument (`SimpleHTTPRequestHandler` or 
`CGIHTTPRequestHandler`), not a partial object 
`partial(SimpleHTTPRequestHandler, directory=args.directory)` or 
`partial(CGIHTTPRequestHandler, directory=args.directory)`, so that the 
assignment of `protocol_version` class attribute in test is not ignored.

The partial object in the `if __name__ == '__main__'` branch of module 
`http.server` was introduced in the first place to pass the directory argument 
to the request handler class’s `__init__` method called in method 
`BaseServer.finish_request` of module 
[`socketserver`](https://github.com/python/cpython/blob/main/Lib/socketserver.py):

def finish_request(self, request, client_address):
"""Finish one request by instantiating RequestHandlerClass."""
self.RequestHandlerClass(request, client_address, self)

But `BaseServer.finish_request` is a factory method of `BaseServer` (the 
abstract creator) so it is *designed* to be overridden in subclasses to 
customize the instantiation of the request handler class `BaseRequestHandler` 
(the abstract product). So the proper way to instantiate 
`SimpleHTTPRequestHandler` and `CGIHTTPRequestHandler` with the `directory` 
argument is to override `BaseServer.finish_request`.

I have just updated my PR to implement this. It fixes both 
[#46285](https://bugs.python.org/issue46285) and 
[#46436](https://bugs.python.org/issue46436).

--

___
Python tracker 

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



[issue46285] protocol_version in http.server.test can be ignored

2022-01-23 Thread Géry

Géry  added the comment:

Thanks Hugo for opening this issue and Éric for inviting me.

As you guys pointed out, function test in module http.server expects a real 
handler class argument (SimpleHTTPRequestHandler or CGIHTTPRequestHandler), not 
a partial object partial(SimpleHTTPRequestHandler, directory=args.directory) or 
partial(CGIHTTPRequestHandler, directory=args.directory), so that the 
assignment of protocol_version class attribute in test is not ignored.

The partial object in the if __name__ == '__main__' branch of module 
http.server was introduced in the first place to pass the directory argument to 
the handler class’s __init__ method called in method BaseServer.finish_request:

def finish_request(self, request, client_address):
"""Finish one request by instantiating RequestHandlerClass."""
self.RequestHandlerClass(request, client_address, self)

But finish_request is a factory method of BaseServer (the abstract creator) so 
it is DESIGNED to be overridden in subclasses to customize the instantiation of 
the handler class BaseRequestHandler (the abstract product). So the proper way 
to instantiate SimpleHTTPRequestHandler and CGIHTTPRequestHandler with the 
directory argument is to override BaseServer.finish_request.

That is what I have just did by updating my PR here: 
https://github.com/python/cpython/pull/30701/commits/fc7f95f9d270a8a83cb2fd6d51eb0f904b85e0d9

It fixes both #46285 and #46436.

--

___
Python tracker 

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



[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2022-01-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5

___
Python tracker 

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



[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2022-01-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 94d6434ba7ec3e4b154e515c5583b0b665ab0b09 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash 
(GH-30283) (GH-30738)
https://github.com/python/cpython/commit/94d6434ba7ec3e4b154e515c5583b0b665ab0b09


--

___
Python tracker 

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



[issue38472] GCC detection in setup.py is broken

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
resolution: out of date -> 
versions:  -Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue46471] use global singletons for single byte bytes objects in deepfreeze

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset ca78130d7eb5265759697639e42487ec6d0a4caf by Kumar Aditya in 
branch 'main':
bpo-46471: Use single byte singletons (GH-30781)
https://github.com/python/cpython/commit/ca78130d7eb5265759697639e42487ec6d0a4caf


--

___
Python tracker 

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



[issue46103] inspect.getmembers will call the instance __bases__ attribute, which may cause an exception

2022-01-23 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 691506f4e9408a1205166f99640946ad7822e302 by Weipeng Hong in 
branch 'main':
bpo-46103: Fix inspect.getmembers to only get __bases__ from class (GH-30147)
https://github.com/python/cpython/commit/691506f4e9408a1205166f99640946ad7822e302


--

___
Python tracker 

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



[issue41403] Uncaught AttributeError in unittest.mock._get_target

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 6.0 -> 7.0
pull_requests: +29019
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30833

___
Python tracker 

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



[issue38472] GCC detection in setup.py is broken

2022-01-23 Thread Alex Grund


Alex Grund  added the comment:

Yes this is still an issue.

I'm trying to compile Python on an HPC system which uses modules (see e.g. 
LMod).

Yes with LC_ALL=C it does write "gcc version 9.1.0 ..."

--
status: pending -> open

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is difficult to distinguish Mapping from Sequence because they have the same 
set of dunder methods. The difference is only in semantic -- __iter__ yields 
items for Sequence and keys for Mapping, __getitem__ gets an item by index (or 
a sequence by slice) for Sequence and value by key for Mapping. But semantic 
cannot be tested here.

In these cases when both Sequence and Mapping are accepted but handled 
differently (like in the dict constructor) we test for existence of the "keys" 
method. It is not good, because it is not a dunder method, and therefore should 
be looked up at instance, not only at a type.

--

___
Python tracker 

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



[issue41682] [Windows] test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving failure

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'm wondering if the test is faulty. It seems to call EventLoop.sendfile() with 
a file that is 8K + 1 byte long,
and the protocol is instructed to close after 1K bytes have been written, but 
it seems to try to send as much of the file as it can.
Could it be that on Win22 the primitive used (TransmitFile) has an internal 
minimum buffer size that exceeds this file size, so the first call sends the 
whole file and there's no error?

@Andrew Svetlov, do you know enough of the internals of this code to validate 
my theory?

--
nosy: +gvanrossum

___
Python tracker 

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



  1   2   >