[issue44751] crypt.h should be in _cryptmodule.c, not in public header

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: New changeset 80285ecc8deaa2b0e7351bf4be863d1a0ad3c188 by Miss Islington (bot) in branch '3.10': closes bpo-44751: Move crypt.h include from public header to _cryptmodule (GH-27394) (GH-28636) https://github.com/python/cpython/commit

[issue43753] [C API] Add Py_Is(x, y) and Py_IsNone(x) functions

2021-09-29 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +27009 pull_request: https://github.com/python/cpython/pull/28641 ___ Python tracker <https://bugs.python.org/issue43

[issue25653] ctypes+callbacks+fork+selinux = crash

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: Another recent crash involving libffi, closure, fork and SELinux: https://bugzilla.redhat.com/show_bug.cgi?id=1977410 This bug comes from libffi, not from Python (but it can be easily reproducing using ctypes which uses libffi). -- nosy: +vstinner

[issue45262] crash if asyncio is used before and after re-initialization if using python embedded in an application

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: > "Assertion failed: Py_IS_TYPE(rl, _Type), file > D:\a\1\s\Modules_asynciomodule.c, line 261" The _asyncio extension uses static types and doesn't implement the multiphase initialization API. It doesn't work well with your "de

[issue45325] Allow "p" in Py_BuildValue

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: > but there is a catch -- the arguments should be a C int. If it is not, you > can break a stack. I never understood how "..." arguments work under the hood. What happens if you pass a double, it is stored as a double on the C stack, and the

[issue45325] Allow "p" in Py_BuildValue

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: I would be interested to see how the "p" format could be used in existing code. I found a few places would benefit of it. Either create a new draft PR, or put it in the same PR 28634. Modules/_itertoolsmodule.c: return Py_BuildValu

[issue36207] robotsparser deny all with some rules

2021-09-29 Thread STINNER Victor
Change by STINNER Victor : -- Removed message: https://bugs.python.org/msg402889 ___ Python tracker <https://bugs.python.org/issue36207> ___ ___ Python-bug

[issue41710] acquire(timeout) of threading.Lock and threading.Condition is affected by jumps in system time: Python should use sem_clockwait(CLOCK_MONOTONIC)

2021-09-29 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +26999 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28629 ___ Python tracker <https://bugs.python.org/issu

[issue45322] [X86_64]test_concurrent_futures fail

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: > File > "/home/abuild/rpmbuild/BUILD/Python-3.7.9/Lib/multiprocessing/queues.py", > line 224 in _feed Python 3.7 no longer accept bugfixes: I close the issue. You can open a new issue if you can reproduce the issue on Python

[issue45319] Possible regression in __annotations__ descr for heap type subclasses

2021-09-29 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +petr.viktorin, vstinner ___ Python tracker <https://bugs.python.org/issue45319> ___ ___ Python-bugs-list mailing list Unsub

[issue39026] Include/cpython/pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: I propose to only rename header files in Python 3.11. For Python 3.9 and 3.10, I suggest to modify Include/cpython/pystate.h by replacing: #include "cpython/initconfig.h" with: #include "initconfig.h"

[issue39026] Include/cpython/pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: I'm not sure why Include/cpython/ is part of the compiler include directories. I am not sure why Include/ is *not* part of the compiler include directory. Anyway, it's hard to control how people build Python and there are always legit use cases where you

[issue45308] multiprocessing default fork child process will not free object, which is inherited from parent process

2021-09-29 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker <https://bugs.python.org/issue45308> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39026] Include/cpython/pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure

2021-09-29 Thread STINNER Victor
Change by STINNER Victor : -- title: pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure -> Include/cpython/pystate.h contains non-relative of initconfig.h include causing macOS Framework include fail

[issue39026] pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure

2021-09-29 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26982 pull_request: https://github.com/python/cpython/pull/28612 ___ Python tracker <https://bugs.python.org/issue39

[issue39026] pystate.h contains non-relative of initconfig.h include causing macOS Framework include failure

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: I marked bpo-40642 as a duplicate of this issue. -- ___ Python tracker <https://bugs.python.org/issue39026> ___ ___ Python-bug

[issue40642] Cpython "pystate.h" subdirectory wrong

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: I mark this issue as a duplicate of bpo-39026. -- resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> pystate.h contains non-relative of initconfig.h include causing macOS Framework inc

[issue40642] Cpython "pystate.h" subdirectory wrong

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: Having two header files with the same name in two directories which are part of the include directories is causing issues like this one :-( For the internal C API, I solve the issue by adding "pycore_" prefix to filenames. Maybe pystate.h should

[issue45201] API function PySignal_SetWakeupFd is not exported and unusable

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-45316: [C API] Functions not exported with PyAPI_FUNC(). -- nosy: +vstinner ___ Python tracker <https://bugs.python.org/issue45

[issue45316] [C API] Functions not exported with PyAPI_FUNC()

2021-09-29 Thread STINNER Victor
New submission from STINNER Victor : The Python C API contains multiple functions which are not exported with PyAPI_FUNC() and so are not usable. Public functions: --- void PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range); int

[issue36819] Crash during encoding using UTF-16/32 and custom error handler

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: > We could just forbid error handlers returning position not in the range > (start , end] Yeah, that sounds like a reasonable solution. I don't see the point of returning a position outside this range. What would be the use case? For me, the only

[issue45308] multiprocessing default fork child process will not free object, which is inherited from parent process

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: > I still have some questions about is The Python bug tracker is not a forum for asking help how to use Python. Please stop reopening this issue. -- resolution: -> not a bug status: open -> closed _

[issue1170] shlex have problems with parsing unicode

2021-09-29 Thread STINNER Victor
STINNER Victor added the comment: > I would like to suggest making this change (or something similar) to the > official version of "shlex.py". Would sending an email to > "python-id...@python.org" be a good place to make this proposal? Yes, python-ideas is a g

[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-09-28 Thread STINNER Victor
Change by STINNER Victor : -- Removed message: https://bugs.python.org/msg394832 ___ Python tracker <https://bugs.python.org/issue42972> ___ ___ Python-bug

[issue45307] Removal of _PyImport_FindExtensionObject() in 3.10 limits custom extension module loaders

2021-09-28 Thread STINNER Victor
STINNER Victor added the comment: > Until 3.10 makes equivalent functionality available or another workaround is > supported, I don't understand which long term solution do you propose. > a properly designed public API is probably a better solution Can you propose a p

[issue45310] test_multiprocessing_forkserver: test_shared_memory_basics() failed with FileExistsError: [Errno 17] File exists: '/test01_tsmb'

2021-09-28 Thread STINNER Victor
New submission from STINNER Victor : AMD64 Fedora Stable LTO + PGO 3.10 (build 357): https://buildbot.python.org/all/#/builders/651/builds/357 First test_multiprocessing_forkserver failed, then test_multiprocessing_spawn, then test_multiprocessing_fork. I confirm that these tests fail

[issue45308] multiprocessing default fork child process will not free object, which is inherited from parent process

2021-09-28 Thread STINNER Victor
STINNER Victor added the comment: That's the principle of fork. You should use a different spawn method if you don't want to inherit resources inherited from the parent process, like spawn or forkserver: https://docs.python.org/dev/library/multiprocessing.html#contexts-and-start-methods

[issue1596321] KeyError at exit after 'import threading' in other thread

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: Better late than never. I only took 15 years to fix this old bug :-D -- versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.2 ___ Python tracker <https://bugs.python.org/issue1596

[issue1596321] KeyError at exit after 'import threading' in other thread

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: New changeset 94d19f606fa18a1c4d2faca1caf2f470a8ce6d46 by Victor Stinner in branch '3.9': bpo-1596321: Fix threading._shutdown() for the main thread (GH-28549) (GH-28589) https://github.com/python/cpython/commit/94d19f606fa18a1c4d2faca1caf2f470a8ce6d46

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation, use Windows native conditional variable

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: Eryk: > SleepConditionVariableSRW() can't be interrupted in PyCOND_WAIT() and > PyCOND_TIMEDWAIT(). Oh. A comment on StackOverlow says: "The WaitForXxx functions accept parameters of the generic HANDLE type, which represents a handle

[issue1596321] KeyError at exit after 'import threading' in other thread

2021-09-27 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26971 pull_request: https://github.com/python/cpython/pull/28589 ___ Python tracker <https://bugs.python.org/issue1596

[issue1596321] KeyError at exit after 'import threading' in other thread

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: New changeset 95d31370829b7d729667588e0a9943217401ea5b by Victor Stinner in branch 'main': bpo-1596321: Fix threading._shutdown() for the main thread (GH-28549) https://github.com/python/cpython/commit/95d31370829b7d729667588e0a9943217401ea5b

[issue29971] Lock.acquire() not interruptible on Windows

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: time.sleep() is now implemented with a waitable timer and WaitForMultipleObjects() on Windows. It uses _PyOS_SigintEvent() so it can be interrupted with CTRL+C. commit 58f8adfda3c2b42f654a55500e8e3a6433cb95f2 Author: Victor Stinner Date: Wed Sep 22 16:09

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-29971 "Lock.acquire() not interruptible on Windows". -- ___ Python tracker <https://bugs.python.o

[issue29971] Lock.acquire() not interruptible on Windows

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-45301 "pycore_condvar.h: remove Windows conditonal variable emulation". -- ___ Python tracker <https://bugs.python.o

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation

2021-09-27 Thread STINNER Victor
New submission from STINNER Victor : I recently worked on time.sleep() enhancement (bpo-21302) and threading bugfixes (bpo-45274, bpo-1596321). I saw one more time that Python emulates conditional variables to support Windows XP and older. But Python 3.11 requires Windows 8.1 or newer. IMO

[issue29971] Lock.acquire() not interruptible on Windows

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-21822: some comments are about this issue. It's a duplicate of bpo-45274 "Race condition in Thread._wait_for_tstate_lock()". -- ___ Python tracker <https://bugs.python.o

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: > This is the same as bpo-21822, so I suppose it should be closed as well with > a reference to this issue. You're right. I marked bpo-21822 as a duplicate of this issue. -- ___ Python tracker

[issue21822] [Windows] KeyboardInterrupt during Thread.join hangs that Thread

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: I mark this issue as a duplicate of bpo-45274. -- I fixed bpo-45274 with this change: New changeset a22be4943c119fecf5433d999227ff78fc2e5741 by Victor Stinner in branch 'main': bpo-45274: Fix Thread._wait_for_tstate_lock() race condition (GH-28532) https

[issue21822] [Windows] KeyboardInterrupt during Thread.join hangs that Thread

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: > I am having the same blocked signal issue on Windows when using Thread.join. > This program does not print "interrupted" after pressing Ctrl+C: This is a different issue: bpo-29971. Currently, threading.Lock.acquire() cannot be inter

[issue29971] Lock.acquire() not interruptible on Windows

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: Copy of Antoine Pitrou's msg316024 (bpo-21822): multiprocessing semaphores support Ctrl-C under Windows, so it should be doable for regular locks as well (notice the `sigint_event`): https://github.com/python/cpython/blob/master/Modules/_multiprocessing

[issue45300] Building Python documentation with doctest logs a ResourceWarning in Doc/library/nntplib.rst

2021-09-27 Thread STINNER Victor
New submission from STINNER Victor : Build Python documentatioin with: make -C Doc/ PYTHON=../python venv LANG= PYTHONTRACEMALLOC=10 make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W -j10" doctest 2>&1|tee log See the logs: /home/vstinner/python/main/Lib/socket.py:776

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-27 Thread STINNER Victor
Change by STINNER Victor : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10, Python 3.9 ___ Python tracker <https://bugs.python.or

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: New changeset fae2694bea5e9e5a114af8cb40b60e7131a6340c by Miss Islington (bot) in branch '3.10': bpo-45274: Fix Thread._wait_for_tstate_lock() race condition (GH-28532) (GH-28580) https://github.com/python/cpython/commit

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-27 Thread STINNER Victor
STINNER Victor added the comment: New changeset a22be4943c119fecf5433d999227ff78fc2e5741 by Victor Stinner in branch 'main': bpo-45274: Fix Thread._wait_for_tstate_lock() race condition (GH-28532) https://github.com/python/cpython/commit/a22be4943c119fecf5433d999227ff78fc2e5741

[issue45261] Unreliable (?) results from timeit (cache issue?)

2021-09-27 Thread STINNER Victor
Change by STINNER Victor : -- resolution: -> not a bug ___ Python tracker <https://bugs.python.org/issue45261> ___ ___ Python-bugs-list mailing list Un

[issue36717] Allow retrieval of return value from the target of a threading.Thread

2021-09-26 Thread STINNER Victor
STINNER Victor added the comment: Storing the result of Thread.run() can keep Python objects alive longer than expected and it may require a lock on it. I don't think that the additional complexity is worth it. I suggest to reorganize your code to pass the result differently to the caller

[issue27978] concurrent.futures.threading: Add a timeout to Executor shutdown() method

2021-09-26 Thread STINNER Victor
Change by STINNER Victor : -- title: [threading] Executor#shutdown with timeout -> concurrent.futures.threading: Add a timeout to Executor shutdown() method ___ Python tracker <https://bugs.python.org/issu

[issue1736792] dict reentrant/threading request

2021-09-26 Thread STINNER Victor
STINNER Victor added the comment: > As I first mentioned in my post[1] on comp.lang.python, it seems possible to > modify a dict while a lookup is ongoing, without causing the lookup to > restart. That's a bad practice. Python dict raises an exception in some cases: RuntimeEr

[issue45292] Implement PEP 654: Exception Groups

2021-09-26 Thread STINNER Victor
Change by STINNER Victor : -- title: Implement PEP 654 -> Implement PEP 654: Exception Groups ___ Python tracker <https://bugs.python.org/issue45292> ___ _

[issue45020] Freeze all modules imported during startup.

2021-09-25 Thread STINNER Victor
STINNER Victor added the comment: Marc-Andre: I suppose that you're talking about LANDMARK in Modules/getpath.c and PC/getpathp.c. -- ___ Python tracker <https://bugs.python.org/issue45

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-25 Thread STINNER Victor
STINNER Victor added the comment: > Do you have any information about when will be it released in 3.11? Here is a schedule of Python 3.11 releases: https://www.python.org/dev/peps/pep-0664/ In the meanwhile, you can develop a C extension to get the feat

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-25 Thread STINNER Victor
STINNER Victor added the comment: Thanks Livius for all these nice enhancements! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-25 Thread STINNER Victor
STINNER Victor added the comment: New changeset 7834ff26cbcd4d8394d64d80d9f51a364d38b1c6 by Victor Stinner in branch 'main': bpo-21302: Add nanosleep() implementation for time.sleep() in Unix (GH-28545) https://github.com/python/cpython/commit/7834ff26cbcd4d8394d64d80d9f51a364d38b1c6

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: > I am not sure that it can be solved at Python level. Right. In pure Python, we cannot write code which works in all cases. My PR 28532 fix the most common case: application interrupted by a single CTRL+C. > with suppress_interrupt(): (...) It's imp

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: I close the issue. > bpo-41299: Fix EnterNonRecursiveMutex() (GH-28548) I don't think that it's worth it to backport this change to 3.9 and 3.10. In practice, Py_FatalError() will never be called, and _PyTime_GetMonotonicClock() result must alw

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: New changeset 6bc89116cb121c176453b9745e3daa2cc5df43ab by Victor Stinner in branch 'main': bpo-41299: Mark private thread_nt.h functions as static (GH-28553) https://github.com/python/cpython/commit/6bc89116cb121c176453b9745e3daa2cc5df43ab

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: Analysis use use_tracing usage in 3rd part code. I see two main ways to add C API functions covering these use cases: * Provide high-level functions like "call a trace function" (disable tracing, call trace function, reenable tracing, increment

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: New changeset d639e3170506a1a80c4b2f1b3a6250bb95ff190a by Victor Stinner in branch 'main': bpo-41299: Fix EnterNonRecursiveMutex() (GH-28548) https://github.com/python/cpython/commit/d639e3170506a1a80c4b2f1b3a6250bb95ff190a

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: New changeset f35ddf24227e834c9b6b39ad23a0ec382b4de48b by Victor Stinner in branch 'main': bpo-41299: QueryPerformanceFrequency() cannot fail (GH-28552) https://github.com/python/cpython/commit/f35ddf24227e834c9b6b39ad23a0ec382b4de48b

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-09-24 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26936 pull_request: https://github.com/python/cpython/pull/28553 ___ Python tracker <https://bugs.python.org/issue41

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-09-24 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26935 pull_request: https://github.com/python/cpython/pull/28552 ___ Python tracker <https://bugs.python.org/issue41

[issue40699] Memory leak in threading library with Python 3.6-3.8

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: I fail to reproduce the leak using attached script. I close the issue. I get constant memory usage on Linux with the main branch of Python (future 3.11): (...) VmRSS: 11344 kB VmRSS: 11344 kB VmRSS: 11344 kB VmRSS: 11344 kB VmRSS: 11344

[issue40657] Resource leaks with threading.Thread

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: You must join thread using thread.join(). If I add .join() calls, threading.active_count() stays around 2, it doesn't grow. It's not a bug in Python. -- resolution: -> not a bug stage: -> resolved status: open -&g

[issue43050] threading timer memory leak

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: I cannot reproduce the issue. IMO it has been fixed. Moreover, you must join timers using timer.join(): a timer remains a thread. Code: --- import os import threading os.system(f"grep ^VmRSS /proc/{os.getpid()}/status") # warmup for n in range(10):

[issue1596321] KeyError at exit after 'import threading' in other thread

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: I proposed PR 28549 to fix this very old threading issue. A C extension can spawn threads without using the threading module and then then run Python code which imports the threading module. In this case, threading._main_thread is the thread which imported

[issue1596321] KeyError at exit after 'import threading' in other thread

2021-09-24 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch nosy: +vstinner nosy_count: 14.0 -> 15.0 pull_requests: +26932 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/28549 ___ Python tracker <https://bugs.p

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: Calling Py_FatalError() must be avoided by any mean. I spent significant time to remove Py_FatalError() at Python startup in my PEP 587 implementation: https://www.python.org/dev/peps/pep-0587/ I also removed Py_FatalError() calls to report errors

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: I created PR #28548 to remove the Py_FatalError() code path. -- ___ Python tracker <https://bugs.python.org/issue41

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-09-24 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26931 pull_request: https://github.com/python/cpython/pull/28548 ___ Python tracker <https://bugs.python.org/issue41

[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: Jeremy Maitin-Shepard: "In general, I view hanging threads as the least bad thing to do when faced with either acquiring the GIL or not returning at all. There is a lot of existing usage of Python that currently poses a risk of random crashes and m

[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: Another example where a developer asks to call abort() to notice bugs, whereas Python previously silently ignored it: bpo-36829. Calling abort() is a legit use case, but not really the best default behavior. Again, the problem was solved by letting

[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: Gregory P. Smith: Python has many API using callbacks: PEP 445 added PyMem_SetAllocator() to set memory allocator. Adding PyMem_GetAllocator() also made possible to chain allocators and to "hook" into an existing allocator to execute code before

[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-24 Thread STINNER Victor
STINNER Victor added the comment: > In this case that unexpected thread simply disappearing can lead to a > deadlock in our process. This problem also remains me the very complex case of bpo-6721: "Locks in the standard library should be sanitized on fork". The issue ti

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-24 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26929 pull_request: https://github.com/python/cpython/pull/28545 ___ Python tracker <https://bugs.python.org/issue21

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-24 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26926 pull_request: https://github.com/python/cpython/pull/28542 ___ Python tracker <https://bugs.python.org/issue43

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +pablogsal stage: patch review -> ___ Python tracker <https://bugs.python.org/issue45274> ___ ___ Python-bugs-list mai

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26920 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28532 ___ Python tracker <https://bugs.python.org/issu

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: For curious people, see also bpo-44422 "Fix threading.enumerate() reentrant call": another example of race condition recently fixed in the threading module. But it's unrelated to this bug ;-) --

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
Change by STINNER Victor : Added file: https://bugs.python.org/file50300/threading_bug.py ___ Python tracker <https://bugs.python.org/issue45274> ___ ___ Python-bug

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
New submission from STINNER Victor : Bernát Gábor found an interesting bug on Windows. Sometimes, when a process is interrupted on Windows with CTRL+C, its parent process hangs in thread.join(): https://twitter.com/gjbernat/status/1440949682759426050 Reproducer: * Install https://github.com

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: New changeset f4ccb79d52ee726d58bbb038ea98b4deec52001d by Victor Stinner in branch 'main': bpo-43760: Document PyThreadState.use_tracing removal (GH-28527) https://github.com/python/cpython/commit/f4ccb79d52ee726d58bbb038ea98b4deec52001d

[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: I'm not comfortable with PR 28525 which always hang threads which attempt to acquire the GIL after Python exited. I would prefer to keep the current behavior by default, but give the ability to applications embedding Python to decide what to do. With my

[issue41137] pdb uses the locale encoding for .pdbrc

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: New changeset ec7ffa4b5b262369f726a54e145e9c03eaeb4c1a by Victor Stinner in branch 'main': bpo-41137: Reorganize What's New in Python 3.11 (GH-28518) https://github.com/python/cpython/commit/ec7ffa4b5b262369f726a54e145e9c03eaeb4c1a

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: I created PR 28527 to document PyThreadState.use_tracing removal and explain how to port existing code to Python 3.10. -- ___ Python tracker <https://bugs.python.org/issue43

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26918 pull_request: https://github.com/python/cpython/pull/28527 ___ Python tracker <https://bugs.python.org/issue43

[issue45256] Remove the usage of the C stack in Python to Python calls

2021-09-22 Thread STINNER Victor
Change by STINNER Victor : -- title: Remove the usage of the cstack in Python to Python calls -> Remove the usage of the C stack in Python to Python calls ___ Python tracker <https://bugs.python.org/issu

[issue45261] Unreliable (?) results from timeit (cache issue?)

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: I suggest to close this issue. timeit works as expected. It has limitations, but that's ok. Previous attempts to enhance timeit were rejected. -- ___ Python tracker <https://bugs.python.org/issue45

[issue45261] Unreliable (?) results from timeit (cache issue?)

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: > but you give no reason for why you should not use the minimum. See https://pyperf.readthedocs.io/en/latest/analyze.html#minimum-vs-average I'm not really interested to convince you. Use the minimum if you believe that it better fits your ne

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-19007: "precise time.time() under Windows 8: use GetSystemTimePreciseAsFileTime". -- ___ Python tracker <https://bugs.python.o

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: Livius: do you care about using nanosleep(), or can I close the issue? -- ___ Python tracker <https://bugs.python.org/issue21

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: > On Windows with a Python 3.11 debug build, I get: > Mean +- std dev: 21.9 ms +- 7.8 ms (228 values) I wrote an optimization to cache the Windows timer handle between time.sleep() calls (don't close it). I don't think that it's needed because they sh

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: bench.py: measure the shortest possible sleep. Use time.sleep(1e-10): 0.1 nanosecond. It should be rounded to the resolution of the used sleep function, like 1 ns on Linux. On Linux with Fedora 34 Python 3.10 executable, I get: Mean +- std dev: 60.5 us

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: Livius: your first PR modified Sleep() in Modules/_tkinter.c to use nanosleep(). I don't see the point since this function has a solution of 1 ms (10^-3). Using select() on Unix is enough: resolution of 1 us (10^-6

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: New changeset 58f8adfda3c2b42f654a55500e8e3a6433cb95f2 by Victor Stinner in branch 'main': bpo-21302: time.sleep() uses waitable timer on Windows (GH-28483) https://github.com/python/cpython/commit/58f8adfda3c2b42f654a55500e8e3a6433cb95f2

[issue45256] Remove the usage of the cstack in Python to Python calls

2021-09-22 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +vstinner ___ Python tracker <https://bugs.python.org/issue45256> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28307] Accelerate 'string' % (value, ...) by using formatted string literals

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: commit a0bd9e9c11f5f52c7ddd19144c8230da016b53c6 Author: Serhiy Storchaka Date: Sat May 8 22:33:10 2021 +0300 bpo-28307: Convert simple C-style formatting with literal format into f-string. (GH-5012) C-style formatting with literal format

[issue45261] Unreliable (?) results from timeit (cache issue?)

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: > But timing results are not like that, the measurement errors are one-sided, not two: (..) I suggest you to run tons of benchmarks and look at the distribution. The reality is more complex than what you may think. > measurement = true value +

[issue41137] pdb uses the locale encoding for .pdbrc

2021-09-22 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +vstinner nosy_count: 4.0 -> 5.0 pull_requests: +26909 pull_request: https://github.com/python/cpython/pull/28518 ___ Python tracker <https://bugs.python.org/issu

[issue45261] Unreliable (?) results from timeit (cache issue?)

2021-09-22 Thread STINNER Victor
STINNER Victor added the comment: PyPy emits a warning when the timeit module is used, suggesting to use pyperf. timeit uses the minimum, whereas pyperf uses the average (arithmetic mean). timeit uses a single process, pyperf spawns 21 processes: 1 just for the loop calibration, 20

<    11   12   13   14   15   16   17   18   19   20   >