[issue32604] Expose the subinterpreters C-API in Python for testing use.

2020-04-28 Thread Eric Snow


Change by Eric Snow :


--
pull_requests: +19088
pull_request: https://github.com/python/cpython/pull/19768

___
Python tracker 

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



[issue37340] remove free_list for bound method objects

2020-04-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This caused a performance regression (70%) for a fundamental operation.  See 
issue 37340.

Sometimes, bound methods are used directly and not through LOAD_METHOD:

 sorted(data, key=str.upper)

--
nosy: +rhettinger
status: closed -> open

___
Python tracker 

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



[issue39966] mock 3.9 bug: Wrapped objects without __bool__ raise exception

2020-04-28 Thread Chris Withers


Chris Withers  added the comment:


New changeset 521c8d6806adf0305c158d280ec00cca48e8ab22 by Karthikeyan 
Singaravelan in branch 'master':
bpo-39966: Revert "bpo-25597: Ensure wraps' return value is used for magic 
methods in MagicMock" (GH-19734)
https://github.com/python/cpython/commit/521c8d6806adf0305c158d280ec00cca48e8ab22


--

___
Python tracker 

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



[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2020-04-28 Thread Chris Withers


Chris Withers  added the comment:


New changeset 521c8d6806adf0305c158d280ec00cca48e8ab22 by Karthikeyan 
Singaravelan in branch 'master':
bpo-39966: Revert "bpo-25597: Ensure wraps' return value is used for magic 
methods in MagicMock" (GH-19734)
https://github.com/python/cpython/commit/521c8d6806adf0305c158d280ec00cca48e8ab22


--

___
Python tracker 

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



[issue39117] Performance regression for making bound methods

2020-04-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This performance regression in still present in 3.9.0a6

Results from Tools/scripts/var_access_benchmark.py:

 Python 3.8.2   Python 3.9.0a6
    --
  read_boundmethod  27.7 ns 47.1 ns




> Is this regression is large enough to revive the free_list 
> for bound methods?

Yes!

--

___
Python tracker 

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



[issue40427] importlib of module results in different id than when imported with import keyword

2020-04-28 Thread Brett Cannon


Brett Cannon  added the comment:

That's expected because you are constructing a completely new module object 
with importlib.util.module_from_spec(). You're also completely circumventing 
sys.modules with the code you wrote which is the only way you would get 
equivalent IDs compared to using the import statement.

So this is working as intended.

--
nosy: +brett.cannon
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue40427] importlib of module results in different id than when imported with import keyword

2020-04-28 Thread John Andersen


New submission from John Andersen :

When importing a file using importlib the id() of the object being imported is 
not the same as when imported using the `import` keyword. I feel like this is a 
bug. As if I have a package which is using relative imports, and then I import 
all of the files in that package via importlib. issubclass and isinstance and 
others no longer work when the relative imported object and then importlib 
imported object are checked against each other, I assume because the id()s are 
different.

$ cat > target.py <<'EOF'
class Target:
pass

EOF

$ cat > importer.py <<'EOF'
import importlib
from target import Target

spec = importlib.util.spec_from_file_location("target", "target.py")
imported_by_importlib = importlib.util.module_from_spec(spec)
spec.loader.exec_module(imported_by_importlib)

print("isinstance(imported_by_importlib.Target(), Target:",
isinstance(imported_by_importlib.Target(), Target))
print("id(Target):", id(Target))
print("id(imported_by_importlib.Target):", id(imported_by_importlib.Target))

EOF

$ python importer.py
isinstance(imported_by_importlib.Target(), Target: False
id(Target): 93824998820112
id(imported_by_importlib.Target): 93824998821056

--
messages: 367554
nosy: pdxjohnny
priority: normal
severity: normal
status: open
title: importlib of module results in different id than when imported with 
import keyword
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



[issue40269] Inconsistent complex behavior with (-1j)

2020-04-28 Thread Mark Dickinson


Mark Dickinson  added the comment:

Closing this. Please open a separate issue for changing the complex repr if 
that's the way that you want to go.

--
resolution:  -> not a bug
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



[issue40426] Unable to use lowercase hexadecimal digits for percent encoding

2020-04-28 Thread E Kawashima


Change by E Kawashima :


--
keywords: +patch
nosy: +E Kawashima
nosy_count: 1.0 -> 2.0
pull_requests: +19087
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19766

___
Python tracker 

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



[issue38787] PEP 573: Module State Access from C Extension Methods

2020-04-28 Thread Stefan Behnel


Stefan Behnel  added the comment:

What can we do to move this forward? I see that the original PR was closed in 
January. Is there or will there be a new one? Can I help with anything?

--

___
Python tracker 

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



[issue40426] Unable to use lowercase hexadecimal digits for percent encoding

2020-04-28 Thread Eisuke Kawashima


New submission from Eisuke Kawashima :

RFC 3986 (https://tools.ietf.org/html/rfc3986#section-2.1) allows lower 
hexadecimal digits for percent encoding, but urllib.parse.quote and its 
variants convert into only UPPERCASE digits [A-F].

I will create a PR for fix.

--
components: Library (Lib)
messages: 367551
nosy: e-kwsm
priority: normal
severity: normal
status: open
title: Unable to use lowercase hexadecimal digits for percent encoding
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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:

I looked how Cython uses PyFrameObject:

* read f_lasti
* read/write f_back
* write f_lineno
* read f_localsplus
* read/write f_trace

Details:

* Cython/Debugger/libpython.py: code using the Python API of gdb to read 
PyFrameObject.f_lasti. It it used to compute the line number of a frame. The 
python_step() function puts a watch point on "f->f_lasti".
* Cython/Utility/Coroutine.c: set PyFrameObject.f_back using "f->f_back = 
tstate->frame;" and "Py_CLEAR(f->f_back);".
* Cython/Utility/ModuleSetupCode.c, __Pyx_PyFrame_SetLineNumber(): set 
PyFrameObject.f_lineno member. The limited C API flavor of this function does 
nothing, since this member cannot be set in the limited C API.
* Cython/Utility/ObjectHandling.c, __Pyx_PyFrame_GetLocalsplus(): complex 
implementation to access PyFrameObject.f_localsplus:

  // Initialised by module init code.
  static size_t __pyx_pyframe_localsplus_offset = 0;

  #include "frameobject.h"
  // This is the long runtime version of
  // #define __Pyx_PyFrame_GetLocalsplus(frame)  ((frame)->f_localsplus)
  // offsetof(PyFrameObject, f_localsplus) differs between regular C-Python and 
Stackless Python.
  // Therefore the offset is computed at run time from 
PyFrame_type.tp_basicsize. That is feasible,
  // because f_localsplus is the last field of PyFrameObject (checked by 
Py_BUILD_ASSERT_EXPR below).
  #define __Pxy_PyFrame_Initialize_Offsets()  \
((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == 
offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, 
f_localsplus)), \
 (void)(__pyx_pyframe_localsplus_offset = 
((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, 
f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)  \
(assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + 
__pyx_pyframe_localsplus_offset))

* Cython/Utility/Profile.c, __Pyx_TraceLine(): read PyFrameObject.f_trace.

* Cython/Utility/Profile.c, __Pyx_TraceSetupAndCall(): set 
PyFrameObject.f_trace.

--

___
Python tracker 

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



[issue40395] Scripts folder is Empty in python 3.8.2 for Windows 7.

2020-04-28 Thread Steve Dower


Steve Dower  added the comment:

Yes, the only thing that should be in your Scripts folder after install is pip. 
Python itself never puts anything there - it's for other things that you may 
install.

Could you try running these environment commands and then try installing pip 
again?

set PYTHONHOME=
set PYTHONPATH=
set PATH=C:\Windows\System32;C:\Windows
python get-pip.py

--

___
Python tracker 

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



[issue40425] Refleak in CDataObject

2020-04-28 Thread Cubi


New submission from Cubi :

String buffers are not freed when pointers to them (created via ctypes.cast) 
are deleted, even though those pointers hold references to the string buffer 
(in tagCDataObject.b_objects, I think). Code examples can be found on 
StackOverflow.com [1]. Thanks to Mark Tolonen's answer on that StackOverflow 
post we know that it is a refcount problem.

Tested in
  Python v3.7.4 x64 on Windows 10 x64, and in
  Python v3.8.2 x64 on ArchLinux x64 (5.6.7-arch1-1)

[1] https://stackoverflow.com/q/61479041

--
components: ctypes
messages: 367549
nosy: cubinator
priority: normal
severity: normal
status: open
title: Refleak in CDataObject
type: resource usage
versions: Python 3.8

___
Python tracker 

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19086
pull_request: https://github.com/python/cpython/pull/19765

___
Python tracker 

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19085
pull_request: https://github.com/python/cpython/pull/19764

___
Python tracker 

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-04-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19084
pull_request: https://github.com/python/cpython/pull/19763

___
Python tracker 

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-04-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +19083
pull_request: https://github.com/python/cpython/pull/19762

___
Python tracker 

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-04-28 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset d9a43e20facdf4ad10186f820601c6580e1baa80 by Ethan Onstott in 
branch 'master':
bpo-40025: Require _generate_next_value_ to be defined before members (GH-19098)
https://github.com/python/cpython/commit/d9a43e20facdf4ad10186f820601c6580e1baa80


--

___
Python tracker 

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



[issue36207] robotsparser deny all with some rules

2020-04-28 Thread Fred AYERS


Fred AYERS  added the comment:

I tried this one http://gtxgamer.fr/robots.txt/;>http://gtxgamer.fr/robots.txt and it 
seems to work.

--
nosy: +Fred AYERS

___
Python tracker 

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a42ca74fa30227e2f89a619332557cf093a937d5 by Victor Stinner in 
branch 'master':
bpo-40421: Add PyFrame_GetCode() function (GH-19757)
https://github.com/python/cpython/commit/a42ca74fa30227e2f89a619332557cf093a937d5


--

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:

> With my msg367463 patch (add sleep), test_cancel_futures() fails.

The test uses sleep() as a synchronization primitive:

   executor.submit(time.sleep, .1).

That's bad, but it doesn't *have to* be fixed now. My msg367463 patch adds an 
artifical sleep: the test looks fine in practice. I prefer to wait until it 
fails on a buildbot worker before spending time to make the test more reliable.

--

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:

Thomas Moreau: "One solution would be to use the `self._shutdown_lock` from the 
executor to protect the call to `close` in `terminate_broken` and the call to 
`self._thread_wakeup.wakeup` in `shutdown`. That way, the lock is only acquired 
at critical points without being used all the time. This could also be done by 
adding `lock=True/False` to only lock the potentially dangerous calls."

I wrote a conservative PR 19760 which always lock 
ProcessPoolExecutor._shutdown_lock while accessing _ThreadWakeup.

PR 19760 fix test_killed_child(): it doesn't fail anymore, even with my 
msg367463 patch (add sleep).

--

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:

With my msg367463 patch (add sleep), test_cancel_futures() fails. Example:

==
FAIL: test_cancel_futures 
(test.test_concurrent_futures.ProcessPoolForkProcessPoolShutdownTest)
--
Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/test/test_concurrent_futures.py", line 
353, in test_cancel_futures
self.assertTrue(len(cancelled) >= 35, msg=f"{len(cancelled)=}")
AssertionError: False is not true : len(cancelled)=0

--

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19082
pull_request: https://github.com/python/cpython/pull/19760

___
Python tracker 

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



[issue40424] AIX: parallel build and ld WARNINGS

2020-04-28 Thread Michael Felt


Change by Michael Felt :


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

___
Python tracker 

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



[issue40424] AIX: parallel build and ld WARNINGS

2020-04-28 Thread Michael Felt


New submission from Michael Felt :

Currently, on AIX, whenever the -j option is passed to make there are many 
WARNINGS from the loader (ld) re: duplicate symbols.

While it is not possible to eliminate these warnings completely - as some are 
not related to the Python build, but external (3rd party) packaging - MOST of 
these warnings can be eliminated by ensuring that the export file creation 
completes before additional steps try to use it.

By adding a small test to see if the export file is in the process of being 
made - and waiting for that to finish - the messages "go away".

The PR that is being proposed only affects AIX (a script named makeaix_exp). 
The script has not been modified in 22 years - so I guess the -j option is 
something that showed up after 1998 :)

I know it is not perfect - but removes a tremendous amount of noise - most of 
the time.

Michael

p.s. requesting backport to 3.8 so all buildbots benefit.

--
components: Build
messages: 367541
nosy: Michael.Felt
priority: normal
severity: normal
status: open
title: AIX: parallel build and ld WARNINGS
type: behavior
versions: 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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

With the same traceback and error message?

--

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:

Antoine Pitrou: "How about the following (untested): (...)"

Using Antoine's patch, test_killed_child() still fails (I used my msg367463 
patch to make the failure more likely).

--

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19080
pull_request: https://github.com/python/cpython/pull/19758

___
Python tracker 

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-04-28 Thread Ethan Onstott


Ethan Onstott  added the comment:

Ankesh, that is the expected behavior as no patch has been merged yet.

--

___
Python tracker 

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



[issue40420] argparse choices formatter

2020-04-28 Thread paul j3


paul j3  added the comment:

The display of the choices has been discussed in previous issues.  When the 
choices is long there isn't a clean way of handling the display.

I'd suggest using a 'metavar' to show a short value, and then enumerate the 
choices in the help text.  Use the 'Raw' help formatter to handle newlines as 
desired.

Choices get displayed in 3 places - the usage, the help, and error messages.  
Metavar replaces 2 of those.

An alternative to choices is a custom 'type' function.  An example would be all 
integers between 0 and 100.  Choices would work, but make a poor display 
regardless of formatting.

--

___
Python tracker 

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19079
pull_request: https://github.com/python/cpython/pull/19757

___
Python tracker 

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b8f704d2190125a7750b50cd9b67267b9c20fd43 by Victor Stinner in 
branch 'master':
bpo-40421: Add Include/cpython/code.h header file (GH-19756)
https://github.com/python/cpython/commit/b8f704d2190125a7750b50cd9b67267b9c20fd43


--

___
Python tracker 

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b8f704d2190125a7750b50cd9b67267b9c20fd43 by Victor Stinner in 
branch 'master':
bpo-40421: Add Include/cpython/code.h header file (GH-19756)
https://github.com/python/cpython/commit/b8f704d2190125a7750b50cd9b67267b9c20fd43


--

___
Python tracker 

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19078
pull_request: https://github.com/python/cpython/pull/19756

___
Python tracker 

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19077
pull_request: https://github.com/python/cpython/pull/19756

___
Python tracker 

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



[issue40422] Light refactor: create a common _Py_closerange API

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue40291] socket library support for CAN_J1939

2020-04-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

Looks reasonable.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue35829] datetime: parse "Z" timezone suffix in fromisoformat()

2020-04-28 Thread Alex Grönholm

Alex Grönholm  added the comment:

Has this effort gone forwards lately, or has there been any discussion 
elsewhere? I implemented support for "Z" in .fromisoformat() before finding 
this issue. Even after reading the discussion I still don't quite understand 
why it's such a big problem.

--
nosy: +alex.gronholm

___
Python tracker 

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7c59d7c9860cdbaf4a9c26c9142aebd3259d046e by Victor Stinner in 
branch 'master':
bpo-40421: Add pyframe.h header file (GH-19755)
https://github.com/python/cpython/commit/7c59d7c9860cdbaf4a9c26c9142aebd3259d046e


--

___
Python tracker 

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



[issue40423] Optimization: use close_range(2) if available

2020-04-28 Thread Kyle Evans


New submission from Kyle Evans :

This is dependent on issue40422; the diff on top of that (PR19075) looks like 
the attached. Effectively, close_range(2) should be preferred at all times if 
it's available, otherwise we'll use closefrom(2) if available with a fallback 
to fdwalk(3) or plain old loop over fd range in order of most efficient to 
least.

PR will be sent after issue40422 is resolved.

--
components: C API
files: cpython-close_range.diff
keywords: patch
messages: 367531
nosy: kevans91
priority: normal
severity: normal
status: open
title: Optimization: use close_range(2) if available
type: enhancement
versions: Python 3.9
Added file: https://bugs.python.org/file49097/cpython-close_range.diff

___
Python tracker 

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue40422] Light refactor: create a common _Py_closerange API

2020-04-28 Thread Kyle Evans


Change by Kyle Evans :


--
keywords: +patch
nosy: +kevans
nosy_count: 1.0 -> 2.0
pull_requests: +19075
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19754

___
Python tracker 

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



[issue40422] Light refactor: create a common _Py_closerange API

2020-04-28 Thread Kyle Evans


New submission from Kyle Evans :

Such an API can be used for both os.closerange and subprocess, re-using much of 
os_closerange_impl. Pull request enroute.

--
components: C API
messages: 367530
nosy: kevans91
priority: normal
severity: normal
status: open
title: Light refactor: create a common _Py_closerange API
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



[issue40419] timeit CLI docs still mention old power sequence

2020-04-28 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. This was changed as part of issue28469 where autorange 
docstring was updated. I guess this was missed out.

--
nosy: +serhiy.storchaka, xtreak

___
Python tracker 

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



[issue40418] Small Refactoring: Use bytes.hex() in secrets.token_hex()

2020-04-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +steven.daprano

___
Python tracker 

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



[issue6721] Locks in the standard library should be sanitized on fork

2020-04-28 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Related issue:
https://bugs.python.org/issue40399
"""
IO streams locking can be broken after fork() with threads
"""

--

___
Python tracker 

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2020-04-28 Thread STINNER Victor


New submission from STINNER Victor :

Similarly to bpo-39573 (make PyObject opaque) and bpo-39947 (make PyThreadState 
opaque), I propose to add getter functions to access PyFrameObject members 
without exposing the PyFrameObject structure in the C API.

The first step is to identify common usage of the PyFrameObject structure 
inside CPython code base to add getter functions, and maybe a few setter 
functions as well.

frameobject.h is not part of Python.h, but it's part of the public C API. The 
long term plan is to move PyFrameObject structure to the internal C API to hide 
implementation details from the public C API.

--
components: C API
messages: 367527
nosy: vstinner
priority: normal
severity: normal
status: open
title: [C API] Add getter functions for PyFrameObject and maybe move 
PyFrameObject to the internal C API
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



[issue21081] missing vietnamese codec TCVN 5712:1993 in Python

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue40416] Calling TextIOWrapper.tell() in the middle of reading a gb2312-encoded file causes UnicodeDecodeError

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue40420] argparse choices formatter

2020-04-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +paul.j3, rhettinger

___
Python tracker 

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



[issue40413] Py_RunMain() crashes on subsequence call

2020-04-28 Thread STINNER Victor


STINNER Victor  added the comment:

I never tried, but I expect that the following pattern is fine:

for (i=0; i<5; i++) {
Py_Initialize(); Py_RunMain()
}

Maybe Py_RunMain() must fail with a fatal error if it's called when Python is 
not initialized.

Since Py_RunMain() finalizes Python, you cannot call it multiple times without 
calling Py_Initialize() between calls.

--

___
Python tracker 

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



[issue40405] asyncio.as_completed documentation misleading

2020-04-28 Thread Bar Harel


Change by Bar Harel :


--
keywords: +patch
pull_requests: +19074
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/19753

___
Python tracker 

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



[issue40415] _asyncio extensions crashes if initialized multiple times in same process

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
superseder:  -> Use-after-free crash if multiple interpreters import asyncio 
module

___
Python tracker 

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



[issue40399] IO streams locking can be broken after fork() with threads

2020-04-28 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue40399] IO streams locking can be broken after fork() with threads

2020-04-28 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Well, as the documentation states, `QueueListener.start` """starts up a 
background thread to monitor the queue for LogRecords to process""" :-)

--

___
Python tracker 

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



[issue40420] argparse choices formatter

2020-04-28 Thread Leonid Ilyevsky


New submission from Leonid Ilyevsky :

In my script I have a positional argument with list of choices, and that list 
is pretty long. The help formatter shows it as one long line,  list in curly 
brackets, comma-separated. This is very difficult to look at and find the 
choice I need.
It would be nice to have an option to print the choices list one per line.

--
components: Library (Lib)
messages: 367524
nosy: Leonid Ilyevsky
priority: normal
severity: normal
status: open
title: argparse choices formatter
type: behavior

___
Python tracker 

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



[issue40359] email.parse part.get_filename() fails to unwrap long attachment file names (legacy API)

2020-04-28 Thread R. David Murray


R. David Murray  added the comment:

As far as I know you currently still have to specify the policy.  It was, yes, 
intended that 'default' become the actual default.  I could have sworn there 
was an open issue for doing this, but I can't find it.  I remember having a 
conversation with someone who said they were going to work on getting it done, 
but unfortunately I don't remember who :(

I'm not very active in the python community currently so I can't really drive 
it, but it should definitely happen.

--

___
Python tracker 

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



[issue40399] IO streams locking can be broken after fork() with threads

2020-04-28 Thread Delgan


Delgan  added the comment:

Thank you for having looked into the problem.

To be more specific, I don't generally mix threads with multiprocessing, but 
it's a situation where there is one global and hidden consumer thread listening 
to a queue for non-blocking logging.

Actually, I think the problem is reproducible using the QueueListener provided 
in "logging.handlers". The following snippet is inspired by this part of the 
documentation: 
https://docs.python.org/3/howto/logging-cookbook.html#dealing-with-handlers-that-block

--

import logging
import multiprocessing
import queue
from logging.handlers import QueueHandler, QueueListener


if __name__ == "__main__":
que = multiprocessing.Queue()

queue_handler = QueueHandler(que)
handler = logging.StreamHandler()
listener = QueueListener(que, handler)
root = logging.getLogger()
root.addHandler(queue_handler)
listener.start()

for i in range(1):
root.warning('Look out!')
p = multiprocessing.Process(target=lambda: None)
p.start()
p.join()
print("Not hanging yet", i)


listener.stop()

--

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-04-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 5b9f4988c94f47fa35e84f154a7b5aa17bc04722 by Pablo Galindo in 
branch 'master':
bpo-40334: Refactor peg_generator to receive a Tokens file when building c code 
(GH-19745)
https://github.com/python/cpython/commit/5b9f4988c94f47fa35e84f154a7b5aa17bc04722


--

___
Python tracker 

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



[issue21081] missing vietnamese codec TCVN 5712:1993 in Python

2020-04-28 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

Found an "Unlink" bottom at the bottom of the message view. This appears to 
remove the messages from the issue.

--

___
Python tracker 

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



[issue21081] missing vietnamese codec TCVN 5712:1993 in Python

2020-04-28 Thread Marc-Andre Lemburg


Change by Marc-Andre Lemburg :


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

___
Python tracker 

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



[issue21081] missing vietnamese codec TCVN 5712:1993 in Python

2020-04-28 Thread Marc-Andre Lemburg


Change by Marc-Andre Lemburg :


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

___
Python tracker 

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



[issue21081] missing vietnamese codec TCVN 5712:1993 in Python

2020-04-28 Thread Marc-Andre Lemburg


Change by Marc-Andre Lemburg :


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

___
Python tracker 

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



[issue21081] missing vietnamese codec TCVN 5712:1993 in Python

2020-04-28 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

I have marked the messages as spam. Can't seem to remove them, though.

--

___
Python tracker 

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



[issue21081] missing vietnamese codec TCVN 5712:1993 in Python

2020-04-28 Thread Antti Haapala

Antti Haapala  added the comment:

The messages above seem to be a (quite likely a machine) translation of André's 
comment with a spam link to a paint ad site, so no need to bother to translate 
it.

Also, I invited Hiếu to the nosy list in case this patch needs some info that 
requires a native Vietnamese reader, to push this forward ;)

--

___
Python tracker 

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



[issue21081] missing vietnamese codec TCVN 5712:1993 in Python

2020-04-28 Thread Hieu Nguyen


Change by Hieu Nguyen :


--
nosy: +hieu.nguyen

___
Python tracker 

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



[issue40419] timeit CLI docs still mention old power sequence

2020-04-28 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 2.0 -> 3.0
pull_requests: +19073
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19752

___
Python tracker 

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



[issue40419] timeit CLI docs still mention old power sequence

2020-04-28 Thread Sander van Rijn


New submission from Sander van Rijn :

The docs for the `timeit` CLI 
(https://docs.python.org/3/library/timeit.html#cmdoption-timeit-h) still 
mention that successive powers of 10 are tried. However, as this also uses the 
`timeit.Timer.autorange()` function, it uses the new sequence 1, 2, 5, 10, 20, 
50, ... instead.

--
assignee: docs@python
components: Documentation
messages: 367517
nosy: Sander van Rijn, docs@python
priority: normal
severity: normal
status: open
title: timeit CLI docs still mention old power sequence
type: enhancement
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



[issue40381] plistlib doesn't handle poorly-formatted plists

2020-04-28 Thread Ronald Oussoren


Change by Ronald Oussoren :


--
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue40399] IO streams locking can be broken after fork() with threads

2020-04-28 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I can reproduce on Ubuntu 18.04 with git master.

Here is a better example which clearly shows the issue:
https://gist.github.com/pitrou/d9784d5ec679059cd02fce4b38ea2fa6

After a few runs, you'll see that the child Process hangs when trying to flush 
the standard streams:
Timeout (0:00:01)!
Thread 0x7efbff6c0080 (most recent call first):
  File "/home/antoine/cpython/default/Lib/multiprocessing/util.py", line 435 in 
_flush_std_streams
  File "/home/antoine/cpython/default/Lib/multiprocessing/process.py", line 335 
in _bootstrap
  File "/home/antoine/cpython/default/Lib/multiprocessing/popen_fork.py", line 
71 in _launch
  File "/home/antoine/cpython/default/Lib/multiprocessing/popen_fork.py", line 
19 in __init__
  File "/home/antoine/cpython/default/Lib/multiprocessing/context.py", line 276 
in _Popen
  File "/home/antoine/cpython/default/Lib/multiprocessing/context.py", line 224 
in _Popen
  File "/home/antoine/cpython/default/Lib/multiprocessing/process.py", line 121 
in start
  File "/home/antoine/cpython/default/bpo40399.py", line 25 in 
Child process failed!


@Delgan, mixing processes and threads is problematic with the default settings. 
 See here:
https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

"""Note that safely forking a multithreaded process is problematic."""

If you call `multiprocessing.set_start_method("forkserver")` at the start of 
your program, the problem will disappear.

--
nosy: +pitrou, vstinner
title: Program hangs if process created right after adding object to a Queue -> 
IO streams locking can be broken after fork() with threads
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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread Kyle Stanley


Kyle Stanley  added the comment:

I decided to close PR-19751. Both because it does not correctly address the 
race condition (due to an oversight on my part) and it would add substantial 
overhead to _ThreadWakeup. Instead, I agree that we should explore a 
non-locking solution.

--

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread Kyle Stanley


Kyle Stanley  added the comment:

Oops, it seems that I opened PR-19751 a bit preemptively. When I get the 
chance, I'll see if Antoine's implementation can address the failures and do 
some comparisons.

--

___
Python tracker 

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



[issue40061] Possible refleak in _asynciomodule.c future_add_done_callback()

2020-04-28 Thread Kyle Stanley


Kyle Stanley  added the comment:

Antoine Pitrou wrote:
> You're right that a Py_DECREF is missing there.  However, it seems unlikely 
> that this is triggering the test failure, because `PyList_New(1)` will 
> practically never fail in normal conditions (and even making it deliberately 
> fail would be quite difficult).

Thanks for clarifying; spotting refleaks is something that I've only recently 
started to get the hang of, so I wanted to double check first. :-)

I should have updated this issue, but I resolved the main test_asyncio failure 
that I saw from GH-19149 in GH-19282. Either way though, I think this could 
still be fixed (even if it would rarely be an issue in most situations).

--

___
Python tracker 

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



[issue40399] Program hangs if process created right after adding object to a Queue

2020-04-28 Thread Delgan


Delgan  added the comment:

Another curiosity: if 'print("Consumed:", queue.get())' is replaced by either 
'print("Consumed")' or 'queue.get()', then the program keeps running without 
stopping. Only a combination of both makes the program to hang.

Also reproducible on 3.5.2.

--

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread Kyle Stanley


Change by Kyle Stanley :


--
pull_requests: +19072
pull_request: https://github.com/python/cpython/pull/19751

___
Python tracker 

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



[issue40399] Program hangs if process created right after adding object to a Queue

2020-04-28 Thread Delgan


Delgan  added the comment:

I noticed the bug is reproducible even if the child process does not put object 
in the queue:




import multiprocessing 
import threading 
import time 

if __name__ == "__main__": 
  queue = multiprocessing.SimpleQueue() 

  def consume(queue):
while True:
  print("Consumed:", queue.get())

  thread = threading.Thread(target=consume, args=(queue,))
  thread.start()
  
  for i in range(1):
queue.put(i)
p = multiprocessing.Process(target=lambda: None) 
p.start() 
p.join()

print("Not hanging yet", i)

--

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

How about the following (untested):

diff --git a/Lib/concurrent/futures/process.py 
b/Lib/concurrent/futures/process.py
index 8e9b69a8f0..c0c2eb3032 100644
--- a/Lib/concurrent/futures/process.py
+++ b/Lib/concurrent/futures/process.py
@@ -66,23 +66,29 @@ _global_shutdown = False
 
 class _ThreadWakeup:
 def __init__(self):
-self._closed = False
 self._reader, self._writer = mp.Pipe(duplex=False)
 
 def close(self):
-if not self._closed:
-self._closed = True
-self._writer.close()
-self._reader.close()
+r, w = self._reader, self._writer
+self._reader = self._writer = None
+if r is not None:
+r.close()
+w.close()
 
 def wakeup(self):
-if not self._closed:
+try:
 self._writer.send_bytes(b"")
+except AttributeError:
+# Closed
+pass
 
 def clear(self):
-if not self._closed:
+try:
 while self._reader.poll():
 self._reader.recv_bytes()
+except AttributeError:
+# Closed
+pass
 
 
 def _python_exit():

--

___
Python tracker 

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



[issue40061] Possible refleak in _asynciomodule.c future_add_done_callback()

2020-04-28 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

You're right that a Py_DECREF is missing there.  However, it seems unlikely 
that this is triggering the test failure, because `PyList_New(1)` will 
practically never fail in normal conditions (and even making it deliberately 
fail would be quite difficult).

--
nosy: +pitrou

___
Python tracker 

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



[issue40417] PyImport_ReloadModule emits deprecation warning

2020-04-28 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +19071
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19750

___
Python tracker 

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



[issue40408] GenericAlias does not support nested type variables

2020-04-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Not yet. If you don't prefer to fix it yourself, I'll do it as soon as I have 
time.

--

___
Python tracker 

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



[issue40411] frozen collection.Counter

2020-04-28 Thread Kyle Stanley


Kyle Stanley  added the comment:

paul rubin wrote:
> Yeah I think the basic answer to this ticket is "Python doesn't really have 
> multisets and a proposal to add them should go somewhere else".  Fair 
> enough-- consider the request withdrawn from here.

Not necessarily, python-ideas is just more so the designated location for 
cultivating Python change proposals in their early stages. If you're interested 
enough in this being added to the standard library, you can present your case 
there using some of the guidelines I suggested earlier. Also, if others are 
interested in the feature and have specific use cases for it, that can 
significantly increase the odds of it being added. The python-ideas mailing 
list tends to get much more traffic than an individual open issue on bpo.

In the context of significant new feature proposals, bpo is typically used once 
it's been approved of (with a formal PEP for especially large changes), to 
further discuss the implementation details and for tracking related PRs.

--

___
Python tracker 

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



[issue40414] Incorrect mouse and keyboard mapping

2020-04-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

On which platform and Python version they were mapped to keyboard number 
buttons?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39995] test_concurrent_futures: ProcessPoolSpawnExecutorDeadlockTest.test_crash() fails with OSError: [Errno 9] Bad file descriptor

2020-04-28 Thread Thomas Moreau


Thomas Moreau  added the comment:

Sorry I just saw this. It seems that I introduced this regression.

One of the goal of having a `ThreadWakeup` and not a `SimpleQueue` is to avoid 
using locks that can hinder the performance of the executor. I don't remember 
the exact details but I think I did some benchmark and it was giving lower 
performances for large set of small tasks (not so sure anymore). If a fully 
synchronous method is chosen, maybe it is safer to rely on a `SimpleQueue` as 
it will be lower maintenance. If the solution proposed by aeros is chosen, the 
event can probably be replaced by a lock no? It would be easier to understand I 
guess.

>From the failures, it seems to be a race condition between `shutdown` and 
>`terminate_broken`. The race condition should not be possible in `submit` as 
>in principle, the `join_executor_internals` is only called when no new task 
>can be submitted.
One solution would be to use the `self._shutdown_lock` from the executor to 
protect the call to `close` in `terminate_broken` and the call to 
`self._thread_wakeup.wakeup` in `shutdown`. That way, the lock is only acquired 
at critical points without being used all the time. This could also be done by 
adding `lock=True/False` to only lock the potentially dangerous calls.

--
nosy: +tomMoral

___
Python tracker 

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



[issue40418] Small Refactoring: Use bytes.hex() in secrets.token_hex()

2020-04-28 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
title: Small Refactoring: Use the bytes.hex() in secrets.token_hex() -> Small 
Refactoring: Use bytes.hex() in secrets.token_hex()

___
Python tracker 

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



[issue40418] Small Refactoring: Use the bytes.hex() in secrets.token_hex()

2020-04-28 Thread Dennis Sweeney


Change by Dennis Sweeney :


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

___
Python tracker 

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



[issue40418] Small Refactoring: Use the bytes.hex() in secrets.token_hex()

2020-04-28 Thread Dennis Sweeney


New submission from Dennis Sweeney :

Since bytes.hex() was added in 3.5, we should be able to make the following 
change:

diff --git a/Lib/secrets.py b/Lib/secrets.py
index a546efbdd4..1dd8629f52 100644
--- a/Lib/secrets.py
+++ b/Lib/secrets.py
@@ -13,7 +13,6 @@ __all__ = ['choice', 'randbelow', 'randbits', 
'SystemRandom',


 import base64
-import binascii

 from hmac import compare_digest
 from random import SystemRandom
@@ -56,7 +55,7 @@ def token_hex(nbytes=None):
 'f9bf78b9a18ce6d46a0cd2b0b86df9da'

 """
-return binascii.hexlify(token_bytes(nbytes)).decode('ascii')
+return token_bytes(nbytes).hex()

 def token_urlsafe(nbytes=None):
 """Return a random URL-safe text string, in Base64 encoding.


Performance: python -m pyperf timeit -s "from secrets import token_hex" 
"token_hex(...)"

* token_hex() on master:
Mean +- std dev: 892 ns +- 22 ns
* token_hex() with change: 
Mean +- std dev: 750 ns +- 22 ns
* token_hex(1_000_000) on master:
Mean +- std dev: 3.31 ms +- 0.08 ms
* token_hex(1_000_000) with change: 
Mean +- std dev: 2.34 ms +- 0.04 ms


Simpler code, better performance. Are there any downsides?

--
components: Library (Lib)
messages: 367502
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Small Refactoring: Use the bytes.hex() in secrets.token_hex()
type: performance
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



[issue40417] PyImport_ReloadModule emits deprecation warning

2020-04-28 Thread Robert Rouhani


New submission from Robert Rouhani :

It appears as though PyImport_ReloadModule is importing the deprecated "imp" 
module.

I integrated a newer version of Python into Unreal Engine 4, which internally 
calls this function for some of it's own modules. Normally a stray warning 
wouldn't be of much concern to me, but the process of "cooking" (converting raw 
assets to optimized/final assets) will fail if anything is written to stderr. 
This makes it impossible to package a copy of the game for testing or release 
without a workaround.

I'm going to add a test to _testembed.c to verify my fix. Is this something 
that I should include in the Github PR?

--
components: Interpreter Core
messages: 367501
nosy: Robert Rouhani
priority: normal
severity: normal
status: open
title: PyImport_ReloadModule emits deprecation warning
type: behavior
versions: Python 3.5, 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



<    1   2