Re: Post request and encoding

2020-11-03 Thread Hernán De Angelis

I see. Should be "encoding". Thanks.

/H.

On 2020-11-03 19:30, Dieter Maurer wrote:

Hernán De Angelis wrote at 2020-11-2 10:06 +0100:

...
My request has the form:

header = {'Content-type':'application/xml', 'charset':'utf-8'}

Not your problem (which you have already resolved) but:
`charset` is not an individual header but a parameter
for the `Content-Type` header. For `xml` `utf-8` is the default charset.

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


[issue42207] Python 3.9 testing fails when building with clang and optimizations are enabled

2020-11-03 Thread serge-sans-paille


Change by serge-sans-paille :


--
pull_requests: +22054
pull_request: https://github.com/python/cpython/pull/23141

___
Python tracker 

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



Re: asyncio question

2020-11-03 Thread Kyle Stanley
 On Tue, Nov 3, 2020 at 3:27 AM Frank Millman  wrote:

> It works, and it does look neater. But I want to start some background
> tasks before starting the server, and cancel them on Ctrl+C.
>
> Using the 'old' method, I can wrap 'loop.run_forever()' in a
> try/except/finally, check for KeyboardInterrupt, and run my cleanup in
> the 'finally' block.
>
> Using the 'new' method, KeyboardInterrupt is not caught by
> 'server.serve_forever()' but by 'asyncio.run()'. It is too late to do
> any cleanup at this point, as the loop has already been stopped.
>
> Is it ok to stick to the 'old' method, or is there a better way to do this.
>

It's fine to stick with the older method in your case, as there's nothing
inherently wrong with continuing to use it. `asyncio.run()` is largely a
convenience function that takes care of some finalization/cleanup steps
that are often forgotten (cancelling remaining tasks, closing event loop's
default ThreadPoolExecutor, closing async generators, etc). If you want to
use custom KeyboardInterrupt handling and still use asyncio.run(), you can
either (a) use `loop.add_signal_handler()` or (b) make a slightly modified
local version of `asyncio.run()` that has your desired KeyboardInterrupt
behavior, based roughly on
https://github.com/python/cpython/blob/master/Lib/asyncio/runners.py.

However, using `loop.run_until_complete()` instead of `asyncio.run()` is
also perfectly fine, especially in existing code that still works without
issue. It just leaves the author with a bit more responsibility when it
comes to resource finalization and dealing with the event loop in general
(which can add some extra cognitive burden and room for error, particularly
when dealing with multiple event loops or threads). But it's reasonably
common to continue using `loop.run_until_complete()` in situations where
the default `asyncio.run()` behavior isn't what you need/want, such as your
case.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange terminal behavior after quitting Tkinter application

2020-11-03 Thread Christian Gollwitzer

Am 03.11.20 um 23:34 schrieb Dennis Lee Bieber:



Out of curiosity, does Python on Linux honor the .pyw extension?

On Windows, .pyw indicates a Python program that implements a GUI and
will NOT make use of console (stdin/stdout/stderr).


On Linux, there is no such distinction. On Windows it is only needed 
because, if you connect stdin/out, a terminal window pops up. >For a 
true GUI program that is notr acceptable, the user will be puzzled what 
this ugly useless window wants to do, and therefore a flag in the EXE 
file format indicates to Windows if it should pop up the console or not.


On Linux, stdin/out is always connected. You must run your program from 
a terminal window to see it, otherwise it is silently connected to some 
channel in the background by the desktop environment. It can happen that 
the standard channels are closed, if you run a program in the terminal 
and then close the terminal (which sends SIGHUP to the program). In this 
case the program might later on throw I/O errors, when printing to stdout.


Christian

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


[issue42257] platform.libc_ver() doesn't consider in case of executable is empty string

2020-11-03 Thread Kurochan


Change by Kurochan :


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

___
Python tracker 

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



[issue42257] platform.libc_ver() doesn't consider in case of executable is empty string

2020-11-03 Thread Kurochan


New submission from Kurochan :

Currently, `platform.libc_ver()` doesn't consider in case of `executable` 
variable is an empty string.
However, with Python 3.8, the following code could pass an empty string 
`executable` to the `platform.libc_ver()` function.

https://github.com/python/cpython/blob/efc782d29e229924076ffb6645a72f26242fb3ef/Lib/platform.py#L1205
https://docs.python.org/3/library/sys.html#sys.executable

Because the `sys.executable` could return an empty string, so I would like to 
add the empty string handler.

https://github.com/python/cpython/blob/efc782d29e229924076ffb6645a72f26242fb3ef/Lib/platform.py#L174

Or please also merge the following PR to Python 3.8.
https://github.com/python/cpython/pull/14418

--
components: Library (Lib)
messages: 380311
nosy: kurochan
priority: normal
severity: normal
status: open
title: platform.libc_ver() doesn't consider in case of executable is empty 
string
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



RE: Find word by given characters

2020-11-03 Thread Avi Gross via Python-list
Duncan, my comments below yours at end.

---YOURS---
The Counter approach only requires iterating over the letters once to
construct the letters bag, then each word once to create the relevant word
bag. After that it's (at worst) a couple of lookups and a comparison for
each unique character in letters (for each word).

Your approach requires iteration over the words to create the lists of
characters. Then they are (potentially) iterated over multiple times looking
for the characters in letters. There's also the cost of removing items from
arbitrary positions in the lists. Also, it seems that the character
frequencies must be equal, and your approach only ensures that the words
contain at least the required numbers of characters.

In computational terms, if the first approach is something like O(n+m) for n
letters and words of length m, your algorithm is more like O(nm).
Not to say that it will be slower for all possible letters and dictionaries,
but probably for any realistic cases and a lot slower for large enough
dictionaries.

Duncan

--MINE---

I appreciate your analysis. I have not looked at the "counter"
implementation and suspect it does some similar loops within, albeit it may
be implemented in a compiled language like C++.

I did not write out my algorithm in Python but have done it for myself. It
runs fast enough with most of the time spent in the slow I/O part. 

We can agree all algorithms have to read in all the words in a data file.
There may be ways to store the data such as in a binary tree and even ways
to thus prune the search as once a node is reached where all required
letters have been found, all further words qualify below that point. If you
match say "instant" then instants and instantiation would be deeper in the
tree and also qualify assuming extra letters are allowed. We may differ on
the requirement as I think that the number of repeats for something like
a,t,t require to be at least as big as in "attend" but that "attention" with
yet another "t" would also be OK. If I am wrong, fine, but I note the person
requesting this has admitted a certain lack of credentials while also
claiming he made up a scenario just for fun. So this is not actually a
particularly worthy challenge let alone with a purpose.

My impression is that the average word length would be something small like
5-7. The number of words in a dictionary might be 100,000 or more. So if you
want efficiency, where do you get the bang for the buck? 

I would argue that a simple test run on all the words might often narrow the
field to a much smaller number of answers like just a few thousand or even
much less. Say you test for the presence of "aeiou" in words, in whatever
order. That might be done from reading a file and filtering out a relatively
few potential answers. You can save those for  second round to determine if
they are fully qualified by any additional rules that may involve more
expensive operations.

How fast (or slow) are regular expressions for this purpose? Obviously it
depends on complexity and something like 
"^[^aeiou]*[aeiou] [^aeiou]*[aeiou] [^aeiou]*[aeiou] [^aeiou]*[aeiou]
[^aeiou]*[aeiou] [^aeiou]*$"

would be easy to construct once but likely horribly inefficient in searching
and a bit of overkill here. I suspect there is already some simple C
function that could be used from within python that looks like
findall(choices, word) that might return how many of the letters in choices
were found in word and you simply comparer that to length(word) perhaps more
efficiently.

It looks easier to check if a character exists in one of the ways already
discussed within python using a loop as discussed. Something as simple as
this:

  needed = "aeiou"
  trying = "education"
  found = all([trying.find(each) >= 0  for each in needed ])
  print(found)

  trying = "educated"
  found = all([trying.find(each) >= 0  for each in needed ])
  print(found)
  The above prints 

My point is you can use the above to winnow down possible answers and only
subject that smaller number to one of many tests including using a counter,
making a dictionary you can query (albeit probably slower for fairly short
words) and so on. 

Back to your other point, you suggest iterating over characters ( I happened
to do it in a list) multiple times can result in duplication as the same
characters are searched repeatedly. Sure. I simply note most words are
short. How much overhead is there searching for say nine characters five
times? Compare that to say creating a dictionary or other data structure
once, and then making a hash out of each letter being searched for? I can
envision many possible ways to speed this up but many involve more use of
memory or all other kinds of overhead such as initializing an object and
calling various member functions and then deleting it or re-initializing it.
My suggestion of removing items from a short list is not ideal and depending
on how a bag was otherwise implemented, I could see it being better but

[issue42049] Add image/webp to list of media types in mimetypes.py

2020-11-03 Thread Inada Naoki


Change by Inada Naoki :


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



[issue42205] Add image/webp to list of non-standard mimetypes

2020-11-03 Thread Inada Naoki


Change by Inada Naoki :


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



[issue38902] image/webp support in mimetypes

2020-11-03 Thread Inada Naoki


Inada Naoki  added the comment:

I'm +1 to add it in common types, because webp is really de-facto standard.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types

If no objection, I will merge this in next week.

--
nosy: +methane
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



[issue4999] multiprocessing.Queue does not order objects

2020-11-03 Thread Irit Katriel


Irit Katriel  added the comment:

I see the documentation mentions it now (in the second gray box here:
https://docs.python.org/3.8/library/multiprocessing.html#pipes-and-queues )

and it also suggests to use a shared queue if this is an issue. 


Any objections to closing this issue?

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

___
Python tracker 

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



[issue38902] image/webp support in mimetypes

2020-11-03 Thread waicalibre


Change by waicalibre :


--
pull_requests: +22052
pull_request: https://github.com/python/cpython/pull/23034

___
Python tracker 

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



[issue42205] Add image/webp to list of non-standard mimetypes

2020-11-03 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> duplicate
superseder:  -> image/webp support in mimetypes

___
Python tracker 

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



[issue42049] Add image/webp to list of media types in mimetypes.py

2020-11-03 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> duplicate
superseder:  -> image/webp support in mimetypes

___
Python tracker 

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



[issue38902] image/webp support in mimetypes

2020-11-03 Thread waicalibre


Change by waicalibre :


--
keywords: +patch
nosy: +waicalibre
nosy_count: 3.0 -> 4.0
pull_requests: +22051
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22718

___
Python tracker 

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



Re: Find word by given characters

2020-11-03 Thread duncan smith
On 03/11/2020 22:14, Avi Gross wrote:
> I, too, have wondered what exactly the point was of the required
> functionality for SCRABBLE but note you can extend a current word so
> additional letters may be available in a game but only if they are an exact
> fit to put before, after, or in middle of your word. 
> 
> But this seems to be a fairly simple problem to solve unless I misunderstand
> it. Elegance aside, what would be wrong with this approach.
> 
> - Read a word at a time in a loop from the file of dictionary words
> (non-Python meaning of dictionary.) For each one do the following, perhaps
> using a function:
> 
> Break the current word into a list of individual letters.
> Loop over the letters you want and:
>   If the letter is in the list, remove it and continue
>   Else skip the current word as it is not a match.
> 
> At the end of each of the above loops, you only reached here if all the
> letters were found and removed. If the list is now empty, fine. If it has
> extra remaining letters, also fine by the requirements stated. Letters in
> the list multiple times are removed multiple times.
> 
> The above need not use  list of letters and can be done many other ways but
> seems conceptually simple. Each word is processed once. It can be converted
> to using a list comprehension or something similar by using "all" and so on.
> 
> Or am I missing something about other approaches being better or more
> efficient or ... And, yes, counting may have an advantage as the list does
> not need to be modified repeatedly but creating an object or three also has
> overhead.

[snip]

The Counter approach only requires iterating over the letters once to
construct the letters bag, then each word once to create the relevant
word bag. After that it's (at worst) a couple of lookups and a
comparison for each unique character in letters (for each word).

Your approach requires iteration over the words to create the lists of
characters. Then they are (potentially) iterated over multiple times
looking for the characters in letters. There's also the cost of removing
items from arbitrary positions in the lists. Also, it seems that the
character frequencies must be equal, and your approach only ensures that
the words contain at least the required numbers of characters.

In computational terms, if the first approach is something like O(n+m)
for n letters and words of length m, your algorithm is more like O(nm).
Not to say that it will be slower for all possible letters and
dictionaries, but probably for any realistic cases and a lot slower for
large enough dictionaries.

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


Re: Help

2020-11-03 Thread Grant Edwards
On 2020-11-04, Quentin Bock  wrote:
> So, I'm newer to Python and I'm messing around with math functions and
> multiplication, etc. here is my line of code:
>
> def multiply(numbers):
>   total = 1
>  for x in numbers:
>  total *= x
>  return total
> print(multiply((8, 2, 3, -1, 7)))
>
> When I run this, my answer is 8 but it should be 336 can some help ._.

1. If you're using tabs to indent; don't. It results in hard-to
   diagnose problems. Use spaces to indent.

2. Cut/past the exact code when asking questions. The code you
   posted does not print 8. It doesn't run at all:

$ cat bar.py
def multiply(numbers):
  total = 1
 for x in numbers:
 total *= x
 return total
print(multiply((8, 2, 3, -1, 7)))

$ python bar.py

  File "bar.py", line 3
for x in numbers:
^
IndentationError: unexpected indent

3. The answer you want is not 336, it's -336:

$ cat foo.py
def multiply(numbers):
total = 1
for x in numbers:
total *= x
return total

print(multiply((8,2,3,-1,7)))

$ python foo.py
-336

4. I suspect that your actual code looks like this:

$ cat foo.py
def multiply(numbers):
total = 1
for x in numbers:
total *= x
return total

print(multiply((8,2,3,-1,7)))

$ python foo.py
8

See the difference between #3 and #4?


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


[issue15128] inspect raises exception when frames are misleading about source line numbers

2020-11-03 Thread Irit Katriel


Change by Irit Katriel :


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



[issue5537] LWPCookieJar cannot handle cookies with expirations of 2038 or greater on 32-bit platforms

2020-11-03 Thread Irit Katriel


Change by Irit Katriel :


--
keywords:  -patch
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.6

___
Python tracker 

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



Re: Help

2020-11-03 Thread Skip Montanaro
>
> When I run this, my answer is 8 but it should be 336 can some help ._.
>

Looks like you are returning from inside the loop.

Skip

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


[issue17344] checking size of size_t... configure: error:

2020-11-03 Thread Irit Katriel


Change by Irit Katriel :


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



[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2020-11-03 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
resolution:  -> out of date
stage: test needed -> resolved
status: pending -> closed

___
Python tracker 

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



[issue1643712] Emphasize buffering issues when sys.stdin is used

2020-11-03 Thread Irit Katriel


Irit Katriel  added the comment:

Closed along with 1633941.

--
nosy: +iritkatriel
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



Help

2020-11-03 Thread Quentin Bock
So, I'm newer to Python and I'm messing around with math functions and
multiplication, etc. here is my line of code:
def multiply(numbers):
  total = 1
 for x in numbers:
 total *= x
 return total
print(multiply((8, 2, 3, -1, 7)))

When I run this, my answer is 8 but it should be 336 can some help ._.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find word by given characters

2020-11-03 Thread duncan smith
On 03/11/2020 23:35, Bischoop wrote:
> On 2020-11-03, duncan smith  wrote:
>>>
>>
> from collections import Counter
> letters = 'att'
> letter_counts = Counter(letters)
> word = 'tolerate'
> wd_counts = Counter(word)
> for char, cnt in letter_counts.items():
>>  print (cnt == wd_counts[char])
>>
>>  
>> True
>> True
> word = 'auto'
> wd_counts = Counter(word)
> for char, cnt in letter_counts.items():
>>  print (cnt == wd_counts[char])
>>
>>  
>> True
>> False
>
>>
>> or, equivalent to the above loop, but breaking when the first False is
>> generated and returning the single Boolean that you're after,
>>
> all(cnt == wd_counts[char] for char, cnt in letter_counts.items())
>> False
>
>>
>> There's still a lot of scope for improvement, but possibly not by doing
>> simple things
> 
> 
> lol
> 
> I'm thinking about it for a couple days and you guys coming with few
> ideas to it like it's nothing.
> Pity I've wasted a decade with woman, now probably to old to learn
> anything new.
> 

It looks like you've learnt something about wasting time with women ;-).
Keep tinkering as long as you're enjoying it (or getting paid for it)
and pick up knowledge of relevant data structures and algorithms as you
go. (That's what I've done. I'm actually a statistician.) The above
solution uses bags (implemented in Python as Counter instances), and the
(repeated) generation of the letters bag was hoisted outside the for
loop. (If the dictionary was going to be searched for multiple sets of
letters the generation of the word bags would also be hoisted.) There's
also the idea of breaking out of the loop once the first False is
generated (implemented most neatly by using all). So there might be
something useful to take from it.

A bag was the obvious data structure because the solution depends only
on the unique characters in a string and their frequencies. But that's
thinking about the problem word by word. We actually have a dictionary
of words, and a dictionary can be structured so that it can be searched
much more efficiently than 'word by word'. The particular data structure
I have in mind is not (yet) in the standard Python library. That's maybe
worth looking at when you've got the word by word approach grokked.

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


[issue42252] Embeddable Python indicates that it uses PYTHONPATH

2020-11-03 Thread Tom Kent


Tom Kent  added the comment:

A couple things...

>> One possible use-case is to package it along with another program to use the 
>> interpreter.

> This is the primary use case. If you're doing something else with it, you're 
> probably misusing it :)

Interesting, I'd been expecting this was commonly used as the way to give 
access to python3X.dll. We actually do (or are trying to do) both from our 
installation.



I've been mostly focusing on `PYTHONPATH` because that's where I encountered 
the issue. Which if any of the other env variables are respected? 



Would there be an argument to add additional command line options that could be 
used as a more secure alternative to the env variables? A command line argument 
`-e` that is the opposite of `-E` and enables the usage of PYTHON* env? Maybe 
this doesn't make sense since you said it is the ._pth that causes this...just 
thinking aloud.

The two options you mention (modify ._pth and append to sys.path) aren't great 
because we 1) would prefer to use the un-modified python distro 2) don't own 
the scripts that we are embedding, they are from a 3rd party so modifications 
are complicated.

--

___
Python tracker 

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



[issue42252] Embeddable Python indicates that it uses PYTHONPATH

2020-11-03 Thread Steve Dower


Steve Dower  added the comment:

Updating the documentation link on the download page is being discussed as we 
speak.

> One possible use-case is to package it along with another program to use the 
> interpreter.

This is the primary use case. If you're doing something else with it, you're 
probably misusing it :)

> In this case, the user may assume that adding something to the `PYTHONPATH` 
> env variable, as most of the launching methods allow, would take hold.

Agreed. The documentation explains this, though likely doesn't make clear 
enough that it's the presence of the ._pth file that triggers the behaviour.

> ... then promptly look at python --help when that fails. 

I'm pretty sure the help text is generated before we've tried to detect any 
local configuration, so it's far from trivial to make it dynamic based on 
context. 

> Maybe a better question is why should the embeddable distribution's 
> python.exe ignore env variables? Wouldn't it make more sense to depend on the 
> user to add a `-E` if that is what they desire?

It's to make it non-exploitable by default. The theory being that it will 
likely be installed into Program Files by an admin, which means file-based 
configuration is locked down from regular users and an attacker can't rely on a 
fully functioning Python runtime being present. 
 Most people wildly underestimate how exploitable CPython is via environment 
variables.

In an embedded scenario, you also have other ways to update paths, either 
statically (in the ._pth file) or in Python code (via sys.path modification). 
And you can of course delete the ._pth file if you don't feel you need the 
isolation, but there are legitimate reasons we don't recommend that one.

Not enough of this is documented that well, unfortunately. It sounds like we 
should:
* add a note to the environment variables section of --help that some other 
options may disable these
* add a link to https://docs.python.org/3/using/windows.html#windows-embeddable 
back to the download page (it was removed in the 3.9 releases for some reason)
* expand that doc section to link forward to 
https://docs.python.org/3/using/windows.html#finding-modules and maybe 
rearrange for making it more obvious how to use this package

--
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue42225] Tkinter hangs or crashes when displaying astral chars

2020-11-03 Thread Kevin Walzer


Kevin Walzer  added the comment:

Some work has been done this year on expanding support for these types of 
glyphs in Tk, but I'm not sure of its current state--it's not my area of 
expertise. Can you open a ticket at https://core.tcl-lang.org/tk/ so one of the 
folks working on this can take a look?

--

___
Python tracker 

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



Re: Strange terminal behavior after quitting Tkinter application

2020-11-03 Thread MRAB

On 2020-11-03 20:11, David Burnette wrote:

On Wednesday, April 18, 2007 at 12:33:24 AM UTC-7, Chris wrote:

Hi,
I'm puzzled by some strange behavior when my Python/Tkinter
application quits (on linux): the terminal from which I started Python
is messed up.
If start up python, then import the code below, then start the program
with Application(), then click the Quit button, my terminal never
prints anything again (such as commands I type).

import Tkinter
import sys
class Application(Tkinter.Tk):
def __init__(self,**config):
Tkinter.Tk.__init__(self,**config)

Tkinter.Button(self,text="Quit",command=self.quit_application).pack()
def quit_application(self):
sys.exit()


Can anyone tell me what I'm doing wrong?
Thanks for your help.
Chris


I notice this same behavior with other tk applications like "tkdiff".
So what is the correct cleanup for a proper exit from a plain Tk application?


Updated to Python 3, it should be more like this:

import tkinter
import sys

class Application(tkinter.Tk):
def __init__(self,**config):
tkinter.Tk.__init__(self, **config)
tkinter.Button(self, text="Quit", 
command=self.quit_application).pack()


def quit_application(self):
self.destroy()

Application().mainloop()
--
https://mail.python.org/mailman/listinfo/python-list


Re: Find word by given characters

2020-11-03 Thread dn via Python-list

On 04/11/2020 12:27, Bischoop wrote:

On 2020-11-03, Chris Angelico  wrote:


This seems strangely backwards for a Scrabble game. Normally you would
have a set of available tiles, and you have to form a word using only
those tiles, but it doesn't necessarily have to use them all. You seem
to have something where you must use all the tiles you have, and may
use any number of others. But, no matter; it can be done either way.



I know, it's useless I just came to idea to do something when was
learning, now I remembered long time ago I've done it somehow with list
and len() probably, this time I came to idea to rewrite using count. But
it seems I'm crap and takes me hell a lot of time to get on it.



Don't beat yourself up about it. As you have already noted, it is 
difficult for an 'apprentice' to know things (s)he has yet to learn - 
and that was related to Python-language features. On top of that, it is 
another difficult and quite different skill to write a specification 
which is accurate, complete, and meaningful to coders...


Do I recall that you are 'coming back' to Python, and as an hobbyist? 
Rather than setting your own specs, why not work from those set by 
others? If you want to learn the Python language, and especially if you 
also mean 'programming' as an art?science, why not add some structure 
and follow a text-book or an on-line course?


For example, Dr Chuck's (famous and long-standing) courses and other 
U.Mich offerings are available from 
https://www.coursera.org/search?query=python; (624 'hits'!). You will 
find similar (perhaps I notice a DataScience/ML bias?) on edx.org 
(https://www.edx.org/search?q=python=course)


Your thoughts?


Disclaimer: I train from the edX platform - but not in Python.
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Find word by given characters

2020-11-03 Thread Bischoop
On 2020-11-03, duncan smith  wrote:
>> 
>
 from collections import Counter
 letters = 'att'
 letter_counts = Counter(letters)
 word = 'tolerate'
 wd_counts = Counter(word)
 for char, cnt in letter_counts.items():
>   print (cnt == wd_counts[char])
>
>   
> True
> True
 word = 'auto'
 wd_counts = Counter(word)
 for char, cnt in letter_counts.items():
>   print (cnt == wd_counts[char])
>
>   
> True
> False

>
> or, equivalent to the above loop, but breaking when the first False is
> generated and returning the single Boolean that you're after,
>
 all(cnt == wd_counts[char] for char, cnt in letter_counts.items())
> False

>
> There's still a lot of scope for improvement, but possibly not by doing
> simple things


lol

I'm thinking about it for a couple days and you guys coming with few
ideas to it like it's nothing.
Pity I've wasted a decade with woman, now probably to old to learn
anything new.

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


Re: Find word by given characters

2020-11-03 Thread Bischoop
On 2020-11-03, Chris Angelico  wrote:
>
> This seems strangely backwards for a Scrabble game. Normally you would
> have a set of available tiles, and you have to form a word using only
> those tiles, but it doesn't necessarily have to use them all. You seem
> to have something where you must use all the tiles you have, and may
> use any number of others. But, no matter; it can be done either way.
>

I know, it's useless I just came to idea to do something when was
learning, now I remembered long time ago I've done it somehow with list
and len() probably, this time I came to idea to rewrite using count. But
it seems I'm crap and takes me hell a lot of time to get on it.

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


[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2020-11-03 Thread Irit Katriel


Irit Katriel  added the comment:

Since this is a python 2 only issue, should this issue be closed as out of date?

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

___
Python tracker 

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



[issue42100] Add _PyType_GetModuleByDef

2020-11-03 Thread Petr Viktorin


Change by Petr Viktorin :


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



[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-11-03 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Can we write those info to docs? In case some developer want to exposing slot 
> in future.

Do you mean something like "only expose a slot if you have a reason for 
exposing it"? That sounds like a tautology.
Where in the docs would this go?

> nb_inserved in PyNumberMethods should be removed?

You mean nb_reserved, right?
It can't be removed; old-style initialization is positional.
But it could be replaced according to PEP387:
- in 3.x, raise a warning if it is not set to NULL (in static types)
- in 3.x+2, throw an error if it is not set to NULL (in static types)
- in 3.x+3 or later, it can be replaced by another slot, if there's something 
we need to add to PyNumberMethods

--

___
Python tracker 

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



RE: Find word by given characters

2020-11-03 Thread Avi Gross via Python-list
I, too, have wondered what exactly the point was of the required
functionality for SCRABBLE but note you can extend a current word so
additional letters may be available in a game but only if they are an exact
fit to put before, after, or in middle of your word. 

But this seems to be a fairly simple problem to solve unless I misunderstand
it. Elegance aside, what would be wrong with this approach.

- Read a word at a time in a loop from the file of dictionary words
(non-Python meaning of dictionary.) For each one do the following, perhaps
using a function:

Break the current word into a list of individual letters.
Loop over the letters you want and:
If the letter is in the list, remove it and continue
Else skip the current word as it is not a match.

At the end of each of the above loops, you only reached here if all the
letters were found and removed. If the list is now empty, fine. If it has
extra remaining letters, also fine by the requirements stated. Letters in
the list multiple times are removed multiple times.

The above need not use  list of letters and can be done many other ways but
seems conceptually simple. Each word is processed once. It can be converted
to using a list comprehension or something similar by using "all" and so on.

Or am I missing something about other approaches being better or more
efficient or ... And, yes, counting may have an advantage as the list does
not need to be modified repeatedly but creating an object or three also has
overhead.

-Original Message-
From: Python-list  On
Behalf Of Chris Angelico
Sent: Tuesday, November 3, 2020 12:35 PM
To: Python 
Subject: Re: Find word by given characters

On Wed, Nov 4, 2020 at 1:11 AM Bischoop  wrote:
> Let me clarify what I want to do:
> We all know Scrabble game.
> there's a file with Dictionary containing word in each line, the idea 
> is to input some letters for example mentioned earlier: att, the 
> script supposed to find all words in which letters: 'a','t','t' occur 
> and print these words. It supposed not to print word: 'auto' because 
> there's only one 't' but words such as: 'toast', 'toasty', 'tolerant' 
> are meeting the criteria becase we have in these words one 'a' and two 
> 't' as user has input.
> I've checked collections counter but seems to complicated for me at 
> this stage yet and I'm struggling with applying it.

This seems strangely backwards for a Scrabble game. Normally you would have
a set of available tiles, and you have to form a word using only those
tiles, but it doesn't necessarily have to use them all. You seem to have
something where you must use all the tiles you have, and may use any number
of others. But, no matter; it can be done either way.

>>> from collections import Counter
>>> Counter("att") <= Counter("toast")
True
>>> Counter("att") <= Counter("toasty")
True
>>> Counter("att") <= Counter("tolerant")
True
>>> Counter("att") <= Counter("auto")
False

A Counter can behave like a multiset. If you picture the <= operator as
being "is a subset of", and then squint a little, irritate your math
teacher, and pretend that a set can have more than one of the same thing in
it, then a Counter's less-than-or-equal operator will tell you if one
multiset is a subset of another.

(The normal way to play Scrabble would simply reverse the operands, so you'd
ask if the word is <= the tiles you have. It's otherwise exactly the same
check.)

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

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


[issue41832] PyType_FromSpec() should accept tp_doc=NULL

2020-11-03 Thread Petr Viktorin


Petr Viktorin  added the comment:

The PyType_Slot documentation says that the pointer may not be NULL: 
https://docs.python.org/3/c-api/type.html?highlight=pytype_fromspec#c.PyType_Slot.PyType_Slot.pfunc

If you change this, why do it only for tp_doc, but for all the slots? NULL 
should *always* mean that the slot is set to NULL instead of inherited. (Except 
maybe in cases where this is dangerous; then it should result in an error?)
See: https://bugs.python.org/issue26979

If you want to only change this for tp_doc, please also update the PyType_Slot 
documentation to cover the exception.

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue42249] Plistlib cannot create binary Plist file larger than 4GiB

2020-11-03 Thread miss-islington


miss-islington  added the comment:


New changeset 9bc07874e34930d4e816a9a3330aab009404991e by Miss Skeleton (bot) 
in branch '3.9':
bpo-42249: Fix writing binary Plist files larger than 4 GiB. (GH-23121)
https://github.com/python/cpython/commit/9bc07874e34930d4e816a9a3330aab009404991e


--

___
Python tracker 

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



[issue40077] Convert static types to heap types: use PyType_FromSpec()

2020-11-03 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +22050
pull_request: https://github.com/python/cpython/pull/23136

___
Python tracker 

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



[issue42254] inspect.getmembers iterator version

2020-11-03 Thread signing_agreement


signing_agreement  added the comment:

That is a fair point. I selected a few popular python libraries to test, and 
they all return a small list.

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



[issue42064] Convert sqlite3 to multi-phase initialisation (PEP 489)

2020-11-03 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

FYI, rebased https://github.com/erlend-aasland/cpython/tree/bpo-42064/all onto 
master, added Petr Viktorin's _PyType_GetModuleByDef() for use in item 7 
(module state). I still run into problems in item 8, but I haven't devoted much 
time for this yet:
Modules/gcmodule.c:116: gc_decref: Assertion "gc_get_refs(g) > 0" failed: 
refcount is too small
Enable tracemalloc to get the memory block allocation traceback

object address  : 0x7f861140c6b0
object refcount : 2
object type : 0x10978
object type name: type
object repr : 

Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: finalizing (tstate=0x7f8631409000)

--

___
Python tracker 

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



Re: Strange terminal behavior after quitting Tkinter application

2020-11-03 Thread David Burnette
On Wednesday, April 18, 2007 at 12:33:24 AM UTC-7, Chris wrote:
> Hi,
> I'm puzzled by some strange behavior when my Python/Tkinter
> application quits (on linux): the terminal from which I started Python
> is messed up.
> If start up python, then import the code below, then start the program
> with Application(), then click the Quit button, my terminal never
> prints anything again (such as commands I type).
> 
> import Tkinter
> import sys
> class Application(Tkinter.Tk):
> def __init__(self,**config):
> Tkinter.Tk.__init__(self,**config)
> 
> Tkinter.Button(self,text="Quit",command=self.quit_application).pack()
> def quit_application(self):
> sys.exit()
> 
> 
> Can anyone tell me what I'm doing wrong?
> Thanks for your help.
> Chris

I notice this same behavior with other tk applications like "tkdiff".
So what is the correct cleanup for a proper exit from a plain Tk application?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42254] inspect.getmembers iterator version

2020-11-03 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I personally don't think it is worthwhile to add another API for this without a 
good use case.  The memory overhead of eagerly creating a list should be fairly 
small.

--

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files in reference cycles

2020-11-03 Thread Volker Weißmann

Change by Volker Weißmann :


--
nosy: +Volker Weißmann
nosy_count: 12.0 -> 13.0
pull_requests: +22049
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23135

___
Python tracker 

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



[issue42256] BaseCookie.__parse_string() doesn't work with expires= between cookies

2020-11-03 Thread Paulie Pena


Paulie Pena  added the comment:

whoops, the first string should also be a raw string, i.e. `r'...'`

--

___
Python tracker 

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



[issue42205] Add image/webp to list of non-standard mimetypes

2020-11-03 Thread Éric Araujo

Éric Araujo  added the comment:

Hello!  Why open a second ticket?

--
nosy: +eric.araujo

___
Python tracker 

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



[issue42254] inspect.getmembers iterator version

2020-11-03 Thread signing_agreement


signing_agreement  added the comment:

The object it deals with is already loaded, but in cases I see online, users 
tend to examine one member at a time.

--

___
Python tracker 

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



[issue42100] Add _PyType_GetModuleByDef

2020-11-03 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue42256] BaseCookie.__parse_string() doesn't work with expires= between cookies

2020-11-03 Thread Paulie Pena


New submission from Paulie Pena :

Since `requests` creates a comma-separated list for any duplicated headers, 
this causes a problem when `expires=...` is between two `Set-Cookie` header 
values. `BaseCookie.__parse_string()` in 
https://github.com/python/cpython/blob/master/Lib/http/cookies.py, in that 
case, will just give up, since it thinks it was given an invalid cookie. The 
fix is to replace the comma at the end of each trailing `expires=...` with a 
semicolon. Inside `BaseCookie.__parse_string()`, before the `while` loop, all 
that should be needed is to add this:
```
str = re.sub('(=\w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT),', r'\1;', str)
```

--
components: Library (Lib)
messages: 380294
nosy: paulie4
priority: normal
severity: normal
status: open
title: BaseCookie.__parse_string() doesn't work with expires= between cookies
type: behavior
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



[issue42255] webbrowser.MacOSX is unused, untested and undocumented

2020-11-03 Thread Ronald Oussoren


New submission from Ronald Oussoren :

class webbrower.MacOSX is untested and undocumented. It is also not used by 
webbrowser itself (webbrowser.MacOSXOSAScript is used to launch browsers).

It's probably safe to just remove the class, otherwise deprecate in 3.10 for 
removal in 3.11.

--
components: Library (Lib), macOS
messages: 380293
nosy: ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: webbrowser.MacOSX is unused, untested and undocumented
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



[issue38647] Why only the MacOSXOSAScript in webbrowser does not have the name property?

2020-11-03 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I've created a PR for adding the attribute.

--

___
Python tracker 

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



[issue38647] Why only the MacOSXOSAScript in webbrowser does not have the name property?

2020-11-03 Thread Ronald Oussoren


Change by Ronald Oussoren :


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

___
Python tracker 

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



[issue42158] http.server doesn't guess n-quads, n-triples, notation3 and TriG MIME types

2020-11-03 Thread Éric Araujo

Éric Araujo  added the comment:

Editing /etc/mime.types is one way of customizing the types returned; another 
one is to make a pull request to add them to the list inside the mimetypes 
module.

--
nosy: +eric.araujo
stage:  -> needs patch
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



Re: Post request and encoding

2020-11-03 Thread Dieter Maurer
Hernán De Angelis wrote at 2020-11-2 10:06 +0100:
> ...
>My request has the form:
>
>header = {'Content-type':'application/xml', 'charset':'utf-8'}

Not your problem (which you have already resolved) but:
`charset` is not an individual header but a parameter
for the `Content-Type` header. For `xml` `utf-8` is the default charset.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue7175] Define a standard location and API for configuration files

2020-11-03 Thread Éric Araujo

Éric Araujo  added the comment:

This ticket did not reach a consensus.  It seems there would be little value in 
changing the existing scheme for IDLE and such; external tools can (and often 
do) already use appdirs; I suggest closing this.

--

___
Python tracker 

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



Fwd: [RELEASE] Python 3.10.0a2 available for testing

2020-11-03 Thread Pablo Galindo Salgado
The engines of the secret release manager machine have finished producing a
new pre-release. Go get it here:

https://www.python.org/downloads/release/python-3100a2/


*Major new features of the 3.10 series, compared to 3.9*

Python 3.10 is still in development. This releasee, 3.10.0a2 is the second
of six planned alpha releases. Alpha releases are intended to make it
easier to test the current state of new features and bug fixes and to test
the release process. During the alpha phase, features may be added up until
the start of the beta phase (2021-05-03) and, if necessary, may be modified
or deleted up until the release candidate phase (2021-10-04). Please keep
in mind that this is a preview release and its use is not recommended for
production environments.

Many new features for Python 3.10 are still being planned and written.
Among the new major new features and changes so far:

PEP 623 -- Remove wstr from Unicode
PEP 604 -- Allow writing union types as X | Y
PEP 612 -- Parameter Specification Variables
PEP 626 -- Precise line numbers for debugging and other tools.
(Hey, fellow core developer, if a feature you find important is missing
from this list, let Pablo know.)
The next pre-release of Python 3.10 will be 3.10.0a3, currently scheduled
for 2020-12-07.

*And now for something completely different *

The cardinality (the number of elements) of infinite sets can be one of the
most surprising results of set theory. For example, there are the same
amount of even natural numbers than natural numbers (which can be even or
odd). There is also the same amount of rational numbers than natural
numbers. But on the other hand, there are more real numbers between 0 and 1
than natural numbers! All these sets have infinite cardinality but turn out
that some of these infinities are bigger than others. These infinite
cardinalities normally are represented using aleph numbers. Infinite sets
are strange beasts indeed.

Regards from cold London,
Pablo Galindo Salgado
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Solaris 11 GUI framework

2020-11-03 Thread Grant Edwards
On 2020-11-02, Igor Korot  wrote:
> On Mon, Nov 2, 2020, 3:57 PM Jay Braun  wrote:
>
>> Looking for a GUI framework supported on Solaris 11.
>
> Wxpython, pygtk, Java.

I wouldn't start a new project with pygtk. It's obsolete (Python2
only) and is no longer supported/available on some platforms. It's
been replace by PyGObject

  https://pygobject.readthedocs.io/en/latest/

Porting from PyGtk to PyGObject is pretty straight-forward, but
PyGObject is definitely less "Pythonic". While PyGtk was a
hand-crafted set of python bindings for GTK2, PyGObject is sort-of
automated based on the standard introspection features of GObject
libraries. I've heard this requires a lot less maintenance than the
old PyGTK bindings.

--
Grant

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


[RELEASE] Python 3.10.0a2 available for testing

2020-11-03 Thread Pablo Galindo Salgado
The engines of the secret release manager machine have finished producing a
new pre-release. Go get it here:

https://www.python.org/downloads/release/python-3100a2/


*Major new features of the 3.10 series, compared to 3.9*

Python 3.10 is still in development. This releasee, 3.10.0a2 is the second
of six planned alpha releases. Alpha releases are intended to make it
easier to test the current state of new features and bug fixes and to test
the release process. During the alpha phase, features may be added up until
the start of the beta phase (2021-05-03) and, if necessary, may be modified
or deleted up until the release candidate phase (2021-10-04). Please keep
in mind that this is a preview release and its use is not recommended for
production environments.

Many new features for Python 3.10 are still being planned and written.
Among the new major new features and changes so far:

PEP 623 -- Remove wstr from Unicode
PEP 604 -- Allow writing union types as X | Y
PEP 612 -- Parameter Specification Variables
PEP 626 -- Precise line numbers for debugging and other tools.
(Hey, fellow core developer, if a feature you find important is missing
from this list, let Pablo know.)
The next pre-release of Python 3.10 will be 3.10.0a3, currently scheduled
for 2020-12-07.

*And now for something completely different *

The cardinality (the number of elements) of infinite sets can be one of the
most surprising results of set theory. For example, there are the same
amount of even natural numbers than natural numbers (which can be even or
odd). There is also the same amount of rational numbers than natural
numbers. But on the other hand, there are more real numbers between 0 and 1
than natural numbers! All these sets have infinite cardinality but turn out
that some of these infinities are bigger than others. These infinite
cardinalities normally are represented using aleph numbers. Infinite sets
are strange beasts indeed.

Regards from cold London,
Pablo Galindo Salgado
___
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


[issue42254] inspect.getmembers iterator version

2020-11-03 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

why?

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue42225] Tkinter hangs or crashes when displaying astral chars

2020-11-03 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

@Kevin Walzer: Is the problem were seeing a known issue with Tk?

--
nosy: +wordtech

___
Python tracker 

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



[issue42254] inspect.getmembers iterator version

2020-11-03 Thread signing_agreement


New submission from signing_agreement :

inspect.getmembers should have a generator version.

--
components: Library (Lib)
messages: 380287
nosy: signing_agreement
priority: normal
severity: normal
status: open
title: inspect.getmembers iterator version
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



Re: Find word by given characters

2020-11-03 Thread Chris Angelico
On Wed, Nov 4, 2020 at 1:11 AM Bischoop  wrote:
> Let me clarify what I want to do:
> We all know Scrabble game.
> there's a file with Dictionary containing word in each line, the idea is
> to input some letters for example mentioned earlier: att, the script
> supposed to find all words in which letters: 'a','t','t' occur and print
> these words. It supposed not to print word: 'auto' because there's only
> one 't' but words such as: 'toast', 'toasty', 'tolerant' are meeting the
> criteria becase we have in these words one 'a' and two 't' as user has
> input.
> I've checked collections counter but seems to complicated for me at this
> stage yet and I'm struggling with applying it.

This seems strangely backwards for a Scrabble game. Normally you would
have a set of available tiles, and you have to form a word using only
those tiles, but it doesn't necessarily have to use them all. You seem
to have something where you must use all the tiles you have, and may
use any number of others. But, no matter; it can be done either way.

>>> from collections import Counter
>>> Counter("att") <= Counter("toast")
True
>>> Counter("att") <= Counter("toasty")
True
>>> Counter("att") <= Counter("tolerant")
True
>>> Counter("att") <= Counter("auto")
False

A Counter can behave like a multiset. If you picture the <= operator
as being "is a subset of", and then squint a little, irritate your
math teacher, and pretend that a set can have more than one of the
same thing in it, then a Counter's less-than-or-equal operator will
tell you if one multiset is a subset of another.

(The normal way to play Scrabble would simply reverse the operands, so
you'd ask if the word is <= the tiles you have. It's otherwise exactly
the same check.)

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


[issue41796] _ast module state should be made per interpreter

2020-11-03 Thread STINNER Victor


STINNER Victor  added the comment:

The leak is fixed, I close again the issue. Thanks for the report Pablo.

--
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: Find word by given characters

2020-11-03 Thread duncan smith
On 03/11/2020 14:06, Bischoop wrote:
> On 2020-11-03, dn  wrote:
>>
>>
>> The (full) specs are not clear. There's certainly room for 
>> misunderstanding. I'd be happier if I could 'see' a full spec or 
>> recognise a practical application, because then we'd be better able to 
>> discuss facts. Meantime, we try to help with what we have been given...
>>
>>
>> The OP's sample code only realises "conforming word[s]" (good term 
>> BTW!). The snippet does not report any "count". Similarly, there's no 
>> facts to avoid ("I assume") an assumption about whether "Letters" may 
>> include duplication - indeed: whether duplication has meaning or should 
>> be regarded as user-error.
>>
> 
> Let me clarify what I want to do:
> We all know Scrabble game.
> there's a file with Dictionary containing word in each line, the idea is
> to input some letters for example mentioned earlier: att, the script
> supposed to find all words in which letters: 'a','t','t' occur and print
> these words. It supposed not to print word: 'auto' because there's only
> one 't' but words such as: 'toast', 'toasty', 'tolerant' are meeting the
> criteria becase we have in these words one 'a' and two 't' as user has
> input.
> I've checked collections counter but seems to complicated for me at this
> stage yet and I'm struggling with applying it.
> 

>>> from collections import Counter
>>> letters = 'att'
>>> letter_counts = Counter(letters)
>>> word = 'tolerate'
>>> wd_counts = Counter(word)
>>> for char, cnt in letter_counts.items():
print (cnt == wd_counts[char])


True
True
>>> word = 'auto'
>>> wd_counts = Counter(word)
>>> for char, cnt in letter_counts.items():
print (cnt == wd_counts[char])


True
False
>>>

or, equivalent to the above loop, but breaking when the first False is
generated and returning the single Boolean that you're after,

>>> all(cnt == wd_counts[char] for char, cnt in letter_counts.items())
False
>>>

There's still a lot of scope for improvement, but possibly not by doing
simple things.

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


[issue42252] Embeddable Python indicates that it uses PYTHONPATH

2020-11-03 Thread Tom Kent


Tom Kent  added the comment:

I'm not sure I agree with that. One possible use-case is to package it along 
with another program to use the interpreter. In this case they could use the 
other program's native language features (e.g. .Net's Process.Start(), Win32 
API's CreateProcess(), Even Python's subprocess but why?, etc) to run 
`python.exe myscript.py`. 

In this case, the user may assume that adding something to the `PYTHONPATH` env 
variable, as most of the launching methods allow, would take hold. When this 
fails, the first attempt at debugging would be to try it interactively with the 
same command, then promptly look at python --help when that fails. 

Maybe a better question is why should the embeddable distribution's python.exe 
ignore env variables? Wouldn't it make more sense to depend on the user to add 
a `-E` if that is what they desire?

--

___
Python tracker 

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



[issue41796] _ast module state should be made per interpreter

2020-11-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fd957c124c1d9c5eaf61f7af8cf266bafcb1 by Victor Stinner in 
branch 'master':
bpo-41796: Call _PyAST_Fini() earlier to fix a leak (GH-23131)
https://github.com/python/cpython/commit/fd957c124c1d9c5eaf61f7af8cf266bafcb1


--

___
Python tracker 

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



[issue42225] Tkinter hangs or crashes when displaying astral chars

2020-11-03 Thread STINNER Victor


STINNER Victor  added the comment:

> This version catches exceptions and reports them separately and runs directly 
> with tkinter, in about a second.

The X Error is displayed and then the process exit. Python cannot catch this 
fatal X Error.

--

___
Python tracker 

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



[issue42225] Tkinter hangs or crashes when displaying astral chars

2020-11-03 Thread STINNER Victor


STINNER Victor  added the comment:

The following program fails with:
---
X Error of failed request:  BadLength (poly request too large or internal Xlib 
length error)
  Major opcode of failed request:  138 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  4248
  Current serial number in output stream:  4956
---

Python program:
---
from tkinter import Tk
from tkinter.scrolledtext import ScrolledText
root = Tk()
text = ScrolledText(root, width=80, height=40)
text.pack()

for i in range(0x1, 0x4, 32):
chars = ''.join(chr(i+j) for j in range(32))
text.insert('insert', f"{hex(i)} {chars}\n")

input("Press enter to exit")
---

It seems like the first character which triggers this RenderAddGlyphs BadLength 
issue is: U+1f6c2. See attached emoji.png screenshot. As you can see, some 
emojis are rendered in color in Gnome Terminal. I guess that it uses the Gtk 3 
pango library to render these characters.

--
Added file: https://bugs.python.org/file49567/emojis.png

___
Python tracker 

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



[issue42252] Embeddable Python indicates that it uses PYTHONPATH

2020-11-03 Thread Eryk Sun


Eryk Sun  added the comment:

The embeddable distribution isn't intended for end users to run Python scripts 
from the command line, so I don't think the CLI help needs to be special cased. 
The documentation you quoted should be clarified as something like "isolated 
from user and system Python settings, including environment variables such as 
PYTHONPATH, registry settings, and installed packages". It would be helpful as 
well if the Windows download links on python.org explained or linked to the 
intended use case for the embeddable distribution. Sometimes people mistakenly 
download it when they really need a normal Python installation.

--
nosy: +eryksun

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-03 Thread STINNER Victor


STINNER Victor  added the comment:

In PR 23131, I added a comment to _PyInterpreter_Clear() to remind me that 
trying to destroy a Python type after the last GC collection doesn't work as 
expected:

// All Python types must be destroyed before the last GC collection. Python
// types create a reference cycle to themselves in their in their
// PyTypeObject.tp_mro member (the tuple contains the type).

--

___
Python tracker 

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



[issue41796] _ast module state should be made per interpreter

2020-11-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22047
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/23131

___
Python tracker 

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



[issue42246] Implement PEP 626

2020-11-03 Thread Mark Shannon


Change by Mark Shannon :


--
nosy: +nedbat

___
Python tracker 

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



Re: Best way to determine user's screensize?

2020-11-03 Thread Peter Pearson
On Sun, 1 Nov 2020 15:31:57 - (UTC), Grant Edwards wrote:
>
> I have no objection to saving the most recent window size and using
> that on the next startup, but I hate applications that force the
> _location_ of the window. I've configured my window manager to open
> windows where I want them opened, please respect that.

Hear, hear!

This user has invested a lot of time learning how to live comfortably
with his window manager.  When some upstart app invalidates that
knowledge and the corresponding deeply ingrained habits, it's a
big annoyance.

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Please help test astral char display in tkinter Text (especially *nix)

2020-11-03 Thread Terry Reedy
tcl/tk supports unicode chars in the BMP (Basic Multilingual Plane, 
utf-8 encoded with 1-3 bytes).  The presence of chars in other plains 
('astral', utf-8 encoded with 4 bytes, I believe) in a tkinter Text 
widget messages up *editing*, but they can sometimes be displayed with 
appropriate glyphs.


On my Windows 10 64-bit 2004 update, astral code points print as 
unassigned [X], replaced [], or proper glyphs (see below).  On my 
up-to-date macOS Mohave, as far as I know, no glyphs are actually 
printed and some hang, freezing IDLE's Shell (and making extensive 
testing difficult).  On Linux, behavior is mixed, including 'crashes', 
with the use of multicolor rather than black/white fonts apparently an 
issue.  https://bugs.python.org/issue42225.  I would like more 
information about behavior on other systems, especially *nix.


The following runs to completion for me, without errors, in about 1 second.

tk = True
if tk:
from tkinter import Tk
from tkinter.scrolledtext import ScrolledText
root = Tk()
text = ScrolledText(root, width=80, height=40)
text.pack()
def print(txt):
text.insert('insert', txt+'\n')

errors = []
for i in range(0x1, 0x4, 32):
chars = ''.join(chr(i+j) for j in range(32))
try:
   print(f"{hex(i)} {chars}")
except Exception as e:
errors.append(f"{hex(i)} {e}")
print("ERRORS:")
for line in errors:
print(line)

Perhaps half of the assigned chars in the first plane are printed 
instead of being replaced with a narrow box. This includes emoticons as 
foreground color outlines on background color.  Maybe all of the second 
plane of extended CJK chars are printed.  The third plane is unassigned 
and prints as unassigned boxes (with an X).


If you get errors, how many.  If you get a hang or crash, how far did 
the program get?


--
Terry Jan Reedy

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


[issue35455] Solaris: thread_time doesn't work with current implementation

2020-11-03 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue42249] Plistlib cannot create binary Plist file larger than 4GiB

2020-11-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22045
pull_request: https://github.com/python/cpython/pull/23129

___
Python tracker 

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



[issue42249] Plistlib cannot create binary Plist file larger than 4GiB

2020-11-03 Thread miss-islington


miss-islington  added the comment:


New changeset ac70175fc038e0f06034c4d61c577ef4b923464a by Miss Skeleton (bot) 
in branch '3.8':
bpo-42249: Fix writing binary Plist files larger than 4 GiB. (GH-23121)
https://github.com/python/cpython/commit/ac70175fc038e0f06034c4d61c577ef4b923464a


--

___
Python tracker 

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



Re: Find word by given characters

2020-11-03 Thread Ben Bacarisse
Bischoop  writes:

> Let me clarify what I want to do:
> We all know Scrabble game.
> there's a file with Dictionary containing word in each line, the idea is
> to input some letters for example mentioned earlier: att, the script
> supposed to find all words in which letters: 'a','t','t' occur and print
> these words. It supposed not to print word: 'auto' because there's only
> one 't' but words such as: 'toast', 'toasty', 'tolerant' are meeting the
> criteria becase we have in these words one 'a' and two 't' as user has
> input.

In Scrabble, you will usually know the order you want for the known
letters, so you could just make a regular expression: t.*a.*t

In fact, you often know the gaps, so you might even be able to match
something more specific like t.a..t instead.

If you don't know the order, you can still make a chain of matches.  For
example, matching for t.*t and then also a.  Every distinct letter needs
a match, and repeated letters need a single match with .* between them.

And since Python REs have (?=...) look ahead syntax you could even make
a single pattern like this:

  (?=.*t.*t)(?=.*a)

While there are probably better ways in Python, this is what I'd do on
the command line.  For example

$ grep -P '(?=.*t.*t)(?=.*a)' word-list | wc -l
45677
$ grep 't.*t' word-list | grep a | wc -l 
45677

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


[issue41796] _ast module state should be made per interpreter

2020-11-03 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue42035] [C API] PyType_GetSlot cannot get tp_name

2020-11-03 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue42249] Plistlib cannot create binary Plist file larger than 4GiB

2020-11-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 212d32f45c91849c17a82750df1ac498d63976be by Serhiy Storchaka in 
branch 'master':
bpo-42249: Fix writing binary Plist files larger than 4 GiB. (GH-23121)
https://github.com/python/cpython/commit/212d32f45c91849c17a82750df1ac498d63976be


--

___
Python tracker 

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



[issue42249] Plistlib cannot create binary Plist file larger than 4GiB

2020-11-03 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +22044
pull_request: https://github.com/python/cpython/pull/23128

___
Python tracker 

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



Re: Find word by given characters

2020-11-03 Thread Bischoop
On 2020-11-03, dn  wrote:
>
>
> The (full) specs are not clear. There's certainly room for 
> misunderstanding. I'd be happier if I could 'see' a full spec or 
> recognise a practical application, because then we'd be better able to 
> discuss facts. Meantime, we try to help with what we have been given...
>
>
> The OP's sample code only realises "conforming word[s]" (good term 
> BTW!). The snippet does not report any "count". Similarly, there's no 
> facts to avoid ("I assume") an assumption about whether "Letters" may 
> include duplication - indeed: whether duplication has meaning or should 
> be regarded as user-error.
>

Let me clarify what I want to do:
We all know Scrabble game.
there's a file with Dictionary containing word in each line, the idea is
to input some letters for example mentioned earlier: att, the script
supposed to find all words in which letters: 'a','t','t' occur and print
these words. It supposed not to print word: 'auto' because there's only
one 't' but words such as: 'toast', 'toasty', 'tolerant' are meeting the
criteria becase we have in these words one 'a' and two 't' as user has
input.
I've checked collections counter but seems to complicated for me at this
stage yet and I'm struggling with applying it.

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


[issue37193] Memory leak while running TCP/UDPServer with socketserver.ThreadingMixIn

2020-11-03 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
pull_requests: +22043
pull_request: https://github.com/python/cpython/pull/23127

___
Python tracker 

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



[issue42253] xml.dom.minidom.rst missed informations

2020-11-03 Thread Jens Diemer


New submission from Jens Diemer :

The standalone arguments was added in Python 3.9. This information is missed in 
the docu.

--
messages: 380277
nosy: jedie2
priority: normal
pull_requests: 22042
severity: normal
status: open
title: xml.dom.minidom.rst missed informations
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



[issue42246] Implement PEP 626

2020-11-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Dead code elimination will remove the `secret_debugging_code()`, but leave 
> the test. The peephole optimiser can then reduce it to a NOP, but won't 
> eliminate it as it is the only instruction for line 1.

Gotcha. I am pretty sure that this will have a similar problem as the coverage 
people were claiming when we were not properly removing all dead code (slightly 
less coverage percentage). This is not a problem of course, but we should ping 
the coverage folks so they are aware of this.

--

___
Python tracker 

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



[issue40511] IDLE: properly handle '(' and ')' within calls

2020-11-03 Thread wyz23x2


wyz23x2  added the comment:

Thanks! :D

--

___
Python tracker 

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



[issue42251] Add threading.gettrace and threading.getprofile

2020-11-03 Thread Mario Corchero


Change by Mario Corchero :


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

___
Python tracker 

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



[issue42252] Embeddable Python indicates that it uses PYTHONPATH

2020-11-03 Thread Tom Kent

New submission from Tom Kent :

According to the documentation 
https://docs.python.org/3/using/windows.html#windows-embeddable

> When extracted, the embedded distribution is (almost) fully isolated 
> from the user’s system, including environment variables, system registry 
> settings, and installed packages

The embedded distribution should ignore the environment variables. 

This is echoed in this prior issue that thought `PYTHONPATH` not being 
respected was a bug:
https://bugs.python.org/issue28245

Regardless of the decision to respect environment variables, the message that 
is displayed when running the distribution's `python --help` needs to indicate 
how it will act. 

Currently, for the embedded distribution, which doesn't respect the env 
variables, there is a section in the output from running `python -help` that 
indicates:

```
Other environment variables:
PYTHONSTARTUP: file executed on interactive startup (no default)
PYTHONPATH   : ';'-separated list of directories prefixed to the
   default module search path.  The result is sys.path.
PYTHONHOME   : alternate  directory (or ;).
   The default module search path uses 
\python{major}{minor}.
PYTHONPLATLIBDIR : override sys.platlibdir.
PYTHONCASEOK : ignore case in 'import' statements (Windows).
PYTHONUTF8: if set to 1, enable the UTF-8 mode.
PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.
PYTHONFAULTHANDLER: dump the Python traceback on fatal errors.
PYTHONHASHSEED: if this variable is set to 'random', a random value is used
   to seed the hashes of str and bytes objects.  It can also be set to an
   integer in the range [0,4294967295] to get hash values with a
   predictable seed.
PYTHONMALLOC: set the Python memory allocators and/or install debug hooks
   on Python memory allocators. Use PYTHONMALLOC=debug to install debug
   hooks.
PYTHONCOERCECLOCALE: if this variable is set to 0, it disables the locale
   coercion behavior. Use PYTHONCOERCECLOCALE=warn to request display of
   locale coercion and locale compatibility warnings on stderr.
PYTHONBREAKPOINT: if this variable is set to 0, it disables the default
   debugger. It can be set to the callable of your debugger of choice.
PYTHONDEVMODE: enable the development mode.
PYTHONPYCACHEPREFIX: root directory for bytecode cache (pyc) files.
```

This may lead users (it did lead this one) to assume that they are doing 
something wrong when for example the output of `sys.path` doesn't included 
items in `os.environ["PYTHONPATH"]`. 

Realizing that it may be difficult to achieve, the help output should match the 
state of what the interpreter will actually do if run.

--
components: Windows
messages: 380274
nosy: paul.moore, steve.dower, teeks99, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Embeddable Python indicates that it uses PYTHONPATH
versions: 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



[issue42251] Add threading.gettrace and threading.getprofile

2020-11-03 Thread Mario Corchero


New submission from Mario Corchero :

When working in a C extension from a non-python created thread which calls 
PyGILState_Ensure as it later calls a Python callback on user code, I wished 
there was a way to set the trace function similar to what a native Python 
thread would do.

We could just call sys.gettrace within the thread, but the application might 
have chosen to set threading.settrace differently.

Same applies for threading.setprofile.

--
components: Library (Lib)
messages: 380273
nosy: mariocj89
priority: normal
severity: normal
status: open
title: Add threading.gettrace and threading.getprofile
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



[issue40077] Convert static types to heap types: use PyType_FromSpec()

2020-11-03 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +22040
pull_request: https://github.com/python/cpython/pull/23124

___
Python tracker 

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



[issue41832] PyType_FromSpec() should accept tp_doc=NULL

2020-11-03 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue41796] _ast module state should be made per interpreter

2020-11-03 Thread STINNER Victor


STINNER Victor  added the comment:

There is a leak (I just marked bpo-42250 as duplicate of this issue):

https://buildbot.python.org/all/#/builders/205/builds/83

OK
..
test_ast leaked [23640, 23636, 23640] references, sum=70916
test_ast leaked [7932, 7930, 7932] memory blocks, sum=23794
1 test failed again:
test_ast

test_subinterpreter() test leaks.

There are two problems:

* _PyAST_Fini() is only called in the main interpreter, I forgot to remove the 
"if _Py_IsMainInterpreter()"
* _PyAST_Fini() is called after the last GC collection, whereas AST_type 
contains a reference to itself (as any Python type) in its tp_mro member. A GC 
collection is required to destroy the type. _PyAST_Fini() must be called before 
the last GC collection.

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

___
Python tracker 

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



[issue42250] test_ast leaked [23640, 23636, 23640] references

2020-11-03 Thread STINNER Victor


STINNER Victor  added the comment:

I prefer to track the regression in bpo-41796.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> _ast module state should be made per interpreter

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-03 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

I've converted _sre to multi-phase init in this branch: 
https://github.com/erlend-aasland/cpython/tree/bpo-1635741/sre

I'm waiting for GH-23101 to be merged (or rejected) before I submit the PR. 
It's a fairly large PR (1 file changed, 259 insertions(+), 173 deletions(-), 
ex. clinic code). Let me know if you want me to split it up.

Here's an overview over the commits in the branch (clinic included):
97fc9aad3f (HEAD -> bpo-1635741/sre, origin/bpo-1635741/sre) Convert _sre to 
multi-phase initialisation
 1 file changed, 55 insertions(+), 15 deletions(-)
f2cc4bdf45 Convert global state to module state
 2 files changed, 212 insertions(+), 345 deletions(-)
0d9b3cb47e Establish global module state and add types to it
 1 file changed, 28 insertions(+), 14 deletions(-)
823767cf9a Convert _sre scanner type to heap type
 1 file changed, 19 insertions(+), 37 deletions(-)
a018a9ce15 Convert _sre match type to heap type
 1 file changed, 31 insertions(+), 43 deletions(-)
7e6e997b59 Convert _sre pattern type to heap type
 1 file changed, 35 insertions(+), 44 deletions(-)
06d23e377c Add convenience macro
 1 file changed, 12 insertions(+)

--

___
Python tracker 

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



[issue42250] test_ast leaked [23640, 23636, 23640] references

2020-11-03 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
components: +Tests
nosy: +BTaskaya, vstinner -pablogsal
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



[issue42250] test_ast leaked [23640, 23636, 23640] references

2020-11-03 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
assignee:  -> vstinner

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22038
pull_request: https://github.com/python/cpython/pull/23122

___
Python tracker 

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



[issue42250] test_ast leaked [23640, 23636, 23640] references

2020-11-03 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

https://buildbot.python.org/all/#/builders/205/builds/83

OK
..
test_ast leaked [23640, 23636, 23640] references, sum=70916
test_ast leaked [7932, 7930, 7932] memory blocks, sum=23794
1 test failed again:
test_ast

--
messages: 380269
nosy: pablogsal
priority: normal
severity: normal
status: open
title: test_ast leaked [23640, 23636, 23640] references

___
Python tracker 

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



[issue42246] Implement PEP 626

2020-11-03 Thread Mark Shannon


Mark Shannon  added the comment:

The following code is completely eliminated by the macros.

1. if 0:
2. secret_debugging_code()

PEP 626 says that all executed lines of code must generate trace events,
so we need to emit an instruction for line 1.

Dead code elimination will remove the `secret_debugging_code()`, but leave the 
test. The peephole optimiser can then reduce it to a NOP, but won't eliminate 
it as it is the only instruction for line 1.

--
stage: patch review -> 

___
Python tracker 

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



  1   2   >