[issue40275] test.support has way too many imports

2020-04-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 3c8a5b459d68b4337776ada1e04f5b33f90a2275 by Serhiy Storchaka in 
branch 'master':
bpo-40275: Avoid importing asyncio in test.support (GH-19600)
https://github.com/python/cpython/commit/3c8a5b459d68b4337776ada1e04f5b33f90a2275


--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 16994912c93e8e5db7365d48b75d67d3f70dd7b2 by Serhiy Storchaka in 
branch 'master':
bpo-40275: Avoid importing socket in test.support (GH-19603)
https://github.com/python/cpython/commit/16994912c93e8e5db7365d48b75d67d3f70dd7b2


--

___
Python tracker 

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



[issue40387] queue example it does not work

2020-04-25 Thread Santiago Blanco


New submission from Santiago Blanco :

Copy the example of the next URL:

https://docs.python.org/3/library/queue.html#queue.Queue.join

and paste into a file, then try to run it. It does not work.

I have tried a new one (attachment) that works.

--
assignee: docs@python
components: Documentation
files: example.py
messages: 367263
nosy: Santiago Blanco, docs@python
priority: normal
severity: normal
status: open
title: queue example it does not work
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49092/example.py

___
Python tracker 

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



[issue39482] Write 2to3 fixer for collections.abc imports

2020-04-25 Thread Dong-hee Na


Dong-hee Na  added the comment:

Since https://bugs.python.org/issue40360 is now discussing lib2to3 deprecating.
The feature would not be needed.

--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-04-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10
nosy_count: 5.0 -> 6.0
pull_requests: +19032
pull_request: https://github.com/python/cpython/pull/18245

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 515fce4fc4bb0d2db97b17df275cf90640017f56 by Serhiy Storchaka in 
branch 'master':
bpo-40275: Avoid importing logging in test.support (GH-19601)
https://github.com/python/cpython/commit/515fce4fc4bb0d2db97b17df275cf90640017f56


--

___
Python tracker 

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



[issue40388] random.choice integer overflow v3.5.2

2020-04-25 Thread Nicholas Prowse


New submission from Nicholas Prowse :

Filename: random.py
Location of file: /use/lib/python3.5/random.py
Function: random.choice()
Input: 40 digit integer
Expected output: no crash
Actual output: Crash
Line number: 253
Error message: "Python int too large to convert to C ssize_t"

Traceback:
a = random.choice(sequence)
i= self._randbelow(len(seq))

Error occurs on last line 253.

--
components: Library (Lib)
messages: 367266
nosy: dev00790
priority: normal
severity: normal
status: open
title: random.choice integer overflow v3.5.2
type: crash
versions: Python 3.5

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +19033
pull_request: https://github.com/python/cpython/pull/19711

___
Python tracker 

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



[issue40031] Python Configure IDLE 'Ok' and 'Apply' buttons do not seem to work.

2020-04-25 Thread Saaheer Purav


Saaheer Purav  added the comment:

This is the error message that I get:

Failed to import extension:  AutoExpand
Failed to load extension 'AutoExpand'
Traceback (most recent call last):
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\idlelib\editor.py",
 line 1115, in load_extension
mod = importlib.import_module('.' + fname, package=__package__)
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
 line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'idlelib.AutoExpand'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\idlelib\editor.py",
 line 1099, in load_standard_extensions
self.load_extension(name)
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\idlelib\editor.py",
 line 1117, in load_extension
mod = importlib.import_module(fname)
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
 line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'AutoExpand'

Failed to import extension:  CallTips
Failed to load extension 'CallTips'
Traceback (most recent call last):
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\idlelib\editor.py",
 line 1115, in load_extension
mod = importlib.import_module('.' + fname, package=__package__)
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
 line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'idlelib.CallTips'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\idlelib\editor.py",
 line 1099, in load_standard_extensions
self.load_extension(name)
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\idlelib\editor.py",
 line 1117, in load_extension
mod = importlib.import_module(fname)
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
 line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'CallTips'

Failed to import extension:  ZoomHeight
Failed to load extension 'ZoomHeight'
Traceback (most recent call last):
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\idlelib\editor.py",
 line 1115, in load_extension
mod = importlib.import_module('.' + fname, package=__package__)
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
 line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'idlelib.ZoomHeight'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\idlelib\editor.py",
 line 1099, in load_standard_extensions
self.load_extension(name)
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\idlelib\editor.py",
 line 1117, in load_extension
mod = importlib.import_module(fname)
  File 
"C:\Users\saahe\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py",
 line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'ZoomHeight'

--

___
Python tracker 

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



[issue40388] random.choice integer overflow v3.5.2

2020-04-25 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

What you are describing is not what we mean by a crash (a core dump or 
segfault); it sounds like a regular Python exception.

Python 3.5 is obsolete and there are no more bug fixes for it except for 
security fixes.

You have not given us enough information to reproduce the problem. The 
description you give:

Function: random.choice()
Input: 40 digit integer
Expected output: no crash
Actual output: Crash


works for me:

py> import random
py> random.choice(1234567890123456789012345678901234567890) # 40 digits
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.5/random.py", line 253, in choice
i = self._randbelow(len(seq))
TypeError: object of type 'int' has no len()

is exactly the exception I would expect from using an int (whether 1 digit or 
400 digits) as argument to random.choice.

Can you show us the actual code you run, and the actual traceback? Please copy 
and paste it as text, don't take a screen shot.

--
nosy: +steven.daprano
type: crash -> behavior

___
Python tracker 

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



[issue40031] Python Configure IDLE 'Ok' and 'Apply' buttons do not seem to work.

2020-04-25 Thread Tal Einat


Tal Einat  added the comment:

Saaheer, it seems like you have things from older versions of IDLE in your IDLE 
config file (in your .idlerc directory). Specifically, the built-in extensions 
have all been converted to be integral parts of IDLE, and must be removed from 
your configuration file.

I suggest moving/renaming your .idlerc directory so that IDLE can create a new, 
clean .idlerc. Then make your personal configurations again, preferably using 
IDLE's configuration dialog.

--

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-04-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -19032

___
Python tracker 

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



[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-04-25 Thread STINNER Victor


STINNER Victor  added the comment:

Serhiy: would it be possible to fix this issue in alpha6? Can we merge PR 
19414? In the lack of reply, I think that the best to merge PR 19414.

--

___
Python tracker 

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



[issue40388] random.choice integer overflow v3.5.2

2020-04-25 Thread Mark Dickinson


Mark Dickinson  added the comment:

I suspect that the OP is doing something like `random.choice(range(10**40))`:

Python 3.8.2 (default, Feb 27 2020, 19:56:42) 
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> random.choice(range(10**40))
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/random.py",
 line 288, in choice
i = self._randbelow(len(seq))
OverflowError: Python int too large to convert to C ssize_t

The advice in this case would be to use something like random.randrange(10**40) 
instead.

The actual bug here, if there is a bug, has nothing to do with random, but 
instead has to do with "virtual" sequences whose length exceeds 2**63 - 1. 
There are other issues in the tracker for this, for example issue 12159.

I suggest closing as "not a bug".

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue9417] Declaring a class creates circular references

2020-04-25 Thread Kay Hayen


Kay Hayen  added the comment:

Today I changed my reference count tests to not use debug Python and came 
across this issue.

>From my testing, Python3.4 is the first affected version, Python3.3 was still 
>fine, so were 2.7 and 2.6. 

This leaks:

def simpleFunction39():
class Parent(str):
pass

This does not:

def simpleFunction39():
class Parent(object):
pass

When comparing (or attempted to) gc.get_objects() before and after, I was 
unable to point to any count that would be different, that was confusing. I can 
rule out a mistake in my changes to how the counts are achieved, because every 
other reference count test works.

--
nosy: +kayhayen

___
Python tracker 

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



[issue9417] Declaring a class creates circular references

2020-04-25 Thread Kay Hayen


Kay Hayen  added the comment:

What I also meant to say, is that debug Python is not affected, and this had me 
deeply confused. Any ideas how that could happen?

--

___
Python tracker 

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



[issue40387] queue example it does not work

2020-04-25 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

In general examples in the documentation may lack some things like imports as 
they are implicit but in this case it also lack do_work(), source() and 
num_worker_threads.

You could use os.cpu_count() instead of your hard-coded value and the comment.

Can you open a pull request with your change?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue40377] APPDATA location in Microsoft Store version

2020-04-25 Thread Stephan Troyer

Stephan Troyer  added the comment:

> ... provide a way to output the relevant contents of the file on the console 
> rather than just printing the path ...

Thanks, I didn't think of that option, that is probably the best way to deal 
with it. I'll file a bug to jupyter and vscode-python (which in my case relied 
on that data).
In principle I like the AppData redirection, since that way package specific 
data also automatically gets cleaned up when uninstalling the Python app.

Because returning paths which include ApplicationData.Current.LocalFolder (and 
having 3rd party apps accessing files in there) is also suboptimal, I'm closing 
this issue.

> ... apart from a little bit of startup code, it's exactly the same as the 
> regular install.

I know, I only mentioned it, since I don't take it for granted to offer a 
Microsoft Store package and deal with such specific issues, if there exists 
already another package for Windows 😉

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



[issue40375] Add the UNSELECT command to imaplib

2020-04-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
keywords: +patch
pull_requests: +19034
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/19712

___
Python tracker 

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



[issue40387] queue example it does not work

2020-04-25 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue15185] Validate callbacks in 'contextlib.ExitStack.callback()'

2020-04-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think it is rather a work for linter's and static type checking. Runtime 
check adds an overhead, and it is expected that in correct program it will 
always pass. You need the check only while write the program, it may help in 
debugging. But once it has been debugged and tested, the check becomes a waste 
of CPU time.

Since this issue was not touched for 8 years and there is a large progress in 
static code analysis, I suggest to close it.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue40388] random.choice integer overflow v3.5.2

2020-04-25 Thread Mark Dickinson


Change by Mark Dickinson :


--
resolution:  -> not a bug
status: open -> pending

___
Python tracker 

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



[issue40375] Add the UNSELECT command to imaplib

2020-04-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
assignee:  -> corona10

___
Python tracker 

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



[issue40092] Crash in _PyThreadState_DeleteExcept() at fork in the process child

2020-04-25 Thread hai shi


hai shi  added the comment:

>since we are going to delete the threading.Thread object with its _tstate_lock 
>object anymore.

Do we have any pep or discuss record about this plan?

> * Modify release_sentinel() to not use the lock: avoid 
> PyThread_release_lock() call.

Hm, I am not sure about it. Looks like we can not remove it directly.

--

___
Python tracker 

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



[issue40389] No straightforward way to get repr of Optional

2020-04-25 Thread Vladislav Serebrennikov


New submission from Vladislav Serebrennikov :

When source code is not available, "typing.Union[T, NoneType]" is what 
autocompletion engines left with, if they don't have additional logic to cover 
this case. Which is noisy compared to typing.Optional[T].

Usecase when source code is not available

Consider the following: C++ library has C++ plugins, supplied by user. It 
provides Python wrappers for their functions, dynamically filling out their 
type annotations.

--
components: Library (Lib)
messages: 367278
nosy: Endill
priority: normal
severity: normal
status: open
title: No straightforward way to get repr of Optional
type: behavior
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



[issue40389] No straightforward way to get repr of Optional

2020-04-25 Thread Vladislav Serebrennikov


Change by Vladislav Serebrennikov :


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

___
Python tracker 

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



[issue40387] queue example it does not work

2020-04-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The example is supposed to be a sketch of the overall pattern.  IMO, putting 
concrete and useless implementations of do_work() and source() make the example 
less intelligible.

Instead, we can add a note that the user needs to supply their own do_work() 
and source().

--
nosy: +rhettinger

___
Python tracker 

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



[issue40390] Implement a C API for channel_send_wait for subinterpreters.

2020-04-25 Thread Benjamin Edwards


New submission from Benjamin Edwards :

When sending a message to another interpreter allow the caller to wait until 
the message has been received.

--
components: C API
messages: 367280
nosy: benedwards14, eric.snow
priority: normal
severity: normal
status: open
title: Implement a C API for channel_send_wait for subinterpreters.
type: enhancement
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



[issue40390] Implement a C API for channel_send_wait for subinterpreters.

2020-04-25 Thread Benjamin Edwards


Change by Benjamin Edwards :


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

___
Python tracker 

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



[issue38580] select()'s documentation claims only sequences are accepted, but it allows all iterables

2020-04-25 Thread Tal Einat


Tal Einat  added the comment:

It seems pretty clear to me that we should simply update the docs as suggested.

If nobody chimes in about this within a week, I intend to merge the PR 
(GH-16832) with the small fixes I've suggested there.

--

___
Python tracker 

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2020-04-25 Thread Frank Thommen


Change by Frank Thommen :


--
nosy:  -fthommen

___
Python tracker 

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



[issue40031] IDLE fails trying to inport old idlelib file names for config

2020-04-25 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Saaheer, using the 'File: Browse...' button under the comment box, please 
upload (if you still have it) the .../.idlerc/config-extensions.cfg that 
results in this failure.  Most idlelib files were renamed in 3.6.  'AutoExpand' 
and 'CallTips' are 2 of the old names.  Built-in extensions were converted 
after that, and I intended that the new code be compatible with existing 
customizations.  Current IDLE should not fail this way and your file should 
help with the fix.

You should only need to rename this file to config-extensions.cfg.old or 
something and leave the other files in .idlerc alone.

--
stage:  -> test needed
title: Python Configure IDLE 'Ok' and 'Apply' buttons do not seem to work. -> 
IDLE fails trying to inport old idlelib file names for config

___
Python tracker 

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



[issue9417] Declaring a class creates circular references

2020-04-25 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Kay, please ask your question on python-list or a similar forum.

--

___
Python tracker 

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



[issue40333] Request for multi-phase initialization API to run code after importlib init

2020-04-25 Thread Gregory Szorc


Gregory Szorc  added the comment:

Having approached this with a fresh brain, I was able to port PyOxidizer to use 
the multi-phase initialization API with minimal regressions!

The relevant code exists at 
https://github.com/indygreg/PyOxidizer/blob/b5aa2b3a96dbd01e9d78857e124f1052f42f86c6/pyembed/src/interpreter.rs#L550.

Here's the sequence:

1) Initialize core
2) Import our custom built-in extension module
3) Run some more code to initialize our extension module (update sys.meta_path, 
etc)
4) Initialize main
5) Remove PathFinder if filesystem imports are disabled

#5 isn't ideal: I would prefer an API to disable the registration of that 
importer completely. But PyOxidizer's importer is first on sys.meta_path and 
PathFinder shouldn't come into play. So it should be mostly harmless.

A super minor paper cut is the lack of a PyConfig_SetBytesString() variant for 
PyWideStringList_Append(). It was slightly annoying having to convert a POSIX 
char* path to a wchar_t* since paths on POSIX are bytes.

Another potential area for improvement is around error handling before main is 
initialized. I'd like to represent PyErr raised during initialization as a Rust 
String, as PyErr isn't appropriate since there isn't a fully initialized Python 
interpreter. However, I discovered that serializing PyErr to strings is a bit 
brittle before main is initialized. e.g. 
https://docs.python.org/3/faq/extending.html#id11 says to use PyErr_Print() and 
replace sys.stdout. But sys.stdout isn't initialized yet and I'm scared to 
touch it. It also appears various functions in traceback rely on facilities 
from an initialized interpreter (such as finding sources). It would be useful 
if there were some kind of PyErr API that returned a PyString (or PyStatus) and 
was guaranteed to work before main is initialized.

Overall, the new code in PyOxidizer is much, much cleaner! Thanks again for the 
new API!

--

___
Python tracker 

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



[issue40388] random.choice integer overflow v3.5.2

2020-04-25 Thread Nicholas Prowse


Nicholas Prowse  added the comment:

Code as requested is similar to the below:

N = <40 digit int>
sequence=range(1,N)
a = random.choice(sequence)

Since you class the error previously mentioned as an exception, what function 
should be used instead for choosing a random integer between 1 and including 
N-1?

--
status: pending -> open

___
Python tracker 

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



[issue40337] builtins.RuntimeError: Caught RuntimeError in pin memory thread for device 0.

2020-04-25 Thread Eric V. Smith


Eric V. Smith  added the comment:

If you have more information, please provide it and re-open this issue.

--
resolution:  -> rejected
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue40388] random.choice integer overflow v3.5.2

2020-04-25 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Take your pick between either of these:

random.randrange(1, N)
random.randint(1, N-1)

https://docs.python.org/3/library/random.html#functions-for-integers

--

___
Python tracker 

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



[issue40391] io.FileIO.mode doesn't comply with the docs

2020-04-25 Thread mike.parker


New submission from mike.parker :

io.FileIO.mode doesn't reflect "The mode as given in the constructor." as per 
the documentation(https://docs.python.org/3/library/io.html#io.FileIO.mode).
Was noted in issue4362, but seems to be still relevant.

Example:
>>> f = open("t.tmp", "w+b")
>>> f.mode
'rb+'

--
assignee: docs@python
components: Documentation, IO
messages: 367288
nosy: benjamin.peterson, docs@python, mike.parker, stutzbach
priority: normal
severity: normal
status: open
title: io.FileIO.mode doesn't comply with the docs
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue27540] msvcrt.ungetwch() calls _ungetch()

2020-04-25 Thread Zachary Ware


Change by Zachary Ware :


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



[issue38601] Couldn't able to install multiple python minor version in windows due to EXE script

2020-04-25 Thread Zachary Ware


Change by Zachary Ware :


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



[issue38601] Couldn't able to install multiple python minor version in windows due to EXE script

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

Lacking followup from the OP, I'm closing the issue.  If more information is 
brought forward later, it can be reopened.

--

___
Python tracker 

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



[issue21614] Case sensitivity problem in multiprocessing.

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

With no activity here in over 5 years and no confirmation on any version but 
2.7, I'm closing the issue.  If it can be confirmed on 3.8, the issue can be 
reopened.

--
nosy: +zach.ware
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



[issue34283] [Windows] Python 2 mishandles console code page after setlocale

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

As this issue is specific to 2.7, I'm closing it.

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



[issue29796] [2.7] test_weakref hangs on Python 2.7 on Windows

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

Looks like we forgot to close this one; as far as I can tell it was fixed.  
Being 2.7-only, it's time to be closed anyway :)

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

___
Python tracker 

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



[issue25560] Unhandled warning in test_unicode_file

2020-04-25 Thread Zackery Spytz


Zackery Spytz  added the comment:

Python 2 is EOL.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue40380] Errors during make test python 3.8.2

2020-04-25 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Thanks for reaching out! This is about test failures, not problems with 
installation process, correct? I took a look at the failures:

==
ERROR: test_add_file_after_2107 (test.test_zipfile.StoredTestsWithSourceFile)
--
Traceback (most recent call last):
  File 
"/gpfs/scratch/sjfleck/modulefiles/Python-3.8.2/Lib/test/test_zipfile.py", line 
606, in test_add_file_after_2107
os.utime(TESTFN, (ts, ts))
OSError: [Errno 75] Value too large for defined data type

--

It looks like the test excepts an OverflowError but not an OSError, so I think 
it should do both.


==
ERROR: test_setrusage_refcount (test.test_resource.ResourceTest)
--
Traceback (most recent call last):
  File 
"/gpfs/scratch/sjfleck/modulefiles/Python-3.8.2/Lib/test/test_resource.py", 
line 131, in test_setrusage_refcount
resource.setrlimit(resource.RLIMIT_CPU, BadSequence())
ValueError: not allowed to raise maximum limit

--

I think this is a bug in the test: a non-root process increasing its hard 
resource maximum should raise. So I think this maybe BadSequence()[i] should 
return limits[i].



==
FAIL: test_touch_common (test.test_pathlib.PosixPathTest)
--
Traceback (most recent call last):
  File 
"/gpfs/scratch/sjfleck/modulefiles/Python-3.8.2/Lib/test/test_pathlib.py", line 
1761, in test_touch_common
self.assertGreaterEqual(st.st_mtime_ns, old_mtime_ns)
AssertionError: 1587754085552569712 not greater than or equal to 
1587754085553625000

--

Similar to: https://bugs.python.org/issue19715




==
FAIL: test_sendall_interrupted (test.test_socket.GeneralModuleTests)
--
Traceback (most recent call last):
  File 
"/gpfs/scratch/sjfleck/modulefiles/Python-3.8.2/Lib/test/test_socket.py", line 
1527, in test_sendall_interrupted
self.check_sendall_interrupted(False)
  File 
"/gpfs/scratch/sjfleck/modulefiles/Python-3.8.2/Lib/test/test_socket.py", line 
1514, in check_sendall_interrupted
c.sendall(b"x" * support.SOCK_MAX_SIZE)
AssertionError: ZeroDivisionError not raised

==
FAIL: test_sendall_interrupted_with_timeout 
(test.test_socket.GeneralModuleTests)
--
Traceback (most recent call last):
  File 
"/gpfs/scratch/sjfleck/modulefiles/Python-3.8.2/Lib/test/test_socket.py", line 
1530, in test_sendall_interrupted_with_timeout
self.check_sendall_interrupted(True)
  File 
"/gpfs/scratch/sjfleck/modulefiles/Python-3.8.2/Lib/test/test_socket.py", line 
1514, in check_sendall_interrupted
c.sendall(b"x" * support.SOCK_MAX_SIZE)
AssertionError: ZeroDivisionError not raised

--

Looks related to https://bugs.python.org/issue18643 .
Perhaps SOCK_MAX_SIZE needs to be increased for this test, or be made 
system-dependent?



==
ERROR: test_ignore (test.test_multiprocessing_forkserver.TestIgnoreEINTR)
--
Traceback (most recent call last):
  File 
"/gpfs/scratch/sjfleck/modulefiles/Python-3.8.2/Lib/test/_test_multiprocessing.py",
 line 4874, in test_ignore
os.kill(p.pid, signal.SIGUSR1)
ProcessLookupError: [Errno 3] No such process

--

Looks similar to: https://bugs.python.org/issue33532

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue40380] OS-related test failures on Linux in Python 3.8.2

2020-04-25 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
components: +Tests -Installation
title: Errors during make test python 3.8.2 -> OS-related test failures on 
Linux in Python 3.8.2
type: compile error -> behavior

___
Python tracker 

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



[issue32049] 2.7.14 does not uninstall cleanly if installation was run as SYSTEM account (SCCM)

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

Hi Sven,

I'm sorry this issue never got attention before the end of 2.7, but as we have 
now reached that point I'm going to go ahead and close this issue.  I hope it 
didn't cause you too much trouble!  If you can also reproduce this with a 
current version of Python 3, please either reopen this issue or open a new one.

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



[issue30725] Windows installer for 2.7.13 doesn't install pip when installing to C:\Program Files

2020-04-25 Thread Zachary Ware


Change by Zachary Ware :


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



[issue26992] 64-bit Python 2.7.11 hangs in 64-bit Windows 10 - CMD and Git Bash

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

As this appears to be a 2.7-only issue, I'm going to go ahead and close it.

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



[issue28551] sysconfig.py wrong _PROJECT_BASE for Py2.7 Windows 64bit PC/VS9.0

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

Sorry I missed this one!  This was actually addressed in bpo-30342 (GH-1544), 
but it would have been fixed 7 months sooner if this one hadn't fallen off my 
radar.  Thanks for the patch anyway!

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
superseder:  -> [2.7] sysconfig.is_python_build() doesn't work if Python is 
built with VS 2008

___
Python tracker 

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



[issue40383] weakref class name are hardcoded in reprs

2020-04-25 Thread OhBonsai


Change by OhBonsai :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue14141] 2.7.2 64-bit Windows library has __impt_Py* for several symbols instead of __imp__Py*

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

As 2.7 is now out of support, I'm going to go ahead and close the issue.

--
nosy: +zach.ware
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



[issue23121] pip.exe breaks if python 2.7.9 is installed under c:\Program Files\Python

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

As 2.7 is now out of support, I'm going to go ahead and close this issue.

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



[issue21946] 'python -u' yields trailing carriage return '\r' (Python2 for Windows)

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

It's not entirely clear from a quick read whether this was actually fixed or 
not (probably?), but as 2.7 is out of support it no longer matters :)

--
nosy: +zach.ware
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue19351] python msi installers - silent mode

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

As all versions using the MSI installer are now out of support, I'm closing the 
issue.

--
nosy: +zach.ware
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



[issue40392] Remove deprecated _field_types in typing.NamedTuple

2020-04-25 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

_field_types of typing.NamedTuple was documented as deprecated and to be 
removed in Python 3.9 in favor of __annotations__ at 
https://docs.python.org/3/library/typing.html#typing.NamedTuple . Issue where 
it was deprecated : issue36320 .

--
components: Library (Lib)
messages: 367302
nosy: josh.r, levkivskyi, rhettinger, serhiy.storchaka, xtreak
priority: normal
severity: normal
status: open
title: Remove deprecated _field_types in typing.NamedTuple
type: behavior
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



[issue25563] Windows 10: _tkinter import fails

2020-04-25 Thread Zachary Ware


Zachary Ware  added the comment:

With no other context, I'm going to assume this was specific to 2.7, which is 
now out of support.

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



[issue40392] Remove deprecated _field_types in typing.NamedTuple

2020-04-25 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Sorry for the noise, I didn't check the master branch properly. Closing this as 
duplicate.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Remove the _field_types attribute of NamedTuple

___
Python tracker 

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



[issue25560] Unhandled warning in test_unicode_file

2020-04-25 Thread Zachary Ware


Change by Zachary Ware :


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