[issue45361] Provide a more convenient way to set an exception as "active", from Python code

2021-10-05 Thread Guido van Rossum


Guido van Rossum  added the comment:

Do you think the API you're looking for is available at the C level? Like 
PyErr_SetExcInfo()?

--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2021-10-05 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +27097
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28752

___
Python tracker 

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



[issue45330] dulwich_log performance regression in 3.10

2021-10-05 Thread Inada Naoki


Inada Naoki  added the comment:

I can not confirm performance regression between 33ec88ac and 23ae2c3b.

```
Performance version: 1.0.2
Python version: 3.10.0a7+ (64-bit) revision 33ec88ac81
Report on Linux-5.4.0-81-generic-x86_64-with-glibc2.31
Number of logical CPUs: 8
Start date: 2021-10-06 13:47:33.468553
End date: 2021-10-06 13:47:52.054876

### dulwich_log ###
Mean +- std dev: 99.7 ms +- 0.9 ms

Performance version: 1.0.2
Python version: 3.11.0a0 (64-bit) revision 23ae2c3bac
Report on Linux-5.4.0-81-generic-x86_64-with-glibc2.31
Number of logical CPUs: 8
Start date: 2021-10-06 13:47:07.767177
End date: 2021-10-06 13:47:26.175560

### dulwich_log ###
Mean +- std dev: 98.6 ms +- 0.9 ms
```

--
nosy: +methane

___
Python tracker 

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



[issue44998] macOS build test failure

2021-10-05 Thread Ned Deily


Ned Deily  added the comment:

> /Library/Developer/CommandLineTools/usr/bin/make build_all_merge_profile
> /usr/local/bin/llvm-profdata merge -output=code.profclangd *.profclangr

It looks like your build was trying to use a mixture of llvm tools, probably 
clang from the Apple-supplied Command Line Tools and llvm from /usr/local/bin, 
perhaps from some package manager like Homebrew. Use one or the other; we 
strongly recommend building with, and only test with, the Apple-supplied tool 
chains from either the most Xcode or Command Line Tools release for each macOS 
release.

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



Re: python.exe - System Error

2021-10-05 Thread Dan Stromberg
Hi.

You'll likely get more help if you include more context, like more text in
your cut and paste.

Also, how did you install it?  And where did you get the installer from?

HTH.

On Thu, Sep 30, 2021 at 8:00 AM jitendrabeura001 
wrote:

>Hello Sir/Madam, please help me to out from this difficulties, whenever
>I'm trying to install python idle it is showing me the error called
>"[1]python.exe - System Error"**
>I have tried couple of ways to get rid out of this but failed every
> time,
>please please help me to find the exact solution for this problem. Thank
>You.
>
> References
>
>Visible links
>1. http://python.exe/
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45381] IDLE: "restart shell" while receiving output disables program

2021-10-05 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
stage:  -> needs patch
title: IDLE cannot kill process. "interupt" ctl+c and "restart shell" freeze 
program. -> IDLE: "restart shell" while receiving output disables program
versions: +Python 3.11 -Python 3.7

___
Python tracker 

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



[issue45381] IDLE cannot kill process. "interupt" ctl+c and "restart shell" freeze program.

2021-10-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

IDLE uses tk/tkinter text widgets for Editor and Shell windows.  A known 
downside of this is that long lines, greater than about 2000 chars, slow down 
scrolling. See #1442493 for instance.

Part of the Squeezer feature was meant to alleviate this by squeezing long 
lines as well as many lines.  This was meant to be documented but the main 
sentence is garbled a bit and needs to be rewritten.  Squeezer can be partly 
deactivated by raising the threshhold to, for instance, 1_000_000_000.

Another feature of IDLE is that is executes user code in a separate process, 
sending user code output back to the GUI process through a socket.  Massive 
amounts of output are noticeably slower than in the terminal/console.  This can 
be eliminated by starting IDLE with -n.

On my machine, 'a'*n takes about 1 second per 133_333 chars, or 12 for 1.6M.  
160M would take 1200 seconds or 20 minutes.  This of course, has nothing to do 
with any normal use of IDLE.

Keyboard Interrupt, Ctrl-C: It is a known CPython (not IDLE) issue (discussed 
on the tracker) that this does not always interrupt execution of user code.  
This may depend on the OS.  On my machine, I see

'a'*1_600_000  # hit ^C during 12 second wait.
[Squeezed text (20001 lines.)] Traceback (most recent call last):
  File "", line 1, in 
'a'*1_600_000
KeyboardInterrupt

This is not supposed to terminate the execution process, but merely to end 
execution of the statement.  A prompt for another statement should be and for 
me is displayed.  For me, following the above with restart Ctrl-F6 works 
normally.

However, Restart during the wait, with or without ^c, puts IDLE into a 
recoverable state.  Since Restart during time.sleep or 'while True: pass' work, 
I suspect the issue is restarting while receiving input.

--
nosy: +taleinat

___
Python tracker 

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



[issue40321] urllib.request does not support HTTP response status code 308

2021-10-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27096
pull_request: https://github.com/python/cpython/pull/28751

___
Python tracker 

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



[issue40321] urllib.request does not support HTTP response status code 308

2021-10-05 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue40321] urllib.request does not support HTTP response status code 308

2021-10-05 Thread Senthil Kumaran


Senthil Kumaran  added the comment:


New changeset c379bc5ec9012cf66424ef3d80612cf13ec51006 by Jochem Schulenklopper 
in branch 'main':
bpo-40321: Support HTTP response status code 308 in urllib.request (#19588)
https://github.com/python/cpython/commit/c379bc5ec9012cf66424ef3d80612cf13ec51006


--

___
Python tracker 

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



[issue45385] Fix possible reference leak from descr_check

2021-10-05 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue45385] Fix possible reference leak from descr_check

2021-10-05 Thread Dong-hee Na


New submission from Dong-hee Na :

Report from @kj: 
https://github.com/python/cpython/pull/28719#discussion_r721249643

--
components: Interpreter Core
messages: 403282
nosy: corona10, kj, vstinner
priority: normal
severity: normal
status: open
title: Fix possible reference leak from descr_check
type: enhancement
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



[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-05 Thread Ian Fisher


Ian Fisher  added the comment:

Okay, I started a discussion here: 
https://discuss.python.org/t/fixing-sqlite-timestamp-converter-to-handle-utc-offsets/10985

--

___
Python tracker 

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



[issue45357] Idle does not check user config for extention configuration

2021-10-05 Thread CoolCat467


Change by CoolCat467 :


--
nosy: +taleinat, terry.reedy

___
Python tracker 

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



RE: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread Avi Gross via Python-list
Dave,

Just one point.

many things are allowed by a language even if normal people would NOT have
any reason to do it NOR should use it.

Although when used in one context + and - can be considered unary operators,
the evaluation may result in successive unary operations being done one
after another. Here are examples I just typed:

+1
1
+1
1
+-+-+-1
-1
---1
-1
--1
1

Luckily since Python has no ++ or -- pre or post operators, these are legal,
albeit a tad weird.



-Original Message-
From: Python-list  On
Behalf Of dn via Python-list
Sent: Tuesday, October 5, 2021 7:11 PM
To: python-list@python.org
Subject: Re: Understanding the working mechanis of python unary arithmetic
operators.

On 06/10/2021 10.10, Chris Angelico wrote:
> On Wed, Oct 6, 2021 at 7:52 AM hongy...@gmail.com 
wrote:
>>
>> On Saturday, October 2, 2021 at 4:59:54 PM UTC+8, ju...@diegidio.name
wrote:

This thread seems to have been very one-sided. Either I've forgotten
selective use of the DEL-key, or the above contributor has been forgetting
to reply to the list (or didn't intend contribution?) Please share your
knowledge with all!


>>> On Saturday, 2 October 2021 at 10:34:27 UTC+2, hongy...@gmail.com wrote:

> If bool(a) is True, then ~bool(a) is exactly the same as writing 
> ~True, and a has become irrelevant. That is simply how expression 
> evaluation works.

@Chris and I presented at a recent PUG meeting on the subject of
'operators'.
(I was the 'warm-up act', @Chris the 'star'...)

I covered unary operators
(https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-b
itwise-operations)
- and very briefly, because that's proportional to their application 'in the
real world'. Negation is sometimes used, binary inversion very occasionally,
but the 'unary plus' almost never!

Thus:

>>> a = 3
>>> +a
3
>>> -a
-3

Why would one use the plus operator?

Particularly when it confuses some, ie if negation changes the sign, won't
the unary-plus?

>>> b = -3
>>> +b
-3
>>> -b
3

What has the unary-plus achieved in either/both of these cases? Not much,
but may not be doing something that was 'expected'!

The bitwise inversion (~) is also widely misunderstood (just like the story
of my life). It is not "bit inversion", as in, a single bit being
inverted:
(values here are expressed in base-2!)

~0 -> 1
~1 -> 0

Instead, it involves the inversion of every bit. Thus, if we are talking
about a nibble/nybble (because I'm too lazy to type more binary digits):

~ -> 
~0001 -> 1110

which accounts for the problem discussed earlier in the thread.

To make things work the way you seemed to imagine:

~ ->  # and thus, is False
~ ->  # and thus, is True

ie a bitwise inter-change that works binary ints and booleans.


Where some (other) thinking may have come-adrift from Python's model, is the
mixing of objects/types, eg the 'truthiness' of any integer other than 0.
Also, whilst coercion from one type to another may work satisfactorily in
one 'direction', it may not be so amenable in reverse.


Another bemusing (OP) point was the concept of "-+~1". I'd never, ever,
think of doing that! Hey, maybe that says something about me?

The term "unary operator" involves the word "one". Rather than "operator",
the "one" is the number of "operands". (yes, you know this) However, having
already talked about the infrequency with which unary-operators are
employed, the idea of nesting (is that the word?) a series of
unary-operators, almost blew my mind. Why? Please show an example
scenario...


Finally, there is the process of "over-loading" operators. Thus, "1 + 2"
translates to "add the value 2 to 1"; whereas "a" + "b" means "concatenate"
the two strings. In both cases, the result becomes a third value. When we
choose the correct terminology, the words for "+" are different - as are the
resultant processes!

We could also code "instance_a + instance_b". What does this mean?
Addition? Concatenation? Bitwise?

If I tell you that both are instances of MyClass, does that answer the
question?

The only way to work-out what craziness I hold in store, is to find where
MyClass is defined and look for the __add__() 'magic method'*. At which
point, you discover that the instance-attributes are split into components,
and the components merged together in a random sequence, with today's date
mixed-in for (no) good measure.

* or you could ask me
(although neither explanation will have a +impact on your mental health)


So, the fact that two object instances, eg an integer and a floating-point
number, both utilise the same operator-symbol, enables us to draw analogies
(and in this case, probably get it 100% correct), but this does not imply a
complete equivalence across-the-board (particularly when crazy-people are
let-loose with custom classes! Thus "a" + "b" should not be pronounced
"add", even though the operator looks very much like the one we use to add
two numbers!

For fun, and quickly now, what happens here:

2 + 2
2 + 

[issue45377] Default python 3 docs still pointing to 3.9.7

2021-10-05 Thread Eric V. Smith


Eric V. Smith  added the comment:

You should report this at https://github.com/python/pythondotorg/issues

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



Re: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread dn via Python-list
On 06/10/2021 10.10, Chris Angelico wrote:
> On Wed, Oct 6, 2021 at 7:52 AM hongy...@gmail.com  
> wrote:
>>
>> On Saturday, October 2, 2021 at 4:59:54 PM UTC+8, ju...@diegidio.name wrote:

This thread seems to have been very one-sided. Either I've forgotten
selective use of the DEL-key, or the above contributor has been
forgetting to reply to the list (or didn't intend contribution?) Please
share your knowledge with all!


>>> On Saturday, 2 October 2021 at 10:34:27 UTC+2, hongy...@gmail.com wrote:

> If bool(a) is True, then ~bool(a) is exactly the same as writing
> ~True, and a has become irrelevant. That is simply how expression
> evaluation works.

@Chris and I presented at a recent PUG meeting on the subject of
'operators'.
(I was the 'warm-up act', @Chris the 'star'...)

I covered unary operators
(https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations)
- and very briefly, because that's proportional to their application 'in
the real world'. Negation is sometimes used, binary inversion very
occasionally, but the 'unary plus' almost never!

Thus:

>>> a = 3
>>> +a
3
>>> -a
-3

Why would one use the plus operator?

Particularly when it confuses some, ie if negation changes the sign,
won't the unary-plus?

>>> b = -3
>>> +b
-3
>>> -b
3

What has the unary-plus achieved in either/both of these cases? Not
much, but may not be doing something that was 'expected'!

The bitwise inversion (~) is also widely misunderstood (just like the
story of my life). It is not "bit inversion", as in, a single bit being
inverted:
(values here are expressed in base-2!)

~0 -> 1
~1 -> 0

Instead, it involves the inversion of every bit. Thus, if we are talking
about a nibble/nybble (because I'm too lazy to type more binary digits):

~ -> 
~0001 -> 1110

which accounts for the problem discussed earlier in the thread.

To make things work the way you seemed to imagine:

~ ->  # and thus, is False
~ ->  # and thus, is True

ie a bitwise inter-change that works binary ints and booleans.


Where some (other) thinking may have come-adrift from Python's model, is
the mixing of objects/types, eg the 'truthiness' of any integer other
than 0. Also, whilst coercion from one type to another may work
satisfactorily in one 'direction', it may not be so amenable in reverse.


Another bemusing (OP) point was the concept of "-+~1". I'd never, ever,
think of doing that! Hey, maybe that says something about me?

The term "unary operator" involves the word "one". Rather than
"operator", the "one" is the number of "operands". (yes, you know this)
However, having already talked about the infrequency with which
unary-operators are employed, the idea of nesting (is that the word?) a
series of unary-operators, almost blew my mind. Why? Please show an
example scenario...


Finally, there is the process of "over-loading" operators. Thus, "1 + 2"
translates to "add the value 2 to 1"; whereas "a" + "b" means
"concatenate" the two strings. In both cases, the result becomes a third
value. When we choose the correct terminology, the words for "+" are
different - as are the resultant processes!

We could also code "instance_a + instance_b". What does this mean?
Addition? Concatenation? Bitwise?

If I tell you that both are instances of MyClass, does that answer the
question?

The only way to work-out what craziness I hold in store, is to find
where MyClass is defined and look for the __add__() 'magic method'*. At
which point, you discover that the instance-attributes are split into
components, and the components merged together in a random sequence,
with today's date mixed-in for (no) good measure.

* or you could ask me
(although neither explanation will have a +impact on your mental health)


So, the fact that two object instances, eg an integer and a
floating-point number, both utilise the same operator-symbol, enables us
to draw analogies (and in this case, probably get it 100% correct), but
this does not imply a complete equivalence across-the-board
(particularly when crazy-people are let-loose with custom classes! Thus
"a" + "b" should not be pronounced "add", even though the operator looks
very much like the one we use to add two numbers!

For fun, and quickly now, what happens here:

2 + 2
2 + 2.0
2.0 + 2
2.0 + 2.0
"2" + "2"
2 + "2"
"2" + 2

(they're all 'the same', except the last two?three - aren't they???)

-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-05 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> I'd be interested in working on this myself, if you think it's something that 
> a new CPython contributor could handle.

Please, go ahead :)

However, I think this should be discussed on Discourse first (open a topic in 
the Core Development category).

--

___
Python tracker 

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



[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-05 Thread Ian Fisher


Ian Fisher  added the comment:

> Another option could be to deprecate the current behaviour and then change it 
> to being timezone aware in Python 3.13.

This sounds like the simplest option.

I'd be interested in working on this myself, if you think it's something that a 
new CPython contributor could handle.

--

___
Python tracker 

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



[issue45384] Accept Final as indicating ClassVar for dataclass

2021-10-05 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue45384] Accept Final as indicating ClassVar for dataclass

2021-10-05 Thread Gregory Beauregard


Change by Gregory Beauregard :


--
type: enhancement -> behavior

___
Python tracker 

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



[issue45384] Accept Final as indicating ClassVar for dataclass

2021-10-05 Thread Gregory Beauregard


New submission from Gregory Beauregard :

PEP 591 for the Final Attribute states "Type checkers should infer a final 
attribute that is initialized in a class body as being a class variable. 
Variables should not be annotated with both ClassVar and Final."

This is a bit of a typing conflict for dataclasses, where ClassVar is used to 
indicate a desired library behavior, but one may want to indicate Final.

I propose accepting the Final attribute as an indicator of a ClassVar in 
dataclasses class bodies in order to be better compatible with the Final PEP.

There is at least one edge case that would need to be handled where someone 
might want to explicitly mark a dataclass field Final, which could be allowed 
as a field:
a: Final[int] = dataclasses.field(init=False, default=10)

--
components: Library (Lib)
messages: 403277
nosy: GBeauregard
priority: normal
severity: normal
status: open
title: Accept Final as indicating ClassVar for dataclass
type: enhancement

___
Python tracker 

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



[issue45343] Update bundled pip to 21.2.4 and setuptools to 58.1.0

2021-10-05 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks! ✨  ✨

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

___
Python tracker 

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



[issue45343] Update bundled pip to 21.2.4 and setuptools to 58.1.0

2021-10-05 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 1374459c9088725e022beab418bced96a825baad by Łukasz Langa in 
branch '3.9':
[3.9] bpo-45343: Update bundled pip to 21.2.4 and setuptools to 58.1.0 
(GH-28684) (GH-28747)
https://github.com/python/cpython/commit/1374459c9088725e022beab418bced96a825baad


--

___
Python tracker 

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



[issue45343] Update bundled pip to 21.2.4 and setuptools to 58.1.0

2021-10-05 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 325e4647afffe347cc20747f3dccc6ba9e782636 by Miss Islington (bot) 
in branch '3.10':
bpo-45343: Update bundled pip to 21.2.4 and setuptools to 58.1.0 (GH-28684) 
(GH-28746)
https://github.com/python/cpython/commit/325e4647afffe347cc20747f3dccc6ba9e782636


--

___
Python tracker 

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



[issue45383] PyType_FromSpec API fails to use metaclass of bases

2021-10-05 Thread Sebastian Berg


New submission from Sebastian Berg :

The PyType_FromSpec fails to take care about MetaClasses.

 https://bugs.python.org/issue15870

Asks to create a new API to pass in the MetaClass.  This issue is only about 
"inheriting" the metaclass of the bases correctly.  Currently, Python fails to 
take into account that the bases may be MetaClass and not `PyType_Type` 
instances.

--
components: C API, Interpreter Core
messages: 403273
nosy: petr.viktorin, seberg
priority: normal
pull_requests: 27093
severity: normal
status: open
title: PyType_FromSpec API fails to use metaclass of bases
type: crash
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



[issue45343] Update bundled pip to 21.2.4 and setuptools to 58.1.0

2021-10-05 Thread Łukasz Langa

Change by Łukasz Langa :


--
pull_requests: +27092
pull_request: https://github.com/python/cpython/pull/28747

___
Python tracker 

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



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +eryksun

___
Python tracker 

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



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:

> Hmm, but the "ver" output seems to have more information than those APIs.

It's always had build numbers, which the regular APIs do not, because the 
regular APIs are meant for detecting incompatibilities rather than reporting.

Since there are some incompatibilities, I hope they'll rev the minor version 
number, but I have no idea if that's planned yet. In theory I have early access 
to the release build already, but I haven't installed it on anything.

Eventually I think we're going to need some kind of WMI call in the platform 
module to get the right data for reporting. Until then, we're making best 
guesses from heuristics.

--
nosy:  -eryksun

___
Python tracker 

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



[issue45343] Update bundled pip to 21.2.4 and setuptools to 58.1.0

2021-10-05 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Eryk Sun


Eryk Sun  added the comment:

The _WIN32_CLIENT_RELEASES table based on major.minor version number isn't 
helpful since Windows 10 and 11 have the same version number. win32_ver() needs 
a workaround to return release "11" if the build number is 22000 or greater. Is 
there any need/desire to also identify Server 2016, 2019, and 2022?

--
nosy: +eryksun

___
Python tracker 

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



[issue45343] Update bundled pip to 21.2.4 and setuptools to 58.1.0

2021-10-05 Thread Łukasz Langa

New submission from Łukasz Langa :


New changeset 4c8d543823dde5a30615da61727837a48f7ab847 by Illia Volochii in 
branch 'main':
bpo-45343: Update bundled pip to 21.2.4 and setuptools to 58.1.0 (GH-28684)
https://github.com/python/cpython/commit/4c8d543823dde5a30615da61727837a48f7ab847


--
nosy: +lukasz.langa

___
Python tracker 

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



Re: Open a new window by mouse clicking in the QLineEdit field and not by clicking of a button

2021-10-05 Thread Barry


> On 5 Oct 2021, at 22:07, Mohsen Owzar  wrote:
> 
> Hi all,
> I'm looking for an approach, but couldn't find any appropriate answer to my 
> problem:
> On my GUI on a tablet, I have bunch of QlineEdit widgets for the settings of 
> my task.
> Because we have no keyboard connected to the tablet, I have put two buttons 
> ("+" and "-") around each QLineEdit widget to increase or decrease its value.
> When the target value is far away from the displayed one in the QLineEdit, I 
> have to click lots of times to reach the end value.
> Due to this ugliness feature, I wanted to offer to the user the possibility 
> to click in the edit field to get another window with a numeric keypad to 
> type the target value. And then by clicking an OK button, the new window will 
> be closed and the typed value will be taken into the QLineEdit widget of my 
> original GUI.
> In all my searches, I found examples to open new windows by clicking a button 
> and not by clicking in an edit field.

What I have done is use mouse move events to change values.
I touch the field then drag my finger to change the value.
I only use linear scaling but you could have code that can tell slow drag
from fast drag and scale the value.

> I used the following line to have an edit field on window1.
> 
>self.text_from_window2 = QLineEdit('Setting Value')
> 
> And wanted to open another window (window2) in which I programmed a numeric 
> keypad. By typing the desired value on this keypad and enter OK, this value 
> should be taken to the edit field of window1.
> But the following line brings an error that QLineEdit has no attribute 
> "clicked".
> 
>self.text_from_window2.clicked().connect(self.show_keypad_window)
> 
> I tried to use other attributes like focus, textChanged or textEdited. None 
> of them could help me.
> Is it at all possible to use QLineEdit with mouse click to generate an action 
> (open new window)?
> Has anyone an example of such a code snippet?
> I am very curious to see if someone has a solution to my problem.

By the way there is a great PyQt mailing list that you might like to join.

https://www.riverbankcomputing.com/mailman/listinfo/pyqt

Lots of knowledgeable PyQt developers hang out on that list.

Barry

> 
> Regards
> Mohsen
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45374] sqlite3: Add configure option to set or auto-detect rpath to sqlite3 libs

2021-10-05 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-05 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> [...] if sqlite3 starts returning aware datetimes, existing code might break.

True.

> [...] perhaps this could be fixed in conjunction with changing sqlite3's API 
> to allow per-database converters and adapters

Another option could be to deprecate the current behaviour and then change it 
to being timezone aware in Python 3.13.

--

___
Python tracker 

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



Re: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread Chris Angelico
On Wed, Oct 6, 2021 at 7:52 AM hongy...@gmail.com  wrote:
>
> On Saturday, October 2, 2021 at 4:59:54 PM UTC+8, ju...@diegidio.name wrote:
> > On Saturday, 2 October 2021 at 10:34:27 UTC+2, hongy...@gmail.com wrote:
> > > See the following testings:
> > >
> > > In [24]: a=3.1415926535897932384626433832795028841971
> > > In [27]: -a
> > > Out[27]: -3.141592653589793
> > You've never heard of floating-point? Double precision has 53 significant 
> > bits of mantissa, corresponding approximately to 16 decimal digits.
> > 
> > > In [17]: ~-+1
> > > Out[17]: 0
> > << The unary ~ (invert) operator yields the bitwise inversion of its 
> > integer argument. The bitwise inversion of x is defined as -(x+1). It only 
> > applies to integral numbers or to custom objects that override the 
> > __invert__() special method. >>
> > 
>
> A further inference based on the above description:
>
> Let us consider this equation:  -(x+1) = x, the solution is -0.5, which is 
> not an integer. So we can safely come to a conclusion:
>
> If bool(a) == True,  \forall a \in integer, then ~bool(a) == False; and vice 
> versa.
>

If bool(a) is True, then ~bool(a) is exactly the same as writing
~True, and a has become irrelevant. That is simply how expression
evaluation works.

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


Re: Big jump in version

2021-10-05 Thread Grant Edwards
On 2021-10-04, Cecil Westerhof via Python-list  wrote:
> When I run:
> pip3 list --outdated
>
> I get:
> Package  Version Latest Type
>  --- -- -
> cryptography 3.4.8   35.0.0 wheel
>
> The jump from 3 to 35 seems a bit excessive to me. Or is it correct?

https://cryptography.io/en/latest/changelog/

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


Open a new window by mouse clicking in the QLineEdit field and not by clicking of a button

2021-10-05 Thread Mohsen Owzar
Hi all,
I'm looking for an approach, but couldn't find any appropriate answer to my 
problem:
On my GUI on a tablet, I have bunch of QlineEdit widgets for the settings of my 
task.
Because we have no keyboard connected to the tablet, I have put two buttons 
("+" and "-") around each QLineEdit widget to increase or decrease its value.
When the target value is far away from the displayed one in the QLineEdit, I 
have to click lots of times to reach the end value.
Due to this ugliness feature, I wanted to offer to the user the possibility to 
click in the edit field to get another window with a numeric keypad to type the 
target value. And then by clicking an OK button, the new window will be closed 
and the typed value will be taken into the QLineEdit widget of my original GUI.
In all my searches, I found examples to open new windows by clicking a button 
and not by clicking in an edit field.
I used the following line to have an edit field on window1.

self.text_from_window2 = QLineEdit('Setting Value')

And wanted to open another window (window2) in which I programmed a numeric 
keypad. By typing the desired value on this keypad and enter OK, this value 
should be taken to the edit field of window1.
But the following line brings an error that QLineEdit has no attribute 
"clicked".

self.text_from_window2.clicked().connect(self.show_keypad_window)

I tried to use other attributes like focus, textChanged or textEdited. None of 
them could help me.
Is it at all possible to use QLineEdit with mouse click to generate an action 
(open new window)?
Has anyone an example of such a code snippet?
I am very curious to see if someone has a solution to my problem.

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


Re: matplotlib graph white space

2021-10-05 Thread Michel Alwan
u can adjust any side with the other options... (margins) if you don t want to 
use tight layout...
On 21/10/04 11:39AM, Steve wrote:
> 
> Yes, I saw that but it is a change for all sides. 
>  Is there a setting to change just the left and right padding?
> 
> 
> 
> 
> -Original Message-
> From: Michel Alwan  
> Sent: Monday, October 4, 2021 7:56 AM
> To: Steve 
> Cc: python-list@python.org
> Subject: Re: matplotlib graph white space
> 
> In the plot window, you can click on the settings (up), and select the
> option "tight layout" by pressing that button... I think this is what you
> are looking for...
> 
> 
> On 21/10/04 04:39AM, Steve wrote:
> > 
> > I am using the first bar graph listed at this site:
> > https://matplotlib.org/stable/gallery/index.html
> > 
> > The problem I have is that there is too much white space around the graph.
> > My data would be better displayed if I could widen the graph into the 
> > space to the right and left of the chart.
> > 
> > Steve
> > 
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> 
> --
> Michel Alwan
> 
> 
> ( support Stallman : stallmansupport.org )
> 

-- 
Michel Alwan


( support Stallman : stallmansupport.org )
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: matplotlib graph white space

2021-10-05 Thread Michel Alwan
In the plot window, you can click on the settings (up), and select the option 
"tight layout" by pressing that button... I think this is what you are looking 
for...


On 21/10/04 04:39AM, Steve wrote:
> 
> I am using the first bar graph listed at this site:
> https://matplotlib.org/stable/gallery/index.html
> 
> The problem I have is that there is too much white space around the graph.
> My data would be better displayed if I could widen the graph into the space
> to the right and left of the chart.
> 
> Steve
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
Michel Alwan


( support Stallman : stallmansupport.org )
-- 
https://mail.python.org/mailman/listinfo/python-list


Does loading PDB slow down execution?

2021-10-05 Thread Unixnut

Hi all,

If I run a python3 program with "import pdb" in the code, would it 
execute slower than without loading the debugger?


The program I am running is computationally expensive and mathematically 
orientated. It is expected to run for a few months (I am a few days in). 
I found out today that I forgot to comment out the "import pdb" while 
debugging, and now I am wondering if there would be a performance 
benefit worth restarting the execution with pdb unloaded.


I have tried testing this with a simple sum executable, but I don't see 
a clear difference with short execution times (<5 mins). Before I 
investigate further, I thought I would ask and see if anyone knows the 
answer already.


Many thanks!

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


Big jump in version

2021-10-05 Thread Cecil Westerhof via Python-list
When I run:
pip3 list --outdated

I get:
Package  Version Latest Type
 --- -- -
cryptography 3.4.8   35.0.0 wheel
pyzstd   0.14.4  0.15.0 wheel

The jump from 3 to 35 seems a bit excessive to me. Or is it correct?


On a side node. I have not updated pyzstd for a long time, because
that breaks py7zr which needs a version lower as 0.15.0.
Any chance that py7zr is going to be updated?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread hongy...@gmail.com
On Sunday, October 3, 2021 at 9:55:15 PM UTC+8, hongy...@gmail.com wrote:
> On Sunday, October 3, 2021 at 8:38:16 PM UTC+8, ju...@diegidio.name wrote: 
> > On Sunday, 3 October 2021 at 14:21:13 UTC+2, hongy...@gmail.com wrote: 
> > > On Sunday, October 3, 2021 at 6:31:05 PM UTC+8, ju...@diegidio.name 
> > > wrote: 
> > 
> > > > Then you can guess that numpy overrides it and gives you *logical* 
> > > > negation of boolean values, 
> > > 
> > > I try to dig through the numpy source code to pinning point the 
> > > overriding/monkey patching/decorating code snippets, as follows: 
> > And you keep missing the point: look up numpy's *documentation* for that, 
> > not any source code.
> I find the relevant explanation here [1]: 
> 
> numpy.invert 
> [...] 
> Compute bit-wise inversion, or bit-wise NOT, element-wise. 
> 
> Computes the bit-wise NOT of the underlying binary representation of the 
> integers in the input arrays. This ufunc implements the C/Python operator ~. 
> [...] 
> The ~ operator can be used as a shorthand for np.invert on ndarrays. 
> 
> x1 = np.array([True, False]) 
> 
> ~x1 
> array([False, True]) 
> 
> [1] 
> https://numpy.org/doc/stable/reference/generated/numpy.invert.html#numpy-invert
>  

Or use the following commands in IPython:

import numpy as np
np.invert?
np.info(np.invert)


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


Re: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread hongy...@gmail.com
On Sunday, October 3, 2021 at 8:38:16 PM UTC+8, ju...@diegidio.name wrote:
> On Sunday, 3 October 2021 at 14:21:13 UTC+2, hongy...@gmail.com wrote: 
> > On Sunday, October 3, 2021 at 6:31:05 PM UTC+8, ju...@diegidio.name wrote: 
> 
> > > Then you can guess that numpy overrides it and gives you *logical* 
> > > negation of boolean values, 
> > 
> > I try to dig through the numpy source code to pinning point the 
> > overriding/monkey patching/decorating code snippets, as follows:
> And you keep missing the point: look up numpy's *documentation* for that, not 
> any source code. 

I find the relevant explanation here [1]:

numpy.invert
[...]
Compute bit-wise inversion, or bit-wise NOT, element-wise.

Computes the bit-wise NOT of the underlying binary representation of the 
integers in the input arrays. This ufunc implements the C/Python operator ~.
[...]
The ~ operator can be used as a shorthand for np.invert on ndarrays.

x1 = np.array([True, False])

~x1
array([False,  True])

[1] 
https://numpy.org/doc/stable/reference/generated/numpy.invert.html#numpy-invert

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


Re: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread hongy...@gmail.com
On Sunday, October 3, 2021 at 6:31:05 PM UTC+8, ju...@diegidio.name wrote:
> On Sunday, 3 October 2021 at 11:24:58 UTC+2, hongy...@gmail.com wrote: 
> > On Sunday, October 3, 2021 at 2:18:17 PM UTC+8, hongy...@gmail.com wrote: 
> > > On Saturday, October 2, 2021 at 4:59:54 PM UTC+8, ju...@diegidio.name 
> > > wrote: 
> > > > On Saturday, 2 October 2021 at 10:34:27 UTC+2, hongy...@gmail.com 
> > > > wrote: 
> > > > > See the following testings: 
> > > > > 
> > > > > In [24]: a=3.1415926535897932384626433832795028841971 
> > > > > In [27]: -a 
> > > > > Out[27]: -3.141592653589793 
> > > > You've never heard of floating-point? Double precision has 53 
> > > > significant bits of mantissa, corresponding approximately to 16 decimal 
> > > > digits. 
> > > > 
> > > >  
> > > > > In [17]: ~-+1 
> > > > > Out[17]: 0 
> > > > << The unary ~ (invert) operator yields the bitwise inversion of its 
> > > > integer argument. The bitwise inversion of x is defined as -(x+1). It 
> > > > only applies to integral numbers or to custom objects that override the 
> > > > __invert__() special method. >> 
> > > > 
> > > >  
> > > A further inference based on the above description: 
> > > 
> > > Let us consider this equation: -(x+1) = x, the solution is -0.5, which is 
> > > not an integer. So we can safely come to a conclusion: 
> > > 
> > > If bool(a) == True, \forall a \in integer, then ~bool(a) == False; and 
> > > vice versa. 
> > > 
> > > This is exactly the theoretical basis to filter some specific columns in 
> > > pandas, just as the issue discussed here [1]. 
> > Sorry my not very precise description above. I should have wanted to 
> > express the fact that I observed below: 
> > In [3]: import numpy as np 
> > In [15]: ~np.array([True]) 
> > Out[15]: array([False]) 
> > 
> > In [16]: ~np.array([False]) 
> > Out[16]: array([ True]) 
> > 
> > But the normal `True' and `False' don't the good symmetric feature as shown 
> > above: 
> > 
> > In [21]: bool(~True) 
> > Out[21]: True 
> > 
> > In [22]: bool(~False) 
> > Out[22]: True
> You keep missing the point:
> << The unary ~ (invert) operator yields the bitwise inversion of its integer 
> argument. The bitwise inversion of x is defined as -(x+1). It only applies to 
> integral numbers or to custom objects that override the __invert__() special 
> method. >>
> Then you can guess that numpy overrides it and gives you *logical* negation 
> of boolean values,

I try to dig through the numpy source code to pinning point the 
overriding/monkey patching/decorating code snippets, as follows:

$ rg -A5 -uu 'def __invert__' .
./numpy/__init__.pyi
2022:def __invert__(self: NDArray[bool_]) -> NDArray[bool_]: ...
2023-@overload
2024:def __invert__(self: NDArray[_IntType]) -> NDArray[_IntType]: ...
2025-@overload
2026:def __invert__(self: NDArray[object_]) -> Any: ...
2027-
2028-@overload
2029-def __pos__(self: NDArray[_NumberType]) -> NDArray[_NumberType]: ...
2030-@overload
2031-def __pos__(self: NDArray[timedelta64]) -> NDArray[timedelta64]: ...
--
2885:def __invert__(self) -> bool_: ...
2886-__lshift__: _BoolBitOp[int8]
2887-__rlshift__: _BoolBitOp[int8]
2888-__rshift__: _BoolBitOp[int8]
2889-__rrshift__: _BoolBitOp[int8]
2890-__and__: _BoolBitOp[bool_]
--
2993:def __invert__(self: _IntType) -> _IntType: ...
2994-# Ensure that objects annotated as `integer` support bit-wise 
operations
2995-def __lshift__(self, other: _IntLike_co) -> integer: ...
2996-def __rlshift__(self, other: _IntLike_co) -> integer: ...
2997-def __rshift__(self, other: _IntLike_co) -> integer: ...
2998-def __rrshift__(self, other: _IntLike_co) -> integer: ...

./numpy/array_api/_array_object.py
510:def __invert__(self: Array, /) -> Array:
511-"""
512-Performs the operation __invert__.
513-"""
514-if self.dtype not in _integer_or_boolean_dtypes:
515-raise TypeError("Only integer or boolean dtypes are allowed in 
__invert__")

./numpy/lib/user_array.py
179:def __invert__(self):
180-return self._rc(invert(self.array))
181-
182-def _scalarfunc(self, func):
183-if self.ndim == 0:
184-return func(self[0])

./numpy/lib/mixins.pyi
62:def __invert__(self): ...

Which is corresponding to the overriding mentioned above by you?

> while on primitives you get the usual *arithmetic* behaviour, where 
> bool(~False) implicitly is bool(~int(False)) = bool(~0) = bool(-1) = True. 

Implicit cast happens here automatically.
 
> Please take note: (typically!) ~ denotes a bitwise operation on integers, not 
> logical negation on booleans. 

Thank you for stressing the point again.

HZ
-- 

Re: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread hongy...@gmail.com
On Saturday, October 2, 2021 at 4:59:54 PM UTC+8, ju...@diegidio.name wrote:
> On Saturday, 2 October 2021 at 10:34:27 UTC+2, hongy...@gmail.com wrote: 
> > See the following testings: 
> > 
> > In [24]: a=3.1415926535897932384626433832795028841971 
> > In [27]: -a 
> > Out[27]: -3.141592653589793
> You've never heard of floating-point? Double precision has 53 significant 
> bits of mantissa, corresponding approximately to 16 decimal digits. 
> 
> > In [17]: ~-+1 
> > Out[17]: 0
> << The unary ~ (invert) operator yields the bitwise inversion of its integer 
> argument. The bitwise inversion of x is defined as -(x+1). It only applies to 
> integral numbers or to custom objects that override the __invert__() special 
> method. >> 
> 

A further inference based on the above description:

Let us consider this equation:  -(x+1) = x, the solution is -0.5, which is not 
an integer. So we can safely come to a conclusion:

If bool(a) == True,  \forall a \in integer, then ~bool(a) == False; and vice 
versa.

This is exactly the theoretical basis to filter some specific columns in 
pandas, just as the issue discussed here [1].

[1] https://github.com/pandas-dev/pandas/issues/43832#issue-1013375587

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


Re: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread hongy...@gmail.com
On Sunday, October 3, 2021 at 2:18:17 PM UTC+8, hongy...@gmail.com wrote:
> On Saturday, October 2, 2021 at 4:59:54 PM UTC+8, ju...@diegidio.name wrote:
> > On Saturday, 2 October 2021 at 10:34:27 UTC+2, hongy...@gmail.com wrote: 
> > > See the following testings: 
> > > 
> > > In [24]: a=3.1415926535897932384626433832795028841971 
> > > In [27]: -a 
> > > Out[27]: -3.141592653589793 
> > You've never heard of floating-point? Double precision has 53 significant 
> > bits of mantissa, corresponding approximately to 16 decimal digits. 
> > 
> >  
> > > In [17]: ~-+1 
> > > Out[17]: 0 
> > << The unary ~ (invert) operator yields the bitwise inversion of its 
> > integer argument. The bitwise inversion of x is defined as -(x+1). It only 
> > applies to integral numbers or to custom objects that override the 
> > __invert__() special method. >> 
> > 
> A further inference based on the above description: 
> 
> Let us consider this equation: -(x+1) = x, the solution is -0.5, which is not 
> an integer. So we can safely come to a conclusion: 
> 
> If bool(a) == True, \forall a \in integer, then ~bool(a) == False; and vice 
> versa. 
> 
> This is exactly the theoretical basis to filter some specific columns in 
> pandas, just as the issue discussed here [1]. 

Sorry my not very precise description above. I should have wanted to express 
the fact that I observed below:

In [3]: import numpy as np
In [15]: ~np.array([True])
Out[15]: array([False])

In [16]: ~np.array([False])
Out[16]: array([ True])

But the normal `True' and `False' don't the good symmetric feature as shown 
above:

In [21]: bool(~True)
Out[21]: True

In [22]: bool(~False)
Out[22]: True

 
> [1] https://github.com/pandas-dev/pandas/issues/43832#issue-1013375587 
> 
> HZ
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread hongy...@gmail.com
On Sunday, October 3, 2021 at 3:05:23 AM UTC+8, ju...@diegidio.name wrote:
> On Saturday, 2 October 2021 at 14:48:39 UTC+2, hongy...@gmail.com wrote: 
> > On Saturday, October 2, 2021 at 4:59:54 PM UTC+8, ju...@diegidio.name 
> > wrote: 
> > > On Saturday, 2 October 2021 at 10:34:27 UTC+2, hongy...@gmail.com wrote: 
> > > > See the following testings: 
> > > > 
> > > > In [24]: a=3.1415926535897932384626433832795028841971 
> > > > In [27]: -a 
> > > > Out[27]: -3.141592653589793 
> > > 
> > > You've never heard of floating-point? Double precision has 53 significant 
> > > bits of mantissa, corresponding approximately to 16 decimal digits. 
> > > 
> > >  
> > > 
> > > > In [17]: ~-+1 
> > > > Out[17]: 0 
> > > 
> > > << The unary ~ (invert) operator yields the bitwise inversion of its 
> > > integer argument. The bitwise inversion of x is defined as -(x+1). It 
> > > only applies to integral numbers or to custom objects that override the 
> > > __invert__() special method. >> 
> > > 
> > >  
> > > 
> > > > I'm very puzzled by these operators. Any hints will be highly 
> > > > appreciated. 
> > > 
> > > Try and read the proverbial manual: that's truly a fundamental skill... 
> > 
> > Thank you for your explanation. Then what about the following questions?: 
> > 
> > 1. Should `+' and `-' be classified as binary operators or unary operators?
> "Symbol overloading": a+b is binary *addition*, +a is unary *identity* (or 
> however you may like to call it). The meaning of a symbol or name depends on 
> context.

As I understand now, it can be used to identify/normalize the operand by the 
corresponding precision in the given context.

> > As we all know, `a + b', and `a - b' are the normal ways we do basic 
> > arithmetic operations.
> Nonsense. You yourself wrote ~(-(+1)) above, just without parentheses.

Thank you for pointing out my contradictory assertion.

> > 2. See the following testings:
> Read the bloody manual. 
> 
> Given that: 
> int(True) = 1 
> int(False) = 0 
> 
> and that: 
> bool(x) is True iff x <> 0 

In [8]: bool(None)
Out[8]: False

In [9]: bool('')
Out[9]: False

In [10]: bool(0)
Out[10]: False

So, bool(x) is True iff x <> 0 , None, and '', as shown here [1]:

In [3]: import numpy as np
In [11]: np.array([1, 0.5, 0, None, 'a', '', True, False], dtype=bool)
Out[11]: array([ True,  True, False, False,  True, False,  True, False])
 
[1] https://riptutorial.com/numpy/example/21181/creating-a-boolean-array#example
 
> and that: 
> ~~x = x for all x (integer) 
> 
> These: 
> ~1 = -(1+1) = -2 
> ~~1 = ~-2 = -(-2+1) = 1 
> ~~~1 = ~1 = -2 
> ... 
> all evaluate to True. 
> 
> And these: 
> ~0 = -(0+1) = -1 
> ~~0 = ~-1 = -(-1+1) = 0 
> ~~~0 = ~0 = -1 
> ... 
> evaluate to True and False alternatingly. 
> 
> In short, ~1=-2 (and ~-2=1) and 1 and -2 both convert to True, while ~0=1 but 
> 0 converts to False while 1 converts to True.
> > Why can’t/shouldn't we get something similar results for both `True' and 
> > `False' in the above testings?
> Because bitwise complement is not symmetric around 0. For comparison, try 
> with negation instead. 

Thanks again. I see, as follows:

In [1]: ~1
Out[1]: -2

In [2]: ~-1
Out[2]: 0

 
> But don't just guess, try and unpack those expressions while trying and 
> reading the docs: which is a necessary skill in itself. 

Thank you for the advice that showed me the way to truth.

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


[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-10-05 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Hai Shi! ✨  ✨

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



Re: Definitive guide for Regex

2021-10-05 Thread Karsten Hilbert
Am Thu, Sep 30, 2021 at 12:29:16PM +0100 schrieb Shaozhong SHI:

> I am trying to look for a definitive guide for Regex in Python.
> Can anyone help?

If you tell us what you tried in order to look we can
perhaps guide you on how to take a better look.

Spoonfeeding doesn't seem to be a well-liked activity,
neither here nor on the PostgreSQL lists.

Best,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 05.10.2021 22:30, Steve Dower wrote:
> The version number for "Windows 11" still starts with 10.0. Just like how 
> Windows 5.x and 6.x were around for a very long time each ;)
> 
> There are tables in platform module that map the specific version to the 
> release name. These probably need to be updated to return "11" for versions 
> 10.0.22000 and greater.

Hmm, but the "ver" output seems to have more information than those
APIs.

Note: The tables for mapping to releases for Windows only take the
major.minor versions as key. Unfortunately, those did not change. It's
actually the build version which provides the indicator, it seems.

Any idea, whether a patch will fix this on Windows soonish ?

--

___
Python tracker 

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



[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-10-05 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 52d9d3b75441ae6038fadead89eac5eecdd34501 by Łukasz Langa in 
branch '3.9':
[3.9] bpo-44050: Extension modules can share state when they don't support 
sub-interpreters. (GH-27794) (GH-28741)
https://github.com/python/cpython/commit/52d9d3b75441ae6038fadead89eac5eecdd34501


--

___
Python tracker 

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



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:

The version number for "Windows 11" still starts with 10.0. Just like how 
Windows 5.x and 6.x were around for a very long time each ;)

There are tables in platform module that map the specific version to the 
release name. These probably need to be updated to return "11" for versions 
10.0.22000 and greater.

--

___
Python tracker 

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



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

win32_ver() should be using the internal Windows APIs to figure out the 
version. I do wonder why those don't return the same version as the "ver" 
command line tool.

Adding our Windows experts to the noisy list.

--
nosy: +lemburg, paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

demo.py contains dirty hack that can be used as a fix for some time before 
microsoft will not fix it.

--
Added file: https://bugs.python.org/file50327/demo.py

___
Python tracker 

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



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

The bug comes from Microsoft  terminal bug : If I type there : ver it will 
return Microsoft Windows [Version 10.0.22000.194] only one patch is if that 
will check the build . 
so : 
 info = subprocess.check_output(cmd,
   stdin=subprocess.DEVNULL,
   stderr=subprocess.DEVNULL,
   text=True,
   shell=True)
if(int(info.strip(".")[2])==22000):
 return "Windows [Version 11.0.22000.194]

--

___
Python tracker 

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



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

The 
platform.win32_ver() returns same answer

--

___
Python tracker 

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



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Alex Zaslavskis


New submission from Alex Zaslavskis :

I am updated to windows 11 . Now I am trying to write script that will detect 
is user use windows 11 or windows 10 . 
I was using the simplest way as possible: 
import platform 
print(platform.platform())
The result I got is : Windows-10-10.0.22000-SP0
That is quite correct . The build version is correct ,but the windows version 
is still not .

--
components: Library (Lib)
messages: 403260
nosy: sahsariga111
priority: normal
severity: normal
status: open
title: platform() is not able to detect windows 11
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



[issue45381] IDLE cannot kill process. "interupt" ctl+c and "restart shell" freeze program.

2021-10-05 Thread A A


New submission from A A :

Idle3 with python 3.7.3 on Debian Buster and XFCE.
Attempting to run the line 'print ("Hello World" * 8**8)' from either the Idle 
shell window or Idle editor will cause Idle to hang and one CPU core runs 
100%.(allowed it to run for several minutes) 
ctl+c or menu Shell>interrupt execution simply pauses CPU processing but does 
not terminate the process nor is there an option to continue the process. 
Following this interrupt with use of menu Shell>Restart-shell causes Idle to 
fully freeze and then requires a system terminate signal to close Idle.
The same line of python used in Idle on another student's MS-Windows laptop 
required ctl-alt-del this was a fresh download with v3.9 as I recall.

When used used on the system Bash shell and python 3.7.3, the line operates 
without any trouble and finishes in 20seconds as: $ python3 -c 'print ( "Hello 
World " * 8**8)' 

Suggestion is that the ctl+c or the Interrupt menu option in Idle should 
terminate the running code rather than pause it.

--
assignee: terry.reedy
components: IDLE
messages: 403259
nosy: capsicumw, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE cannot kill process. "interupt" ctl+c and "restart shell" freeze 
program.
type: behavior
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



[issue45380] help() appears confused about the module of typing.Annotated

2021-10-05 Thread Alex Waygood


New submission from Alex Waygood :

`help()` appears confused about the module of `typing.Annotated`. If you call 
`help()` on a parameterised "instance" of `typing.Annotated`, it will claim 
that `Annotated` belongs to whatever module the annotated type is from. 
Additionally, `help()` appears not to know about the `__metadata__` attribute 
of `typing.Annotated`.

```
>>> from typing import Annotated, Callable
>>> t = Annotated[int | str, "Some metadata"]
>>> help(t)
Help on _AnnotatedAlias in module types:

Annotated = int | str
>>> u = Annotated[Callable[[int], str], "Some metadata"]
>>> help(u)
Help on _AnnotatedAlias in module typing:

Annotated = typing.Callable[[int], str]
>>> s = Annotated[int, "Some metadata"]
Help on _AnnotatedAlias in module builtins:

Annotated = class int(object)
 |  int([x]) -> integer
 |  int(x, base=10) -> integer

# (etc., giving the entire output of help() for `int`)
```

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 403258
nosy: AlexWaygood, docs@python
priority: normal
severity: normal
status: open
title: help() appears confused about the module of typing.Annotated
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue15870] PyType_FromSpec should take metaclass as an argument

2021-10-05 Thread Sebastian Berg


Sebastian Berg  added the comment:

Yeah, I will try and have a look.  I had posted the patch, because the test 
looked like a bit of a larger chunk of work ;).

> And I'm surprised that you're surprised :)

:).  I am coming from a completely different angle, probably.  Just if you are 
curious, I use a from-spec like API (not public yet) in NumPy and dynamic use 
seemed natural/logical in that use-case, e.g.: 
https://github.com/numpy/numpy/blob/c92864091e5928d92bc109d1505febe35f3909f1/numpy/core/src/multiarray/convert_datatype.c#L2434

But, I am trying to understand the preference for static better.  There is 
probably something to learn or even important I am missing.


> And I have some plans to make static specs useful in type checking, since we 
> can assume that types made from the same spec share the memory layout.

(I don't understand how it is useful, unless you reuse slot structs?)
It sounds interesting, but even static does not guarantee constant unless the 
user indicates it through a flag?
Maybe you could achieve this by figuring it out by inspecting/comparing content 
rather than using the spec pointer(s)? (More complex, but also more powerful?)

--

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-10-05 Thread Guido van Rossum


Guido van Rossum  added the comment:

Whoa. os.path is not always an alias for posixpath, is it?

--

___
Python tracker 

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



[issue42327] Add PyModule_Add()

2021-10-05 Thread Łukasz Langa

Change by Łukasz Langa :


--
nosy: +lukasz.langa
nosy_count: 3.0 -> 4.0
pull_requests: +27089
pull_request: https://github.com/python/cpython/pull/28741

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-10-05 Thread Eric Snow


Eric Snow  added the comment:


New changeset 08285d563e64c179a56ab2f952345b3dbcdb54f3 by Eric Snow in branch 
'main':
bpo-45020: Identify which frozen modules are actually aliases. (gh-28655)
https://github.com/python/cpython/commit/08285d563e64c179a56ab2f952345b3dbcdb54f3


--

___
Python tracker 

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



[issue45378] Can't find "map" with search on docs.python.org

2021-10-05 Thread Guido van Rossum


Guido van Rossum  added the comment:

> I'm surprised no one else noticed this until now.  

Most people probably just use Google and read whatever comes up. I was looking 
whether the official docs for map mentioned that map is actually an iterator 
class. (They don't.)

--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:

Yeah, we're getting close. I'll reopen this issue for tracking.

We still need that pip release and it'll have to be merged into ensurepip. 
We'll also need better access to test systems than any of us currently have 
(the buildbot is great, but we need interactive systems too).

There are already binary releases at 
https://www.nuget.org/packages/pythonarm64/ that should be suitable for most 
testing. I'll probably make the ARM64 packages available through the Windows 
Store for 3.11's prereleases, and possibly as a side-loadable MSIX from 
python.org.

I'm strongly considering not offering the regular executable installer on 
ARM64, since it seems we don't have the back-compat demand right now. It would 
be a good opportunity to try and fix the issues with that installer and really 
put the focus on the MSIX as the user-friendly approach. But that's still 
future thoughts, no concrete plans yet :)

--
resolution: fixed -> 
status: closed -> open
versions: +Python 3.11 -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



[issue39573] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type

2021-10-05 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote an article about these changes:
https://vstinner.github.io/c-api-abstract-pyobject.html

It elaborates the rationale for making these changes.

--

___
Python tracker 

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



[issue45378] Can't find "map" with search on docs.python.org

2021-10-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm surprised no one else noticed this until now.  

The doc search finds some entries such as: "sum", "min", "max", and 
"enumerate".  However, it is missing others such as: "map" and "filter".

--
nosy: +rhettinger

___
Python tracker 

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



[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-10-05 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset d0d29655ffc43d426ad68542d8de8304f7f1346a by Miss Islington (bot) 
in branch '3.10':
bpo-44050: Extension modules can share state when they don't support 
sub-interpreters. (GH-27794) (GH-28738)
https://github.com/python/cpython/commit/d0d29655ffc43d426ad68542d8de8304f7f1346a


--

___
Python tracker 

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



[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-10-05 Thread Łukasz Langa

Change by Łukasz Langa :


--
pull_requests: +27088
pull_request: https://github.com/python/cpython/pull/28741

___
Python tracker 

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



[issue45373] ./configure --enable-optimizations should enable LTO

2021-10-05 Thread Ned Deily


Ned Deily  added the comment:

I don't think you need llvm-ar anymore with the Apple Tool Chain but let me 
look into it as I have all the relevant previous macOS releases as VMs to test 
with.

--

___
Python tracker 

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



[issue45373] ./configure --enable-optimizations should enable LTO

2021-10-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Yeah, I had problems in the past to get llvm-ar or some other component. I 
still need time to reproduce and to see if this still happens on new versions.

--

___
Python tracker 

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



[issue45324] The frozen importer should capture info in find_spec().

2021-10-05 Thread Eric Snow


Change by Eric Snow :


--
pull_requests: +27087
pull_request: https://github.com/python/cpython/pull/28740

___
Python tracker 

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



[issue45324] The frozen importer should capture info in find_spec().

2021-10-05 Thread Eric Snow


Change by Eric Snow :


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



[issue45324] The frozen importer should capture info in find_spec().

2021-10-05 Thread Eric Snow


Eric Snow  added the comment:


New changeset c3d9ac8b340fcbf54cee865737e67f11fcd70ed3 by Eric Snow in branch 
'main':
bpo-45324: Capture data in FrozenImporter.find_spec() to use in exec_module(). 
(gh-28633)
https://github.com/python/cpython/commit/c3d9ac8b340fcbf54cee865737e67f11fcd70ed3


--

___
Python tracker 

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



[issue45378] Can't find "map" with search on docs.python.org

2021-10-05 Thread Raúl Cumplido

Change by Raúl Cumplido :


--
nosy: +raulcd

___
Python tracker 

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



[issue45379] Improve errors related to frozen modules.

2021-10-05 Thread Eric Snow


New submission from Eric Snow :

In Python/import.c there are various situations in which an error state related 
to frozen modules might result and even lead to an exception.  In gh-28633 we 
consolidated these cases into a new "frozen_status" enum and added 
"set_frozen_error()" to set a consistent exception based on a status.

There are several deficiencies to address at this point:

* the conditions for the statuses are unclear [1][2]
* the error messages could be more helpful [3]
* maybe use a different error message for FROZEN_BAD_NAME (and perhaps 
FROZEN_DISABLED), rather than combining with FROZEN_NOT_FOUND 


[1] https://github.com/python/cpython/pull/28633#discussion_r720503665
[2] https://github.com/python/cpython/pull/28633#discussion_r720504275
[3] https://github.com/python/cpython/pull/28633#discussion_r720987412

--
components: Interpreter Core
messages: 403246
nosy: barry, brett.cannon, eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: Improve errors related to frozen modules.
type: 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



[issue45378] Can't find "map" with search on docs.python.org

2021-10-05 Thread Guido van Rossum


New submission from Guido van Rossum :

I was looking for the docs for 'map' and tried to use the search box on 
docs.python.org. This gave a lot of things whose name started with or contained 
'map', but the entry for the builtin map() function was hidden really far down 
under the heading "Builtin Functions" 
(https://docs.python.org/3.10/library/functions.html?highlight=map) rather than 
deep-linking to the entry I was looking for 
(https://docs.python.org/3.10/library/functions.html#map).

I'm sure that some tweak to the index builder could fix this, in general, for 
all builtin functions and types (many of which I imagine suffer from the effect 
-- having a short name that is used a lot as a part of other names).

--
assignee: docs@python
components: Documentation
messages: 403245
nosy: docs@python, gvanrossum
priority: normal
severity: normal
status: open
title: Can't find "map" with search on docs.python.org
type: behavior

___
Python tracker 

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



[issue45373] ./configure --enable-optimizations should enable LTO

2021-10-05 Thread Ned Deily


Ned Deily  added the comment:

> IIRC activating lto is specially annoying on MacOS due to the need of some 
> llvm components that are a bit hard to get

Can you say more? We are currently using --with-lto with a vanilla Apple 
Command Line Tools (or Xcode) for macOS installer builds when building on macOS 
10.15 High Sierra or higher.  Perhaps this was just an issue on older versions.

--
nosy: +ned.deily

___
Python tracker 

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



[issue45375] Windows assertion in out-of-tree debug build

2021-10-05 Thread Steve Dower


Change by Steve Dower :


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



[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-10-05 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for the fix. I don't understand well this code :-(

--

___
Python tracker 

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



[issue45367] Specialize BINARY_MULTIPLY

2021-10-05 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Hm the above was not PGO. I tried again with PGO and it is not so good:

Mean +- std dev: [nbody_main_pgo] 177 ms +- 4 ms -> [nbody_specialized_pgo] 190 
ms +- 2 ms: 1.07x slower
Mean +- std dev: [pidigits_main_pgo] 208 ms +- 1 ms -> 
[pidigits_specialized_pgo] 210 ms +- 2 ms: 1.01x slower
Mean +- std dev: [chaos_main_pgo] 106 ms +- 1 ms -> [chaos_specialized_pgo] 110 
ms +- 1 ms: 1.04x slower
Mean +- std dev: [spectral_norm_main_pgo] 169 ms +- 7 ms -> 
[spectral_norm_specialized_pgo] 167 ms +- 1 ms: 1.02x faster
Benchmark hidden because not significant (1): raytrace

--

___
Python tracker 

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



[issue45362] dis does not work with the new optimized ops

2021-10-05 Thread Ken Jin


Ken Jin  added the comment:

Closing this issue as the behavior in dis module is as intended. For any 
potential issues to 3rd party packages discovered in the future, consider 
opening an issue in that package's issue tracker, or submitting a brand new 
issue to bugs.python.org.

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



[issue45367] Specialize BINARY_MULTIPLY

2021-10-05 Thread Ken Jin


Ken Jin  added the comment:

> (Windows doesn't want to install greenlet for pyperformance)

I had the *exact* same issues, I eventually found a workaround for it after 
many hours spent guessing.

Initially, setuptools complained that I needed MSVC++ 14.0 or later (even after 
I had the latest one installed). I found that for some strange reason, *only* 
14.0 worked, 14.2x etc. don't. After installing MSVC 14.0, there was then some 
strange complaint about missing some .exe/.dll. Searching that entire error 
message led me to a result on StackOverflow advising copying said files from 
the Windows SDK in Visual Studio over to the MSVC 14.0 folder. This finally 
allowed greenlet to compile. I've since lost the exact SO links, but I hope 
this leads you somewhere.

Anyways, I don't recommend benchmarking on Windows for stable results (trust 
me, I've tried ;-). `pyperf system tune` doesn't work on Windows. This leads to 
very inconsistent results unless you manually disable turbo boost, set core 
affinities, etc. Also, PGO for _PyEvalFrameDefaultEx might be broken on Windows 
on the main branch (see issue45116).

Eventually I gave up and just used Linux for stable benchmarking. pyperformance 
`compile_all` also works properly there, which allows you to automate your 
benchmarks 
https://pyperformance.readthedocs.io/usage.html#compile-python-to-run-benchmarks

PS. are your numbers with PGO and LTO? If so, they're spectacular!

--
nosy: +kj

___
Python tracker 

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



[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-10-05 Thread miss-islington


miss-islington  added the comment:


New changeset b9bb74871b27d9226df2dd3fce9d42bda8b43c2b by Hai Shi in branch 
'main':
bpo-44050: Extension modules can share state when they don't support 
sub-interpreters. (GH-27794)
https://github.com/python/cpython/commit/b9bb74871b27d9226df2dd3fce9d42bda8b43c2b


--
nosy: +miss-islington

___
Python tracker 

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



[issue44050] [subinterpreters] _PyImport_FixupExtensionObject() regression in Python 3.9

2021-10-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27086
pull_request: https://github.com/python/cpython/pull/28738

___
Python tracker 

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



[issue45354] test_winconsoleio fails on Windows 11

2021-10-05 Thread miss-islington


miss-islington  added the comment:


New changeset 63c9a6cc8b48740c88199b5150c9948b1a61756b by Miss Islington (bot) 
in branch '3.9':
bpo-45354: Skip obsolete device name tests on Windows 11 (GH-28712)
https://github.com/python/cpython/commit/63c9a6cc8b48740c88199b5150c9948b1a61756b


--

___
Python tracker 

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



[issue45354] test_winconsoleio fails on Windows 11

2021-10-05 Thread Steve Dower


Change by Steve Dower :


--
stage: backport needed -> 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



[issue45354] test_winconsoleio fails on Windows 11

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:


New changeset d0d0909a3a0b553826d1ddbb04a676fdabb61359 by Miss Islington (bot) 
in branch '3.10':
bpo-45354: Skip obsolete device name tests on Windows 11 (GH-28712)
https://github.com/python/cpython/commit/d0d0909a3a0b553826d1ddbb04a676fdabb61359


--

___
Python tracker 

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



[issue45375] Windows assertion in out-of-tree debug build

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:


New changeset 5146877623ebe8a2806411703b0de9c0aba179a1 by Steve Dower in branch 
'main':
bpo-45375: Fix assertion failure due to searching for stdlib in unnormalised 
paths (GH-28735)
https://github.com/python/cpython/commit/5146877623ebe8a2806411703b0de9c0aba179a1


--

___
Python tracker 

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



[issue45377] Default python 3 docs still pointing to 3.9.7

2021-10-05 Thread Raúl Cumplido

New submission from Raúl Cumplido :

We are going to start the python 3.10 work on the python-docs-es and we have 
realised that when accessing: https://docs.python.org/3/
It is still redirecting to Python 3.9.7 documentation

As Python 3.10 was released yesterday shouldn't the default docs point to 
python 3.10 already?

--
assignee: docs@python
components: Documentation
messages: 403235
nosy: docs@python, mdk, raulcd
priority: normal
severity: normal
status: open
title: Default python 3 docs still pointing to 3.9.7
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



[issue45354] test_winconsoleio fails on Windows 11

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:

Thanks, Jeremy! And thanks for being on top of getting the Win11 buildbot set 
up!

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



[issue45354] test_winconsoleio fails on Windows 11

2021-10-05 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45354] test_winconsoleio fails on Windows 11

2021-10-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27085
pull_request: https://github.com/python/cpython/pull/28737

___
Python tracker 

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



[issue45354] test_winconsoleio fails on Windows 11

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:


New changeset de4052fe0633e3a053e66c8477f13677054d6ede by Jeremy Kloth in 
branch 'main':
bpo-45354: Skip obsolete device name tests on Windows 11 (GH-28712)
https://github.com/python/cpython/commit/de4052fe0633e3a053e66c8477f13677054d6ede


--

___
Python tracker 

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



[issue45376] Run Windows release docs build on regular CI

2021-10-05 Thread Steve Dower


New submission from Steve Dower :

Currently the release build of the CHM file runs on my dedicated build machine, 
which means there's no way to do a test run without starting the machine 
(normally clearing the code signing and PGO properties allows a build without 
needing it).

Originally the issue was that the docs build was taking >10minutes on CI, but 
not on my machine, which is why I moved it.

Should try moving it back, or at least enabling a skip option for it so that 
test runs can be done purely on free CI, rather than needing my account.

--
assignee: steve.dower
components: Windows
messages: 403232
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Run Windows release docs build on regular CI

___
Python tracker 

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



[issue45375] Windows assertion in out-of-tree debug build

2021-10-05 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue15870] PyType_FromSpec should take metaclass as an argument

2021-10-05 Thread Petr Viktorin


Petr Viktorin  added the comment:

> I am slightly surprised we actually care about static C-definitions?

And I'm surprised that you're surprised :)
AFAIK, supporting dynamically allocated specs/slots was an afterthought. I do 
agree they should be supported, though! Thanks for filing bpo-45315, and please 
file any more bugs your find.

But I'd still say that best practice is to make specs static if possible. (And 
I have some plans to make static specs useful in type checking, since we can 
assume that types made from the same spec share the memory layout.)


> My patch tries to address the first (the class creator has to take care that 
> this is reasonable for the metaclass).  I had hoped the `slot` mechanism can 
> avoid the API discussion for the second one, but I guess not.

Whoa, I missed the patch completely --  2021 looks too much like 2012, I'm used 
to patches being old since we use pull requests now, and the conversation 
turned to slots too quickly... but missing that you mentioned it is completely 
on me. Sorry!

Do you want to go through with the patch yourself, or should I take over? It 
still needs:
- opening a PR on GitHub
- tests
- documentation & a What's New entry
- probably separate bug as well, since it doesn't fix this one

--

___
Python tracker 

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



[issue45375] Windows assertion in out-of-tree debug build

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:

I believe this is because getpath has hit its final fallback case of looking in 
".\DLLs" and ".\Lib" for the standard library, and has not performed proper 
normalisation on these paths. So after removing the last segment, the result is 
"." which does not end in SEP.

So at least in this case, we can probably just ignore the assertion. However, 
I'm concerned that this would open up other cases where search paths may be 
added that are otherwise unintended.

The expected behaviour when the stdlib can't be found is a detailed error 
message, not a debug assertion/crash.

--

___
Python tracker 

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



[issue45375] Windows assertion in out-of-tree debug build

2021-10-05 Thread Steve Dower


New submission from Steve Dower :

As seen in the release build for 3.11a1, an assertion is raised when attempting 
to launch the debug build out of tree.

   _RegenTestFrozenmain:
 Regenerate test_frozenmain.h
 D:\a\1\b\bin\amd64\python_d.exe Programs\freeze_test_frozenmain.py 
Programs/test_frozenmain.h
 Assertion failed: stdlibdir[wcslen(prefix)] == SEP, file 
D:\a\1\s\PC\getpathp.c, line 300

This causes the release to fail.

--
assignee: steve.dower
components: Windows
messages: 403229
nosy: pablogsal, paul.moore, steve.dower, tim.golden, zach.ware
priority: release blocker
severity: normal
status: open
title: Windows assertion in out-of-tree debug build
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



  1   2   >