Re: Tkinter long-running window freezes

2021-02-25 Thread Christian Gollwitzer

Am 26.02.21 um 06:15 schrieb John O'Hagan:

On Thu, 25 Feb 2021 21:57:19 +0100
Christian Gollwitzer  wrote:

I think it is not yet clear, if this is a bug in Tkinter or in
Tcl/Tk, the underlying scripting language. It might also be platform
dependent. Are you on Windows? Here is an equivalent Tcl program:

==
package require Tk

proc randint {} {
expr {int(rand()*1000)}
}

proc display {label} {
destroy $label
set id [randint]
set label [label .l$id -text [randint]]
pack $label
after 100 [list display $label]
}

display [label .l]



Can you run this and check that the freeze also occurs? If you can't
execute the Tcl that is used by Python directly, you may also do
something like


root = Tk()
root.eval('Here comes the Tcl code')
root.mainloop()

Can you also find out what version of Tcl/Tk you are using? Try

root.eval('info patchlevel')

Christian



I've followed your suggestions as per my last post, and can confirm
the same freezing behaviour when running your code directly as a tclsh
script on Debian Testing, Tcl 8.6.11.


You might report this as a bug to the Tcl bugtracker 
https://core.tcl-lang.org/tk/ticket


I guess the problem is with the steady creation of widgets. Tk was not 
meant to be used like that. Tkinter creates new widget names for each 
widget with random numbers, just like the Tcl code above does, whereas 
in a usual Tcl/Tk program the names are given by the programmer.


Can you also check this program, which reuses the same widget path name, 
albeit does the creation/destruction in cycles:


==
package require Tk

proc randint {} {
expr {int(rand()*1000)}
}

proc display {label} {
destroy $label
set label [label .l -text [randint]]
pack $label
after 100 [list display $label]
}

display [label .l]


As mentioned by others, typically you wouldn't continuously recreate new 
widgets, but either update the text of the widget (label['text']="New 
text") or attaching a StringVar() )


or, if you must rearrange the widgets, you pack_forget() them and then 
repack them.


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


Re: name for a mutually inclusive relationship

2021-02-25 Thread Chris Angelico
On Fri, Feb 26, 2021 at 3:32 PM Ethan Furman  wrote:
>
> On 2/25/21 7:06 PM, Joe Pfeiffer wrote:
> > Ethan Furman writes:
>
> >> Like I said, at this moment I don't have a good example, only an awareness 
> >> that such a thing could exist and I don't know the name for it (if it has 
> >> one).
> >>
> >> So far I have seen that there are even fewer good use-cases than I might 
> >> have guessed, and that no one seems to have a name for the general idea.
> >
> > Do you have a specific problem you're trying to solve?
>
> No, I just came across the concept in my browsing and was wondering if there 
> was a name for it.  I think the most accurate name at this point is probably 
> "pain in the butt".  ;-)
>

"Design flaw" is a close second.

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


[issue43144] test_unicodedata: test_normalization uses network but doesn't depend on network resource

2021-02-25 Thread Dong-hee Na


Change by Dong-hee Na :


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



Re: error of opening Python

2021-02-25 Thread Mladen Gogala via Python-list
On Thu, 25 Feb 2021 17:22:35 +, Botao Liu wrote:

> Dear Python team,
> 
> This is my first time using Python, I tried to launch Python and it
> showed "Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC
> v.1928 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or
> "license" for more information." I don't know what this meant and how to
> fix this. Could you please help me? Thank you very much.
> 
> Kind regards,
> 
> Botao Liu

Try with this first: https://python.swaroopch.com/
It gives you the details of what that means and what to do next. Also, 
your Python interpreter is broken it says:


It should say something like this:
Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC
> v.1928 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or
> "license" 

-- [mgogala@umajor ~]$ python3
Python 3.9.1 (default, Jan 20 2021, 00:00:00) 
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

The problem string is "win32". You should be able to open a terminal 
Window and execute "uname -r".


Mladen Gogala
Database Consultant
https://dbwhisperer.wordpress.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43144] test_unicodedata: test_normalization uses network but doesn't depend on network resource

2021-02-25 Thread miss-islington


miss-islington  added the comment:


New changeset 6c4c11763fad106e43cdcfdbe3bd33ea2765a13f by Miss Islington (bot) 
in branch '3.9':
bpo-43144: Mark unicodedata's test_normalization as requiring network (GH-24650)
https://github.com/python/cpython/commit/6c4c11763fad106e43cdcfdbe3bd33ea2765a13f


--

___
Python tracker 

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



Re: Tkinter long-running window freezes

2021-02-25 Thread John O'Hagan
On Thu, 25 Feb 2021 21:57:19 +0100
Christian Gollwitzer  wrote:

> Am 24.02.21 um 12:35 schrieb John O'Hagan:
> > Hi list
> > 
> > I have a 3.9 tkinter interface that displays data from an arbitrary
> > number of threads, each of which runs for an arbitrary period of
> > time. A frame opens in the root window when each thread starts and
> > closes when it stops. Widgets in the frame and the root window
> > control the thread and how the data is displayed.
> > 
> > This works well for several hours, but over time the root window
> > becomes unresponsive and eventually freezes and goes grey. No error
> > messages are produced in the terminal.
> > 
> > Here is some minimal, non-threaded code that reproduces the problem
> > on my system (Xfce4 on Debian testing):
> > 
> > from tkinter import *
> > from random import randint
> > 
> > root = Tk()
> > 
> > def display(label):
> >  label.destroy()
> >  label = Label(text=randint(0, 9))
> >  label.pack()
> >  root.after(100, display, label)
> > 
> > display(Label())
> > mainloop()
> >   
> > This opens a tiny window that displays a random digit on a new label
> > every .1 second. (Obviously I could do this by updating the text
> > rather than recreating the label, but my real application has to
> > destroy widgets and create new ones).
> > 
> > This works for 3-4 hours, but eventually the window freezes.  
> 
> 
> I think it is not yet clear, if this is a bug in Tkinter or in
> Tcl/Tk, the underlying scripting language. It might also be platform
> dependent. Are you on Windows? Here is an equivalent Tcl program:
> 
> ==
> package require Tk
> 
> proc randint {} {
>   expr {int(rand()*1000)}
> }
> 
> proc display {label} {
>   destroy $label
>   set id [randint]
>   set label [label .l$id -text [randint]]
>   pack $label
>   after 100 [list display $label]
> }
> 
> display [label .l]
> 
> 
> 
> Can you run this and check that the freeze also occurs? If you can't 
> execute the Tcl that is used by Python directly, you may also do 
> something like
> 
> 
> root = Tk()
> root.eval('Here comes the Tcl code')
> root.mainloop()
> 
> Can you also find out what version of Tcl/Tk you are using? Try
> 
> root.eval('info patchlevel')
> 
>   Christian
> 

I've followed your suggestions as per my last post, and can confirm
the same freezing behaviour when running your code directly as a tclsh
script on Debian Testing, Tcl 8.6.11. 

I took the liberty of reducing the after delay to 10 milliseconds,
which as MRAB suggests makes the issue more obvious. (If I use 1
millisecond the numbers don't display). Over the five hours or so it was
running, the memory use increased from about 17 Mb to around 60.

Thanks

--

John

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


[issue27820] Possible bug in smtplib when initial_response_ok=False

2021-02-25 Thread Pandu E POLUAN


Pandu E POLUAN  added the comment:

PR available on GitHub and it's already more than one month since the PR was 
submitted, so I'm pinging this issue.

--

___
Python tracker 

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



Re: name for a mutually inclusive relationship

2021-02-25 Thread Ethan Furman

On 2/25/21 7:06 PM, Joe Pfeiffer wrote:

Ethan Furman writes:



Like I said, at this moment I don't have a good example, only an awareness that 
such a thing could exist and I don't know the name for it (if it has one).

So far I have seen that there are even fewer good use-cases than I might have 
guessed, and that no one seems to have a name for the general idea.


Do you have a specific problem you're trying to solve?


No, I just came across the concept in my browsing and was wondering if there was a name 
for it.  I think the most accurate name at this point is probably "pain in the 
butt".  ;-)

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


[issue43278] unnecessary leading '\n' from Py_GetCompiler() when build with different complier

2021-02-25 Thread miss-islington


miss-islington  added the comment:


New changeset 28a30bc2e2d5a02d42e65ff7b7c6968fa966279d by Joseph Shen in branch 
'master':
closes bpo-43278: remove unnecessary leading '\n' from COMPILER when build with 
GCC/Clang (GH-24606)
https://github.com/python/cpython/commit/28a30bc2e2d5a02d42e65ff7b7c6968fa966279d


--
nosy: +miss-islington
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



[issue41282] Deprecate and remove distutils

2021-02-25 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +methane
nosy_count: 17.0 -> 18.0
pull_requests: +23442
pull_request: https://github.com/python/cpython/pull/24657

___
Python tracker 

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



[issue43321] PyArg_ParseTuple() false-returns SUCCESS though SystemError and missing data (when PY_SSIZE_T_CLEAN not #define'd)

2021-02-25 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue43321] PyArg_ParseTuple() false-returns SUCCESS though SystemError and missing data (when PY_SSIZE_T_CLEAN not #define'd)

2021-02-25 Thread Inada Naoki


Inada Naoki  added the comment:

I checked the warning, and now I think Python traceback is fine.

PyArg_Parse*() is used on top of the C function. So python traceback is enough 
to find which function is using '#' without Py_SSIZE_T_CLEAN.

--

___
Python tracker 

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



[issue43326] About Zipfile

2021-02-25 Thread Fcant

New submission from Fcant :

When I Unzip a package using the zipfile module, the package’s filename has a 
newline character, which causes the Unzip to fail, so the UNZIP filename needs 
to be processed

--
components: Library (Lib)
files: Fcant_2021-02-26_11-26-37.jpg
messages: 387705
nosy: Fcscanf
priority: normal
severity: normal
status: open
title: About Zipfile
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49836/Fcant_2021-02-26_11-26-37.jpg

___
Python tracker 

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



[issue43144] test_unicodedata: test_normalization uses network but doesn't depend on network resource

2021-02-25 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue43144] test_unicodedata: test_normalization uses network but doesn't depend on network resource

2021-02-25 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset c6ccdfb479cb0a4a491575ef0bafaa0d29daae1a by Ammar Askar in branch 
'master':
bpo-43144: Mark unicodedata's test_normalization as requiring network (GH-24650)
https://github.com/python/cpython/commit/c6ccdfb479cb0a4a491575ef0bafaa0d29daae1a


--

___
Python tracker 

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



[issue43278] unnecessary leading '\n' from Py_GetCompiler() when build with different complier

2021-02-25 Thread Joseph Shen


Change by Joseph Shen :


--
nosy: +benjamin.peterson

___
Python tracker 

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



Re: name for a mutually inclusive relationship

2021-02-25 Thread Joe Pfeiffer
Ethan Furman  writes:

> On 2/24/21 1:54 PM, 2qdxy4rzwzuui...@potatochowder.com wrote:
>> Ethan Furman wrote:
>
>>> I didn't say it was a good example.  ;-)  Hopefully it gets the idea across.
>> Ditto.  ;-)
>> IMO, the whole idea of "my program has two options, and the user has
>> to
>> specify both or neither," isn't a question of whether or not the
>> argument parsing library supports it, but a question of whether or not
>> it's a good API.
>
> Like I said, at this moment I don't have a good example, only an awareness 
> that such a thing could exist and I don't know the name for it (if it has 
> one).
>
> So far I have seen that there are even fewer good use-cases than I might have 
> guessed, and that no one seems to have a name for the general idea.

Do you have a specific problem you're trying to solve?  That might help
us understand the question better.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: name for a mutually inclusive relationship

2021-02-25 Thread Joe Pfeiffer
Ethan Furman  writes:

> I'm looking for a name for a group of options that, when one is specified, 
> all of them must be specified.

I don't fully understand the question (yes, I read the part I snipped).

Why is this not just a single option?  Or is it hierarchical or
something so option 1 implies options 2 and 3, but option 2 does not
imply option 1?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread miss-islington


miss-islington  added the comment:


New changeset 07ab490a7a966ce00a61bf56ccd0604434b143a5 by Miss Islington (bot) 
in branch '3.8':
bpo-43316: gzip: Fix sys.exit() usage. (GH-24652)
https://github.com/python/cpython/commit/07ab490a7a966ce00a61bf56ccd0604434b143a5


--

___
Python tracker 

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



[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread miss-islington


miss-islington  added the comment:


New changeset 540749ed6d8e29a11368bc7f343baf7b7ea7e4a8 by Miss Islington (bot) 
in branch '3.9':
bpo-43316: gzip: Fix sys.exit() usage. (GH-24652)
https://github.com/python/cpython/commit/540749ed6d8e29a11368bc7f343baf7b7ea7e4a8


--

___
Python tracker 

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



[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread Inada Naoki


Change by Inada Naoki :


--
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: Tkinter long-running window freezes

2021-02-25 Thread MRAB

On 2021-02-25 20:57, Christian Gollwitzer wrote:

Am 24.02.21 um 12:35 schrieb John O'Hagan:

Hi list

I have a 3.9 tkinter interface that displays data from an arbitrary
number of threads, each of which runs for an arbitrary period of time.
A frame opens in the root window when each thread starts and closes
when it stops. Widgets in the frame and the root window control the
thread and how the data is displayed.

This works well for several hours, but over time the root window
becomes unresponsive and eventually freezes and goes grey. No error
messages are produced in the terminal.

Here is some minimal, non-threaded code that reproduces the problem on
my system (Xfce4 on Debian testing):

from tkinter import *
from random import randint

root = Tk()

def display(label):
 label.destroy()
 label = Label(text=randint(0, 9))
 label.pack()
 root.after(100, display, label)

display(Label())
mainloop()
  
This opens a tiny window that displays a random digit on a new label

every .1 second. (Obviously I could do this by updating the text rather
than recreating the label, but my real application has to destroy
widgets and create new ones).

This works for 3-4 hours, but eventually the window freezes.



I think it is not yet clear, if this is a bug in Tkinter or in Tcl/Tk,
the underlying scripting language. It might also be platform dependent.
Are you on Windows? Here is an equivalent Tcl program:

==
package require Tk

proc randint {} {
expr {int(rand()*1000)}
}

proc display {label} {
destroy $label
set id [randint]
set label [label .l$id -text [randint]]
pack $label
after 100 [list display $label]
}

display [label .l]



Can you run this and check that the freeze also occurs? If you can't
execute the Tcl that is used by Python directly, you may also do
something like


root = Tk()
root.eval('Here comes the Tcl code')
root.mainloop()

Can you also find out what version of Tcl/Tk you are using? Try

root.eval('info patchlevel')

I've just downloaded Tcl (Windows 10) and saw the same slow but steady 
rise in memory usage for that Tcl code (I reduced the timeout from 100 
to 1 to speed it up).


It looks like the leak, if that's what it is, is in Tcl.
--
https://mail.python.org/mailman/listinfo/python-list


Re: error of opening Python

2021-02-25 Thread Alan Gauld via Python-list
On 25/02/2021 17:22, Botao Liu wrote:

> Type "help", "copyright", "credits" or "license" for more information." 

Follow the instructions and type "help" at the >>> prompt.
Then follow the instructions which it displays.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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


Where is the problem?

2021-02-25 Thread RD
Python 3.4.3 on WinXP.

I create a Tk canvas and draw on it with create_text(), 
create_line(), and create_polygon with fill and stipple.

So far, so good, looks fine on the screen.

So I go to send it to a postsctript file:

bmap.postscript(file="tmp.ps", colormode='color')

It generates a file, no errors reported.

So I open up the file in a PS viewer (2, actually),
and the saved file looks like someone left a 
watercolor out in the rain.

Artifacts everywhere, the lines are blurred, and the 
text is unreadable.

Googling was unhelpful; did I miss something?

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


[issue43295] datetime.strptime emits IndexError on parsing 'z' as %z

2021-02-25 Thread itchyny


itchyny  added the comment:

@noormichael Thank you for submitting a patch, I confirmed the original issue 
is fixed. I'm ok this ticket is closed. Regarding the second issue, I learned 
it is a Turkish character (thanks!), but the error is same type so will not 
cause such a critical issue.

--

___
Python tracker 

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



[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23439
pull_request: https://github.com/python/cpython/pull/24654

___
Python tracker 

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



[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23438
pull_request: https://github.com/python/cpython/pull/24653

___
Python tracker 

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



[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 9525a18b5bb317d9fb206c992ab62aa41559b0c8 by Inada Naoki in branch 
'master':
bpo-43316: gzip: Fix sys.exit() usage. (GH-24652)
https://github.com/python/cpython/commit/9525a18b5bb317d9fb206c992ab62aa41559b0c8


--

___
Python tracker 

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



[issue13559] Use sendfile where possible in httplib

2021-02-25 Thread Alex Willmer


Alex Willmer  added the comment:

I would like to take a stab at this. Giampaolo, would it be okay if I made a 
pull request updated from your patch? With the appropriate "Co-authored-by: 
Author Name " line.

--
nosy: +Alex.Willmer

___
Python tracker 

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



[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset adea9b86a97794ca75054603497c195d5ba39aa5 by Miss Islington (bot) 
in branch '3.9':
bpo-43316:  gzip: CLI uses non-zero return code on error. (GH-24647)
https://github.com/python/cpython/commit/adea9b86a97794ca75054603497c195d5ba39aa5


--

___
Python tracker 

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



[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +23437
pull_request: https://github.com/python/cpython/pull/24652

___
Python tracker 

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



RE: name for a mutually inclusive relationship

2021-02-25 Thread Avi Gross via Python-list
YAGNI? True, Chris, I never have. 

And if I ever did, I might not even know someone has implemented similar
functionality with 86 optional function arguments that fine-tune what
happens in various cases and what error messages to supply, LOL! So, I would
end up re-implementing it myself.

But isn't this true for so much software we discuss here. The usual mantra
is that 80% of features are used maybe 20% of the time and a few are used
never except maybe while testing.

Realistically, it adds to bloat if a fairly well-defined object is extended
to handle every possible feature that is allowed, and then some. We recently
discussed the "+=" feature for an object when much of the time, it is pretty
much as useful as just using the longer way of adding something to yourself.
But loading a longer object description the 99% of the time when it is not
used, also costs a bit.

My comment was thus mostly academic and suggested realistic scenarios some
people use commonly enough that might be possibly to implement to make it
easier to deal with such a structure and that arguably such could also
handle this edge case. No reason to think this is an important thing to add,
just a category that could be doable.

-Original Message-
From: Python-list  On
Behalf Of Chris Angelico
Sent: Thursday, February 25, 2021 1:14 AM
To: Python 
Subject: Re: name for a mutually inclusive relationship

On Thu, Feb 25, 2021 at 4:06 PM Avi Gross via Python-list
 wrote:
>
> Is there a more general idea here? How about asking for a control that 
> internally manages N items and requires exactly M of them before the 
> entry is accepted when you click? The case being discussed sort of 
> wants N out of N, or nothing.
>

YAGNI.

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

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


[issue43314] [sqlite3] remove pre SQLite 3.7.7 support code

2021-02-25 Thread Berker Peksag


Change by Berker Peksag :


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



[issue43314] [sqlite3] remove pre SQLite 3.7.7 support code

2021-02-25 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 3150754f91fc1d15e3888e22c065672838a9c069 by Erlend Egeberg 
Aasland in branch 'master':
bpo-43314: Remove SQLITE_OPEN_URI ifdef (GH-24637)
https://github.com/python/cpython/commit/3150754f91fc1d15e3888e22c065672838a9c069


--

___
Python tracker 

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



[issue43321] PyArg_ParseTuple() false-returns SUCCESS though SystemError and missing data (when PY_SSIZE_T_CLEAN not #define'd)

2021-02-25 Thread Inada Naoki


Inada Naoki  added the comment:

Thank you for reporting.

@vstinner Can we provide a nice C traceback too?

--
nosy: +vstinner

___
Python tracker 

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



[issue43263] threading module unable to run

2021-02-25 Thread twoone3


twoone3 <3197653...@qq.com> added the comment:

That's a pity. I'm going to send the Python source code to my project to 
compile it, and see if it can solve the problem. Of course, I can also try 
compiling it into a static library

--

___
Python tracker 

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



[issue43321] PyArg_ParseTuple() false-returns SUCCESS though SystemError and missing data (when PY_SSIZE_T_CLEAN not #define'd)

2021-02-25 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +methane

___
Python tracker 

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



Re: Tkinter long-running window freezes

2021-02-25 Thread John O'Hagan
On Thu, 25 Feb 2021 11:06:05 -0500
Richard Damon  wrote:

> On 2/24/21 6:35 AM, John O'Hagan wrote:

> > Here is some minimal, non-threaded code that reproduces the problem
> > on my system (Xfce4 on Debian testing):
> >
> > from tkinter import *
> > from random import randint
> >
> > root = Tk()
> >
> > def display(label):
> > label.destroy()
> > label = Label(text=randint(0, 9))
> > label.pack()
> > root.after(100, display, label)
> >
> > display(Label())
> > mainloop()
> >  
> > This opens a tiny window that displays a random digit on a new label
> > every .1 second. (Obviously I could do this by updating the text
> > rather than recreating the label, but my real application has to
> > destroy widgets and create new ones).
> >
> > This works for 3-4 hours, but eventually the window freezes.
> >
> > The process uses about 26 Mb of memory at first, and this gradually
> > increases to around 30 or so by the time it freezes.
> >
> > Any ideas what could be causing this, or even how to approach
> > debugging or workarounds?
> >
> > Thanks
> >
> > --
> >
> > John  
> 
> One thought is that repeatedly destroying and recreating a label might
> be leaking a resource. One option would be to change the code to just
> update the label rather than recreating it each time.  Simplest is
> probably to link the Label to a StringVar instead of a fixed text and
> updating the variable to change the text. You can also (I believe) go
> into the Label and change the text it has with a configuration call.
> 

Thanks for your reply. 

It's true that your suggested approach stops the leak (if that's what
it is!) in the example code, but IMO there are valid use-cases
where it's necessary (or at least desirable) to continually create new
widgets and then destroy them in the course of running the application. 

In my use-case, the application reads YOLO object-recognition data from
video, and displays data about each new object in a new frame. When the
object ceases to be visible, the frame is destroyed.

I suppose I could redesign, e.g. by withdrawing frames instead of
destroying them, and keeping them in a pool to re-use later for new
data streams as needed. I'll give that a try if I can't solve this
issue.

Thanks

--

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


[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Berker Peksag


Change by Berker Peksag :


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



[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 91ea37c84af2dd5ea92802a4c2adad47861ac067 by Erlend Egeberg 
Aasland in branch 'master':
bpo-43290: Remove workaround from pysqlite_step() (GH-24638)
https://github.com/python/cpython/commit/91ea37c84af2dd5ea92802a4c2adad47861ac067


--

___
Python tracker 

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



Re: Tkinter long-running window freezes

2021-02-25 Thread John O'Hagan
On Thu, 25 Feb 2021 09:54:15 -0500
Terry Reedy  wrote:

> On 2/24/2021 6:53 PM, John O'Hagan wrote:
> > On Wed, 24 Feb 2021 11:03:30 -0500
> > Terry Reedy  wrote:
> >   
> >> On 2/24/2021 6:35 AM, John O'Hagan wrote:  
> > [...]  
> >>
> >> I am trying this out on Windows 10, with a wider label (so I can
> >> move the window) and a button that changes when pressed, and a
> >> sequential counter.  Will report when the Window freezes, or maybe
> >> a day if not.  
> 
> Counter is up to 777000 with no problem.
> 
> > Thank you! I've only run a few tests because of how long it takes
> > to freeze, but so far it seems that the trigger for the window
> > freezing is any attempt to interact with it, e.g. clicking on it,
> > so try doing that from time to time.  
> 
> I clicked on Window, clicked on label, clicked on button
> (collectively at least 100 times), moved window all over screen,
> resized it multiple times, maximized it and restored it a couple of
> times, and no problem. I conclude for not that your issue does not
> occur on Windows.
> 
> >> Plus you seem to have a memory leak and may need to replicate
> >> that.  
> > 
> > Can you explain what you mean by "replicate"?  
> 
> I don't remember, so forget it.
> 

Thanks for your efforts. So it seems to be something specific to my
system, X11 or Tcl version, etc.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43263] threading module unable to run

2021-02-25 Thread Steve Dower


Steve Dower  added the comment:

Sorry, I can't help. My employer has strict rules about reviewing GPL code like 
that in your linked repository.

I'd suggest checking your thread management in native code. Each new thread 
created in Python will create a new native thread, and they're all trying to 
acquire the GIL, so make sure you release it. I have no idea how you are 
waiting for the threads to complete their work, but you'll need to release the 
GIL while waiting (and maybe periodically reacquire it to check).

In general, I find it's best to treat embedded CPython as running as a separate 
process, even if it's just in separate threads. If you try and mix arbitrary 
Python code into your own application, things like this happen all the time. 
Whereas if you are doing inter-thread communication as if there are no shared 
objects, you'll often be fine.

--

___
Python tracker 

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



[issue43263] threading module unable to run

2021-02-25 Thread twoone3


Change by twoone3 <3197653...@qq.com>:


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
resolution: works for me -> wont fix
type:  -> behavior

___
Python tracker 

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



[issue43325] Documentation should warn that 'is' is not a safe comparison operator for most values.

2021-02-25 Thread Anthony Flury


New submission from Anthony Flury :

A frequent bug for beginners is to assume that 'is' is somehow 'better' then 
'==' when comparing values, and it is certainly a cause for confusion amongst 
beginners as to why:

   [1,2] is [1,2] evaluates to False but
   'a' is 'a' evaluates to True

and many similar examples.

As far as I can see the first mention of the 'is' operator is under Section 5 - 
More on conditionals : 
https://docs.python.org/3/tutorial/datastructures.html?highlight=comparison#comparing-sequences-and-other-types;
 and it is mentioned thus : 

  The operators is and is not compare whether two objects are really
  the same object; this only matters for mutable objects like lists.

As we know though this statement is misleading - it suggests that 'is' can be 
used to compare immutable values (ints, strings, tuples) etc, and while for 
some values of some immutables (small ints, shortish strings) 'is' can be used 
as an equivalent of '==' it wont be clear from this 'statement' that 'is' is 
simply not a safe way to compare values.

There needs to be a warning here about 'is' and how it is not an equivalent to 
'==' in any general sense.

--
assignee: docs@python
components: Documentation
messages: 387692
nosy: anthony-flury, docs@python
priority: normal
severity: normal
status: open
title: Documentation should warn that 'is' is not a safe comparison operator 
for most values.
type: enhancement

___
Python tracker 

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



[issue43324] asyncio

2021-02-25 Thread Hasan


Change by Hasan :


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

___
Python tracker 

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



Re: error of opening Python

2021-02-25 Thread Christian Gollwitzer

Am 25.02.21 um 18:22 schrieb Botao Liu:

Dear Python team,

This is my first time using Python, I tried to launch Python and it showed
"Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information." I
don't know what this meant and how to fix this. Could you please help me?
Thank you very much.


This is as it should be. What have you expected, that you think this is 
wrong?


Maybe you are looking for an IDE like IDLE (should be installed along 
with Python on Windows), or something very different?


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


[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Paul Moore


Paul Moore  added the comment:

No, because I want to work with whatever version of Python the user puts there. 
Yes, I could search for "python3*.dll" and load the one I find, but I'm writing 
this in C, and I get a migraine whenever I have to write more than about 15 
lines of C code these days :-)

It's not a big deal either way, though. That project turned out to be too much 
effort to be worth it, so it's now mostly just a proof-of-concept experiment.

> most of us consider a critical security vulnerability rather than a feature

:-) Given that my execution model is "run a user-supplied Python script with a 
user-supplied interpreter" I think any attacker has far easier ways of 
compromising things than hijacking python3.dll...

--

___
Python tracker 

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



[issue43324] asyncio

2021-02-25 Thread Hasan


New submission from Hasan :

Added socket getfqdn and gethostbyaddr functions with threadpoolexecutor to 
asyncio library

--
messages: 387690
nosy: AliyevH
priority: normal
severity: normal
status: open
title: asyncio
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Steve Dower


Steve Dower  added the comment:

Yeah, but in that scenario, it is just as good to LoadLibrary("python39.dll") 
and use it as if it was LoadLibrary("python3.dll") because the interaction 
model is identical.

The only reason to load python3.dll explicitly is if you are not keeping it 
adjacent to python39.dll, and so you need to pre-load it before the interpreter 
tries to import a native module. It doesn't provide any benefit for the host 
app other than not having to know what DLL you're loading, and most of us 
consider a critical security vulnerability rather than a feature ;)

--

___
Python tracker 

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



[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Addendum to msg387641:
> The latter only leaves a valid Cursor->statement->st pointer (sqlite3_stmt 
> pointer) if the Statement object was successfully created, and the 
> sqlite3_stmt successfully prepared.

sqlite3_prepare_v2() actually returns SQLITE_OK but sets the statement pointer 
to NULL, if given an empty string or a comment. Only the sqlite3_prepare_v2() 
return code is checked in order to determine if pysqlite_statement_create() was 
successful or not.

--

___
Python tracker 

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



Re: error of opening Python

2021-02-25 Thread Michael F. Stemper

On 25/02/2021 11.22, Botao Liu wrote:

Dear Python team,

This is my first time using Python, I tried to launch Python and it showed
"Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information." I
don't know what this meant and how to fix this. Could you please help me?


There isn't anything to fix. It's working just fine.


--
Michael F. Stemper
If you take cranberries and stew them like applesauce they taste much
more like prunes than rhubarb does.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter long-running window freezes

2021-02-25 Thread Christian Gollwitzer

Am 24.02.21 um 12:35 schrieb John O'Hagan:

Hi list

I have a 3.9 tkinter interface that displays data from an arbitrary
number of threads, each of which runs for an arbitrary period of time.
A frame opens in the root window when each thread starts and closes
when it stops. Widgets in the frame and the root window control the
thread and how the data is displayed.

This works well for several hours, but over time the root window
becomes unresponsive and eventually freezes and goes grey. No error
messages are produced in the terminal.

Here is some minimal, non-threaded code that reproduces the problem on
my system (Xfce4 on Debian testing):

from tkinter import *
from random import randint

root = Tk()

def display(label):
 label.destroy()
 label = Label(text=randint(0, 9))
 label.pack()
 root.after(100, display, label)

display(Label())
mainloop()
  
This opens a tiny window that displays a random digit on a new label

every .1 second. (Obviously I could do this by updating the text rather
than recreating the label, but my real application has to destroy
widgets and create new ones).

This works for 3-4 hours, but eventually the window freezes.



I think it is not yet clear, if this is a bug in Tkinter or in Tcl/Tk, 
the underlying scripting language. It might also be platform dependent. 
Are you on Windows? Here is an equivalent Tcl program:


==
package require Tk

proc randint {} {
expr {int(rand()*1000)}
}

proc display {label} {
destroy $label
set id [randint]
set label [label .l$id -text [randint]]
pack $label
after 100 [list display $label]
}

display [label .l]



Can you run this and check that the freeze also occurs? If you can't 
execute the Tcl that is used by Python directly, you may also do 
something like



root = Tk()
root.eval('Here comes the Tcl code')
root.mainloop()

Can you also find out what version of Tcl/Tk you are using? Try

root.eval('info patchlevel')

Christian

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


[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Eryk Sun


Eryk Sun  added the comment:

> I'm not sure we ever meant for LoadLibrary("python3.dll") to 
> actively load the concrete python3X.dll.

IIRC, Paul Moore was doing something like this to create a script runner that 
loads "python3.dll", which runs as a regular application, not as a launcher for 
"python.exe". He didn't want to tie the executable to a particular 
"python3x.dll" or include the DLLs in the application directory beside the 
executable. I think he had the embedded distribution(s) in a subdirectory. 
That's solvable by defining an assembly in the subdirectory, which gets 
declared in the application manifest. But I think he wanted to keep it simple. 
So he was just manually loading "python3.dll" and calling GetProcAddress() to 
look up Py_Main(), which works in Windows 8+. Alternatively, for this kind of a 
script runner, the script itself can declare the version of Python it needs in 
a shebang (assuming a single architecture for the executable and Python), and 
the executable can then manually load the required Python DLL from a 
subdirectory, or other known location.

--

___
Python tracker 

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



Does anyone know if there Is a 'Code Snippet' add-in for PyCharm

2021-02-25 Thread DonK



Thank you

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


[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Eryk Sun


Change by Eryk Sun :


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

___
Python tracker 

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



[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Eryk Sun


Eryk Sun  added the comment:

> The APIs are the same, so you can (should) LoadLibrary the one 
> that you want.

The issue is that python3.dll doesn't depend on python3x.dll in the normal way. 
For example, LoadLibraryExW("path/to/python3.dll", NULL, 
LOAD_WITH_ALTERED_SEARCH_PATH) doesn't automatically load "python38.dll". But 
the forwarded functions depend on "python38.dll", e.g. "Py_Main (forwarded to 
python38.Py_Main)". The loader doesn't try to load "python38.dll" until the 
application tries to resolve a forwarded function such as "Py_Main", which in 
the LoadLibraryExW case is the time that GetProcAddress(hpython3, "Py_Main") is 
called. 

It turns out, when I tested this in 2017, that the loader in Windows 7 doesn't 
remember the activation context from loading "python3.dll" and thus will fail 
to find "python38.dll", which in turn makes the GetProcAddress() call fail. In 
contrast, the loader in Windows 10 knows to search for "python38.dll" in the 
directory of "python3.dll".

--

___
Python tracker 

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



error of opening Python

2021-02-25 Thread Botao Liu
Dear Python team,

This is my first time using Python, I tried to launch Python and it showed
"Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information." I
don't know what this meant and how to fix this. Could you please help me?
Thank you very much.

Kind regards,

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


[issue43323] UnicodeEncodeError: surrogates not allowed when parsing invalid charset

2021-02-25 Thread Anders Kaseorg

New submission from Anders Kaseorg :

We ran into a UnicodeEncodeError exception using email.parser to parse this 
email 
,
 with full headers available in the raw archive 
.  The 
offending header is hilariously invalid:

Content-Type: text/plain; charset*=utf-8”''utf-8%E2%80%9D

but I’m filing an issue since the parser is intended to be robust against 
invalid input.  Minimal reproduction:

>>> import email, email.policy
>>> email.message_from_bytes(b"Content-Type: text/plain; 
>>> charset*=utf-8\xE2\x80\x9D''utf-8%E2%80%9D", policy=email.policy.default)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.10/email/__init__.py", line 46, in 
message_from_bytes
return BytesParser(*args, **kws).parsebytes(s)
  File "/usr/local/lib/python3.10/email/parser.py", line 123, in parsebytes
return self.parser.parsestr(text, headersonly)
  File "/usr/local/lib/python3.10/email/parser.py", line 67, in parsestr
return self.parse(StringIO(text), headersonly=headersonly)
  File "/usr/local/lib/python3.10/email/parser.py", line 57, in parse
return feedparser.close()
  File "/usr/local/lib/python3.10/email/feedparser.py", line 187, in close
self._call_parse()
  File "/usr/local/lib/python3.10/email/feedparser.py", line 180, in _call_parse
self._parse()
  File "/usr/local/lib/python3.10/email/feedparser.py", line 256, in _parsegen
if self._cur.get_content_type() == 'message/delivery-status':
  File "/usr/local/lib/python3.10/email/message.py", line 578, in 
get_content_type
value = self.get('content-type', missing)
  File "/usr/local/lib/python3.10/email/message.py", line 471, in get
return self.policy.header_fetch_parse(k, v)
  File "/usr/local/lib/python3.10/email/policy.py", line 163, in 
header_fetch_parse
return self.header_factory(name, value)
  File "/usr/local/lib/python3.10/email/headerregistry.py", line 608, in 
__call__
return self[name](name, value)
  File "/usr/local/lib/python3.10/email/headerregistry.py", line 196, in __new__
cls.parse(value, kwds)
  File "/usr/local/lib/python3.10/email/headerregistry.py", line 453, in parse
kwds['decoded'] = str(parse_tree)
  File "/usr/local/lib/python3.10/email/_header_value_parser.py", line 126, in 
__str__
return ''.join(str(x) for x in self)
  File "/usr/local/lib/python3.10/email/_header_value_parser.py", line 126, in 

return ''.join(str(x) for x in self)
  File "/usr/local/lib/python3.10/email/_header_value_parser.py", line 798, in 
__str__
for name, value in self.params:
  File "/usr/local/lib/python3.10/email/_header_value_parser.py", line 783, in 
params
value = value.decode(charset, 'surrogateescape')
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 5-7: 
surrogates not allowed

--
components: email
messages: 387685
nosy: andersk, barry, r.david.murray
priority: normal
severity: normal
status: open
title: UnicodeEncodeError: surrogates not allowed when parsing invalid charset
versions: Python 3.10, Python 3.6, 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



[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Steve Dower


Steve Dower  added the comment:

I'm not sure we ever meant for LoadLibrary("python3.dll") to actively load the 
concrete python3X.dll. The APIs are the same, so you can (should) LoadLibrary 
the one that you want.

It's when you use static imports in extensions that it matters, but in that 
case it's ensured that both python3X.dll and python3.dll are already loaded.

I guess somewhere we just need to specify that python3.dll is for python3.lib, 
and not for LoadLibrary? I'm not even sure where the existing documentation is 
that we would change.

--

___
Python tracker 

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



[issue26111] On Windows, os.scandir will keep a handle on the directory until the iterator is exhausted

2021-02-25 Thread Steve Dower


Steve Dower  added the comment:

> FYI, in Windows 10, deleting files and directories now tries a POSIX delete

Yeah, FWIW, I haven't been able to get clear guidance on what I can/cannot 
publicly announce we've done in this space. But since you've found it I guess I 
can say sorry that I couldn't announce it more loudly! :)

A number of our other issues should be able to be closed soon once the changes 
get out in the open.

--

___
Python tracker 

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



[issue30979] the winapi fails to run shortcuts (because considers a shortcut not a valid Win32App)

2021-02-25 Thread Eryk Sun


Change by Eryk Sun :


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



[issue30460] file opened for updating cannot write after read

2021-02-25 Thread Eryk Sun


Change by Eryk Sun :


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



[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Eryk Sun


Eryk Sun  added the comment:

This issue affects Windows 7 and earlier, so I'm changing the affected version 
to Python 3.8, the last version to support Windows 7. I don't have access to 
Windows 7 currently. If someone has access to an updated Windows 7 installation 
(all required and optional updates) and has the free time to check this, please 
confirm whether resolving forwarded functions still fails when "python3.dll" is 
loaded with LOAD_WITH_ALTERED_SEARCH_PATH. Also, check the newer flags added by 
KB2533623: LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR. 
The update to support these flags may align the behavior with Windows 8.1 and 
10.

--
versions: +Python 3.8 -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue22302] Windows os.path.isabs UNC path bug

2021-02-25 Thread Eryk Sun


Eryk Sun  added the comment:

> figure out whether to do `Path.cwd() / path`

Thus a UNC path is absolute, i.e. any path that starts with 2 or more slashes, 
and all other paths are relative unless they have both a drive and a root. For 
example:

def isabs(s):
"""Test whether a path is absolute"""
s = os.fspath(s)
seps = _get_bothseps(s)
if len(s) > 1 and s[0] in seps and s[1] in seps:
return True
drive, rest = splitdrive(s)
if drive and rest:
return rest[0] in seps
return False

This also fixes the mistaken result that a rooted path such as "/spam" is 
absolute. When opened directly, a rooted path is relative to the drive of the 
current working directory. When accessed indirectly as the target of a symlink, 
a rooted path is relative to the volume device of the opened path. 

An example of the latter is a symlink named "link" that targets "\". If it's 
accessed as E:\link, it resolves to E:\. If it's accessed as 
C:\Mount\VolumeE\link, it resolves instead to C:\. The relative link resolves 
differently depending on the path traversed to access it. (Note that when 
resolving the target of a relative symlink, mountpoints such as "VolumeE" that 
are traversed in the opened path do not get replaced by their target path, 
unlike directory symlinks, which do get replaced by their target path. This 
behavior is basically the same as the way mountpoints and symlinks are handled 
in Unix.)

--
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue28708] Low FD_SETSIZE limit on Windows

2021-02-25 Thread Eryk Sun


Change by Eryk Sun :


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

___
Python tracker 

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



[issue28708] Low FD_SETSIZE limit on Windows

2021-02-25 Thread Anastasia Stefanyuk


Anastasia Stefanyuk  added the comment:

Hello! This piece of code is kind of a pain to solve, I guess you can somehow 
use the information here: 
https://mobilunity.com/blog/hire-sap-full-stack-developer/ - this will 
definitely help in some way or another.

--
nosy: +stefanyuk.ana

___
Python tracker 

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



[issue43322] Inconsistent '#include' notation in extensions tutorial doc

2021-02-25 Thread Matthew Hughes


New submission from Matthew Hughes :

Just a small thing in these docs, there is a mix of "#include 
", e.g. 
https://github.com/python/cpython/blame/master/Doc/extending/newtypes_tutorial.rst#L243
 and '#include "structmember.h"', mostly in the included samples e.g. 
https://github.com/python/cpython/blob/master/Doc/includes/custom2.c#L3. Should 
these all be the same?

--
assignee: docs@python
components: Documentation
messages: 387679
nosy: docs@python, mhughes
priority: normal
severity: normal
status: open
title: Inconsistent '#include' notation in extensions tutorial doc
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



GridSearchCV generates unexpected different best parameters by only changing the parameters order in param_grid. Please help!

2021-02-25 Thread Yi Li
I am using GridSearchCV to find the best parameter setting of my 
sklearn.pipeline estimator. The pipeline consists of data transformation, UMAP 
dimension reduction and Kmeans clustering.
The final Kmeans clustering results are scored using silhouette_score. I tried 
to verify the whole pipeline/GridSearchCV worked correctly by only changing the 
parameter order in param_grid (
e.g., change 'reduce__n_neighbors': (5, 10), to 'reduce__n_neighbors': (10, 
5)). I got totally different best parameters although I expect the parameter 
order change should not impact the 
best paramters determined by GridSearchCV. Where did I make mistake and how to 
fix this unexpected results?

Below is the code. The Debug class is used to save the output from 'reduce' 
step. This saved output is used in cv_silhouette_scorer() to calculate 
silhouette_score. I suspect Debug class and cv_silhouette_scorer() 
did not work as I expected. 

I really appreciate your help.

class Debug(BaseEstimator, TransformerMixin):
def __init__(self):
self.transX = None

def transform(self, X):
print(X)
self.transX = X.copy()
return X

def fit(self, X, y=None, **fit_params):
return self

def cv_silhouette_scorer(estimator, X):
# estimator.fit(X)
sdata = estimator.named_steps['debug'].transX
cluster_labels = estimator.named_steps['cluster'].labels_
num_labels = len(set(cluster_labels))
num_samples = sdata.shape[0]
if num_labels == 1 or num_labels == num_samples:
return -1
else:
return silhouette_score(sdata, cluster_labels)


ohe = OneHotEncoder(drop='if_binary', dtype=np.float32)
ore = OrdinalEncoder(dtype=np.float32)
ctenc = ColumnTransformer(transformers=[('ohe', ohe, nom_vars), ('ore', ore, 
ord_vars)], 
  remainder='passthrough')
nftr = FunctionTransformer(nominal_indicator_missing, check_inverse=False, 
  kw_args={'feat_names': ohecols, 'orig_cols': 
nom_vars})
oftr = FunctionTransformer(ordinal_indicator_missing, check_inverse=False,
kw_args={'miss_value': 0.})

ctmiss = ColumnTransformer(transformers=[('nftr', nftr, slice(0, 19)), ('oftr', 
oftr, slice(19, 20)), ('drop_cols', 'drop' , slice(32, 36) )], 
remainder='passthrough')

mputer = IterativeImputer(random_state=RS, add_indicator=True, 
initial_strategy="most_frequent", skip_complete=True)


# Add below keep_vars transformer to drop all demographic columns before pass 
to UMAP

keep_cols = ColumnTransformer(transformers=[('keep_cols1', 'passthrough' , 
slice(17, 25) ), ('keep_cols2', 'passthrough' , slice(46, 54) )] )

scaler = StandardScaler()

trans = FunctionTransformer(np.transpose, check_inverse=False)

dreduce = umap.UMAP(random_state=RS)
knn = KMeans(random_state=RS)
pipe = Pipeline(steps=[
('enc', ctenc)
, ('functr', ctmiss)
, ('mpute', mputer)
, ('keep_cols', keep_cols)
, ('scale', scaler)
, ('trans', trans)
, ('reduce', dreduce)
, ("debug", Debug())
, ('cluster', knn)
]
)

parameters = {
'mpute__max_iter': (15, 20),
'reduce__n_neighbors': (5, 10),
'reduce__min_dist': (0.02, 0.05),
'reduce__n_components': (2, 3),
'reduce__metric': ('euclidean', 'manhattan'),
'cluster__n_clusters': (2, 3),
'cluster__n_init': (10, 25)
}
# Changing parameter order above as below, GridSearchCV reports different best 
parameters.

# parameters = {
# 'mpute__max_iter': (20, 15),
# 'reduce__n_neighbors': (10, 5),
# 'reduce__min_dist': (0.05, 0.02),
# 'reduce__n_components': (3, 2),
# 'reduce__metric': ('manhattan', 'eucidean'),
# 'cluster__n_clusters': (3, 2),
# 'cluster__n_init': (25, 10)
# }


gsearch3 = GridSearchCV(pipe, parameters, n_jobs=-1, 
scoring=cv_silhouette_scorer , cv=5, verbose=1)
gsearch3.fit(dfnew)
-- 
https://mail.python.org/mailman/listinfo/python-list


GridSearchCV generates unexpected different best parameters by only changing the parameters order in param_grid. Where did I make mistake and how to fix this unexpected results?

2021-02-25 Thread Yi Li
I am using GridSearchCV to find the best parameter setting of my 
sklearn.pipeline estimator. The pipeline consists of data transformation, UMAP 
dimension reduction and Kmeans clustering.
The final Kmeans clustering results are scored using silhouette_score. I tried 
to verify the whole pipeline/GridSearchCV worked correctly by only changing the 
parameter order in param_grid (
e.g., change 'reduce__n_neighbors': (5, 10), to 'reduce__n_neighbors': (10, 
5)). I got totally different best parameters although I expect the parameter 
order change should not impact the 
best paramters determined by GridSearchCV. Where did I make mistake and how to 
fix this unexpected results?

Below is the code. The Debug class is used to save the output from 'reduce' 
step. This saved output is used in cv_silhouette_scorer() to calculate 
silhouette_score. I suspect Debug class and cv_silhouette_scorer() 
did not work as I expected. 

I really appreciate your help.

class Debug(BaseEstimator, TransformerMixin):
def __init__(self):
self.transX = None

def transform(self, X):
print(X)
self.transX = X.copy()
return X

def fit(self, X, y=None, **fit_params):
return self

def cv_silhouette_scorer(estimator, X):
# estimator.fit(X)
sdata = estimator.named_steps['debug'].transX
cluster_labels = estimator.named_steps['cluster'].labels_
num_labels = len(set(cluster_labels))
num_samples = sdata.shape[0]
if num_labels == 1 or num_labels == num_samples:
return -1
else:
return silhouette_score(sdata, cluster_labels)


ohe = OneHotEncoder(drop='if_binary', dtype=np.float32)
ore = OrdinalEncoder(dtype=np.float32)
ctenc = ColumnTransformer(transformers=[('ohe', ohe, nom_vars), ('ore', ore, 
ord_vars)], 
  remainder='passthrough')
nftr = FunctionTransformer(nominal_indicator_missing, check_inverse=False, 
  kw_args={'feat_names': ohecols, 'orig_cols': 
nom_vars})
oftr = FunctionTransformer(ordinal_indicator_missing, check_inverse=False,
kw_args={'miss_value': 0.})

ctmiss = ColumnTransformer(transformers=[('nftr', nftr, slice(0, 19)), ('oftr', 
oftr, slice(19, 20)), ('drop_cols', 'drop' , slice(32, 36) )], 
remainder='passthrough')

mputer = IterativeImputer(random_state=RS, add_indicator=True, 
initial_strategy="most_frequent", skip_complete=True)


# Add below keep_vars transformer to drop all demographic columns before pass 
to UMAP

keep_cols = ColumnTransformer(transformers=[('keep_cols1', 'passthrough' , 
slice(17, 25) ), ('keep_cols2', 'passthrough' , slice(46, 54) )] )

scaler = StandardScaler()

trans = FunctionTransformer(np.transpose, check_inverse=False)

dreduce = umap.UMAP(random_state=RS)
knn = KMeans(random_state=RS)
pipe = Pipeline(steps=[
('enc', ctenc)
, ('functr', ctmiss)
, ('mpute', mputer)
, ('keep_cols', keep_cols)
, ('scale', scaler)
, ('trans', trans)
, ('reduce', dreduce)
, ("debug", Debug())
, ('cluster', knn)
]
)

parameters = {
'mpute__max_iter': (15, 20),
'reduce__n_neighbors': (5, 10),
'reduce__min_dist': (0.02, 0.05),
'reduce__n_components': (2, 3),
'reduce__metric': ('euclidean', 'manhattan'),
'cluster__n_clusters': (2, 3),
'cluster__n_init': (10, 25)
}
# Changing parameter order above as below, GridSearchCV reports different best 
parameters.

# parameters = {
# 'mpute__max_iter': (20, 15),
# 'reduce__n_neighbors': (10, 5),
# 'reduce__min_dist': (0.05, 0.02),
# 'reduce__n_components': (3, 2),
# 'reduce__metric': ('manhattan', 'eucidean'),
# 'cluster__n_clusters': (3, 2),
# 'cluster__n_init': (25, 10)
# }

def cv_silhouette_scorer(estimator, X):
# estimator.fit(X)
sdata = estimator.named_steps['debug'].transX
cluster_labels = estimator.named_steps['cluster'].labels_
num_labels = len(set(cluster_labels))
num_samples = sdata.shape[0]
if num_labels == 1 or num_labels == num_samples:
return -1
else:
return silhouette_score(sdata, cluster_labels)

gsearch3 = GridSearchCV(pipe, parameters, n_jobs=-1, 
scoring=cv_silhouette_scorer , cv=5, verbose=1)
gsearch3.fit(dfnew)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter long-running window freezes

2021-02-25 Thread Richard Damon
On 2/24/21 6:35 AM, John O'Hagan wrote:
> Hi list
>
> I have a 3.9 tkinter interface that displays data from an arbitrary
> number of threads, each of which runs for an arbitrary period of time.
> A frame opens in the root window when each thread starts and closes
> when it stops. Widgets in the frame and the root window control the
> thread and how the data is displayed.
>
> This works well for several hours, but over time the root window
> becomes unresponsive and eventually freezes and goes grey. No error
> messages are produced in the terminal.
>
> Here is some minimal, non-threaded code that reproduces the problem on
> my system (Xfce4 on Debian testing):
>
> from tkinter import *
> from random import randint
>
> root = Tk()
>
> def display(label):
> label.destroy()
> label = Label(text=randint(0, 9))
> label.pack()
> root.after(100, display, label)
>
> display(Label())
> mainloop()
>  
> This opens a tiny window that displays a random digit on a new label
> every .1 second. (Obviously I could do this by updating the text rather
> than recreating the label, but my real application has to destroy
> widgets and create new ones).
>
> This works for 3-4 hours, but eventually the window freezes.
>
> The process uses about 26 Mb of memory at first, and this gradually
> increases to around 30 or so by the time it freezes.
>
> Any ideas what could be causing this, or even how to approach debugging
> or workarounds?
>
> Thanks
>
> --
>
> John

One thought is that repeatedly destroying and recreating a label might
be leaking a resource. One option would be to change the code to just
update the label rather than recreating it each time.  Simplest is
probably to link the Label to a StringVar instead of a fixed text and
updating the variable to change the text. You can also (I believe) go
into the Label and change the text it has with a configuration call.

-- 
Richard Damon

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


[issue43321] PyArg_ParseTuple() false-returns SUCCESS though SystemError and missing data (when PY_SSIZE_T_CLEAN not #define'd)

2021-02-25 Thread Robert


New submission from Robert :

When PY_SSIZE_T_CLEAN  is not #defined in Py3.10, PyArg_ParseTuple() etc. sets 
a SystemError but the return value says 1 (=SUCCESS)! 
=>  Causes terrific crashes with unfilled variables - instead of a clean Python 
exception.

Background: pywin32 suffers in masses from the drop of int support for the 
s#/y#/et#... formats in PyArg_ParseTuple() etc.  (PY_SSIZE_T_CLEAN is required 
in Py3.10). And only part of the source is already PY_SSIZE_T_CLEAN. Now it is 
very difficult to even run tests and weed out / check, because of freezes 
instead of nice Python exceptions.

=> Instead of preventing such freezes, the PY_SSIZE_T_CLEAN mechanism became 
the opposite: a clever trap, a sword of Damocles :)


The cause is in getargs.c:

=== getargs.c / convertsimple() 

#define REQUIRE_PY_SSIZE_T_CLEAN \
if (!(flags & FLAG_SIZE_T)) { \
PyErr_SetString(PyExc_SystemError, \
"PY_SSIZE_T_CLEAN macro must be defined for '#' 
formats"); \
return NULL; \
}
#define RETURN_ERR_OCCURRED return msgbuf

===


=> The return NULL is further processed as no msg NULL -> no error.  
=> Perhaps it should be a `return converterr(...)` or `return 
sstc_system_error(...)` !?

--
components: Interpreter Core
messages: 387678
nosy: kxrob
priority: normal
severity: normal
status: open
title: PyArg_ParseTuple() false-returns SUCCESS though SystemError and missing 
data (when PY_SSIZE_T_CLEAN  not #define'd)
type: crash
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



[issue37609] support "UNC" device paths in ntpath.splitdrive

2021-02-25 Thread Eryk Sun


Change by Eryk Sun :


Removed file: https://bugs.python.org/file48607/splitdrive.py

___
Python tracker 

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



[issue42914] pprint numbers with underscore

2021-02-25 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue43144] test_unicodedata: test_normalization uses network but doesn't depend on network resource

2021-02-25 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +ammar2
nosy_count: 3.0 -> 4.0
pull_requests: +23435
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24650

___
Python tracker 

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



[issue42914] pprint numbers with underscore

2021-02-25 Thread Stéphane Blondon

Stéphane Blondon  added the comment:

I add the same idea but later than you, so I'm interested by such feature.

Felipe: do you want to add a pull request to this issue (with Serhiy Storchaka 
implementation because it's the simplest one)?

If not, I plan to write it.
I will write it too if there is no reply in one month.

--
nosy: +sblondon

___
Python tracker 

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



[issue28824] os.environ should preserve the case of the OS keys ?

2021-02-25 Thread Eryk Sun


Eryk Sun  added the comment:

In Windows, maybe the os.environ mapping could use a case-insensitive subclass 
of str for its keys, such as the following:

@total_ordering
class _CaseInsensitiveString(str):
def __eq__(self, other):
if not isinstance(other, str):
return NotImplemented
return self.upper() == other.upper()

def __lt__(self, other):
if not isinstance(other, str):
return NotImplemented
return self.upper() < other.upper()

def __hash__(self):
return hash(self.upper())

Change encodekey() to use this type. For example:

def encodekey(key):
return _CaseInsensitiveString(encode(key))

in which encode() is still check_str().

--
components: +Library (Lib)
type:  -> behavior
versions: +Python 3.10, Python 3.9 -Python 3.7

___
Python tracker 

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



Re: Tkinter long-running window freezes

2021-02-25 Thread Terry Reedy

On 2/24/2021 6:53 PM, John O'Hagan wrote:

On Wed, 24 Feb 2021 11:03:30 -0500
Terry Reedy  wrote:


On 2/24/2021 6:35 AM, John O'Hagan wrote:

[...]


I am trying this out on Windows 10, with a wider label (so I can move
the window) and a button that changes when pressed, and a sequential
counter.  Will report when the Window freezes, or maybe a day if not.


Counter is up to 777000 with no problem.


Thank you! I've only run a few tests because of how long it takes
to freeze, but so far it seems that the trigger for the window freezing
is any attempt to interact with it, e.g. clicking on it, so try doing
that from time to time.


I clicked on Window, clicked on label, clicked on button (collectively 
at least 100 times), moved window all over screen, resized it multiple 
times, maximized it and restored it a couple of times, and no problem. 
I conclude for not that your issue does not occur on Windows.



Plus you seem to have a memory leak and may need to replicate that.


Can you explain what you mean by "replicate"?


I don't remember, so forget it.

--
Terry Jan Reedy

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


[issue43263] threading module unable to run

2021-02-25 Thread twoone3


twoone3 <3197653...@qq.com> added the comment:

After adding GIL, the problem still exists. If you think this problem is 
incomprehensible, it may be because I used Google Translation ..

--
Added file: https://bugs.python.org/file49835/Screenshot_20210225_224118.jpg

___
Python tracker 

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



[issue43263] threading module unable to run

2021-02-25 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy:  -mark.dickinson

___
Python tracker 

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



[issue43263] threading module unable to run

2021-02-25 Thread Mark Dickinson


Mark Dickinson  added the comment:

@twoone3: Shouldn't you be calling PyGILState_Ensure() before calling into 
Python from the C++ code?

In any case, I'm removing myself from the nosy list on this issue, because I 
don't have access to Windows to try to reproduce.

--

___
Python tracker 

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



[issue28654] sys.stdout.isatty() returns True even if redirected to NUL

2021-02-25 Thread Eryk Sun


Eryk Sun  added the comment:

Here's an example of how to change the isatty() method in Modules/_io/fileio.c 
to check for a console in Windows:

_io_FileIO_isatty_impl(fileio *self)
{
long res;

if (self->fd < 0)
return err_closed();
Py_BEGIN_ALLOW_THREADS
_Py_BEGIN_SUPPRESS_IPH
res = isatty(self->fd);
#ifdef MS_WINDOWS
if (res) {
DWORD mode;
HANDLE h = (HANDLE)_get_osfhandle(self->fd);
// It's a console if GetConsoleMode succeeds or if the last error
// isn't ERROR_INVALID_HANDLE. e.g., if 'con' is opened with 'w'
// mode, the error is ERROR_ACCESS_DENIED.
res = GetConsoleMode(h, ) ||
GetLastError() != ERROR_INVALID_HANDLE;
}
#endif
_Py_END_SUPPRESS_IPH
Py_END_ALLOW_THREADS
return PyBool_FromLong(res);
}

--
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.10, Python 3.9 -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue43320] test test_webbrowser "can't locate runnable browser" with enable-optimizations

2021-02-25 Thread Fabian Beitler


New submission from Fabian Beitler :

I downloaded the sources for python 3.8.8 (not tested with Python3.9.2. so 
far)and compiled it 
with enabled-optimisations parameter on a fresh Ubuntu 20.04 machine.

Beside the test_ssl error (there is an existing workaround, but still not happy 
with that one tbh) I could solve, the test "test_webbrowser" fails and I don't 
know how to handle that one.


ERROR: test_synthesize(test_webbrowser.ImportTest)

Traceback (most recent call last):
   File "Path/Python-3.8.8/Lib/test/test_webbrowser.py", line 299, in 
test_synthesize
   webbrowser.get(sys.executable)
File "Path/Python-3.8.8/Lib/webbrowser.py", line 65, in get 
raise Error("could not locate runnable browser")
webbrowser.Error: could not locate runnable browser

--
components: Tests
messages: 387672
nosy: swamper123
priority: normal
severity: normal
status: open
title: test test_webbrowser "can't locate runnable browser" with 
enable-optimizations
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



[issue43263] threading module unable to run

2021-02-25 Thread twoone3


twoone3 <3197653...@qq.com> added the comment:

Run Project1\x64\Release\Project2.exe

--

___
Python tracker 

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



[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

msg387668 was a little bit hasty. I'll try again:

Dong-hee Na:
> Hmm by the way the current implementation returns SQLITE_OK if the statement 
> is NULL, but it looks like return SQLITE_MISUSE if we apply this patch.
> Does it not cause any behavior regression? if so we should add news also.

No, behaviour still stays the same; no regressions introduced. The bug is 
triggered by executing an empty statement. This will pass an empty statement to 
pysqlite_step() in line 519 of Modules/_sqlite/cursor.c. Earlier, this returned 
SQLITE_OK. sqlite3_column_count(NULL) returns 0, so we slide through the rest 
of the loop without much happening. Now, pysqlite_step() returns SQLITE_MISUSE, 
which only results in the statement being reset in line 529, and the error 
cleared in line 530. Then we bail out of the loop.

So, the current comment is correct, the SQLite changelog was correct, the 
workaround and old comment was wrong.

I'm done :)

--

___
Python tracker 

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



[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> int rc = sqlite3_reset(NULL);
>printf("reset with NULL: %d %s\n", rc, sqlite3_errstr(rc));

Sorry, wrong test:

int rc = sqlite3_step(NULL);
printf("step with NULL: %d %s\n", rc, sqlite3_errstr(rc));

$ ./a.out
step with NULL: 21 bad parameter or other API misuse

--

___
Python tracker 

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



[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Ah, at last I found the source of the confusion: The SQLite changelog.

Quoting from msg387619 and https://sqlite.org/changes.html:

> From the SQLite 3.5.3 changelog:
> - sqlite3_step() returns SQLITE_MISUSE instead of crashing when called with a 
> NULL parameter.

I assumed this was correct without even trying it. This short snippet shows 
something else:

int rc = sqlite3_reset(NULL);
printf("reset with NULL: %d %s\n", rc, sqlite3_errstr(rc));

$ ./a.out
reset with NULL: 0 not an error


Gerhard's comment was right and the workaround was right. I'll adjust the 
comment.

Dong-hee Na:
> Hmm by the way the current implementation returns SQLITE_OK if the statement 
> is NULL, but it looks like return SQLITE_MISUSE if we apply this patch.
> Does it not cause any behavior regression? if so we should add news also.

Behaviour stays the same; no regressions introduced. I learned a lot about the 
sqlite3 module, and I relearned I should not trust changelogs/documentation 
without trying stuff myself first.

I'll adjust the erroneous comment and re-request a review, Dong-hee.

--

___
Python tracker 

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



[issue28364] Windows - Popen (subprocess.py) does not call _handle.Close() at all

2021-02-25 Thread Eryk Sun


Change by Eryk Sun :


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



[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2021-02-25 Thread Eryk Sun


Eryk Sun  added the comment:

The documentation of os.rename() should mention that on Windows the "operation 
will fail if src and dst are on different filesystems". For POSIX, instead of 
"will" it says "may", but the failure is a certainty in Windows since 
MOVEFILE_COPY_ALLOWED isn't used.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage:  -> needs patch
versions: +Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 -Python 
2.7

___
Python tracker 

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



[issue43318] pdb can't output the prompt message when successfully clear breakpoints by "filename:lineno"

2021-02-25 Thread huzhaojie


huzhaojie  added the comment:

Accroding to my test, it appears in python 3.8.0 and the latest 3.10 master 
branch, and I think other versions also have this bug.

The steps to reproduce the bug:

1. start pdb: python -m pdb foo.py

2. set a breakpoint on any line of the file:

(Pdb) b 2
Breakpoint 1 at foo.py:2
(Pdb) b
Num Type Disp Enb   Where
1   breakpoint   keep yes   at foo.py:2

3. when clear the breakpoint using breakpoint number, it will get a 
output("Deleted breakpoint 1 at ..."):

(Pdb) cl 1
Deleted breakpoint 1 at foo.py:2

4. set another breakpoint:

(Pdb) b 3
Breakpoint 2 at foo.py:3

5. if breakpoint is cleared using (filename:lineno), it gets nothing:

(Pdb)cl foo.py:2
(Pdb)

--

___
Python tracker 

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



[issue27889] ctypes interfers with signal handling

2021-02-25 Thread Eryk Sun


Change by Eryk Sun :


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



[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Christian Heimes


Christian Heimes  added the comment:

Back in the day I was of several core devs that took care of syncing code 
between Python 2 and 3 branches with a tool called "svnmerge". Commit 
380532117c2547bb0dedf6f85efa66d18a9abb88 is a svnmerge commit. The tool synced 
changesets in batches, which makes it harder to bisect changes.

--
nosy: +christian.heimes

___
Python tracker 

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



Announcing PyCon India 2021 Online

2021-02-25 Thread Chandan Kumar
Hello everyone,

I am Chandan Kumar, from Python India Community.

I would like to officially announce the 13th iteration of PyCon
India[1] for 2021.

Considering the health and safety of everyone involved, PyCon India
2021 will be taking place online as a 4-day event on Hopin[2] from
16th to 19th September 2021, including 2 conference days, 1 day of
workshops, and 2 days of Devsprints**.

The Call for Proposals for the conference will open in the first week
of March and close on 15th May 2021. We will be sending the
announcements for Call for Proposals soon.

You can read more about the conference on our announcement blog post[3].

Please join the Zulip discussion stream[4] to keep up with the updates
from the conference.

** Devsprints are subject to changes according to future planning.

[1] https://in.pycon.org
[2] https://hopin.com
[3] https://in.pycon.org/blog/2021/pycon-india-announcement.html
[4] https://pyconindia.zulipchat.com/#streams/275447/2021.2Fdiscussion

Please retweet the announcement to reach to all the interested parties
https://twitter.com/pyconindia/status/1364908887040663555


--
Chandan Kumar
On behalf of PyCon India 2021 Team
https://in.pycon.org/2021/
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland

Erlend Egeberg Aasland  added the comment:

Introduced by Christian Heimes 2007-12-14 in commit 
380532117c2547bb0dedf6f85efa66d18a9abb88, which is a merge from SVN (?) checkin 
r59471 by Gerhard Häring 
(https://mail.python.org/pipermail/python-checkins/2007-December/063968.html)

This corresponds to 
https://github.com/ghaering/pysqlite/commit/61b3cd9381750bdd96f8f8fc2c1b19f1dc4acef7,
 with a simple test added two commits later, 
https://github.com/ghaering/pysqlite/commit/7b0faed4ababbf1053caa2f5b2efc15929f66c4f
 That test was added to CPython in 2008-03-29 by Gerhard in commit 
e7ea7451a84636655927da4b9731d2eb37d1cf34, and it's still here.

--

___
Python tracker 

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



[issue20140] UnicodeDecodeError in ntpath.py when home dir contains non-ascii signs

2021-02-25 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> out of date
stage: needs patch -> 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



[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> Look at issue in which the workaround was added. Does it contain some 
> examples?

I'll check. Thanks.

--

___
Python tracker 

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



[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Look at issue in which the workaround was added. Does it contain some examples?

--

___
Python tracker 

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



[issue43318] pdb can't output the prompt message when successfully clear breakpoints by "filename:lineno"

2021-02-25 Thread Irit Katriel


Irit Katriel  added the comment:

Please provide instructions how to reproduce the bug. The patch would need a 
unit test as well.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread miss-islington


miss-islington  added the comment:


New changeset 69906c505b139cbd892866dbceeb607eff53ab3b by Miss Islington (bot) 
in branch '3.8':
bpo-43316:  gzip: CLI uses non-zero return code on error. (GH-24647)
https://github.com/python/cpython/commit/69906c505b139cbd892866dbceeb607eff53ab3b


--

___
Python tracker 

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



[issue17213] ctypes loads wrong version of C runtime, leading to error message box from system

2021-02-25 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> out of date
stage: needs patch -> 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



[issue43316] python -m gzip handles error incorrectly

2021-02-25 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +23433
pull_request: https://github.com/python/cpython/pull/24648

___
Python tracker 

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



  1   2   >