[issue44885] Incorrect exception highlighting for fstring format

2021-08-11 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

Given this code:

print(f"Here is that pesky {xxx/2:.3f} again")

The traceback prints:

Traceback (most recent call last):
  File "/home/pablogsal/github/python/main/lel.py", line 1, in 
print(f"Here is that pesky {xxx/2:.3f} again")
   ^^^
NameError: name 'xxx' is not defined

Removing the formatting part ":.3f" makes it work as expected

--
components: Interpreter Core
messages: 399372
nosy: BTaskaya, ammar2, pablogsal
priority: normal
severity: normal
status: open
title: Incorrect exception highlighting for fstring format
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 15f0a45b2822607f2c38685a72d06f050e24b215 by Miss Islington (bot) 
in branch '3.9':
bpo-33930: Fix segfault with deep recursion when cleaning method objects 
(GH-27678) (GH-27720)
https://github.com/python/cpython/commit/15f0a45b2822607f2c38685a72d06f050e24b215


--

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d6d2d549972422ccc6fa335ebf9907e4b3d71817 by Miss Islington (bot) 
in branch '3.10':
bpo-33930: Fix segfault with deep recursion when cleaning method objects 
(GH-27678) (GH-27719)
https://github.com/python/cpython/commit/d6d2d549972422ccc6fa335ebf9907e4b3d71817


--

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for the fix Augusto Goulart and Pablo! I close the issue.

Pablo asked in PR 27678 if a Python 3.8 Release Manager (Lukasz) wants a 
backport to 3.8.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue44886] asyncio: create_datagram_endpoint() does not return a DatagramTransport

2021-08-11 Thread Thomas Trummer


New submission from Thomas Trummer :

According to the documentation[1] loop.create_datagram_endpoint() returns an 
asyncio.DatagramTransport. However on Windows this is not the case when the 
ProactorEventLoop is used (which seems to be the default since Python 3.8). 
This is a problem because a DatagramProtocol subclass needs a downcast in order 
to satisfy the type system (or mypy for that matter).


[1] 
https://docs.python.org/3/library/asyncio-protocol.html#asyncio.DatagramTransport

---

# Will print:  False

import asyncio


class EchoServerProtocol(asyncio.DatagramProtocol):
def connection_made(self, transport):
print(type(transport), isinstance(transport, asyncio.DatagramTransport))


async def main():
transport, protocol = await 
asyncio.get_running_loop().create_datagram_endpoint(
lambda: EchoServerProtocol(),
local_addr=('127.0.0.1', ))

try:
await asyncio.sleep(5)
finally:
transport.close()


asyncio.run(main())

--
components: asyncio
messages: 399376
nosy: Thomas Trummer, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: create_datagram_endpoint() does not return a DatagramTransport
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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Łukasz Langa

Change by Łukasz Langa :


--
nosy: +lukasz.langa
nosy_count: 13.0 -> 14.0
pull_requests: +26204
pull_request: https://github.com/python/cpython/pull/27721

___
Python tracker 

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



[issue44878] Clumsy dispatching on interpreter entry.

2021-08-11 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +26205
pull_request: https://github.com/python/cpython/pull/27725

___
Python tracker 

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



[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-11 Thread STINNER Victor


STINNER Victor  added the comment:

Please don't add new macros. The TRASHCAN C API is already complex enough.

--
nosy: +vstinner

___
Python tracker 

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



[issue44881] Consider integration of GC_UNTRACK with TRASHCAN

2021-08-11 Thread STINNER Victor


STINNER Victor  added the comment:

Moreover, before making any change, I would suggest by starting with 
documenting the existing trashcan C API. Right now, there is no documentation 
in Doc/c-api/. Documentation can be copied from Include/cpython/object.h.

Last year, I modified the trashcan API to hide implementation details. There 
were also issues with the stable ABI... thing which is unclear to me, since the 
trashcan C API is excluded from the limited C API. Well, I excluded it. 
Previously, it was part of it, but it did not work with the limited C API.

commit 0fa4f43db086ac3459811cca4ec5201ffbee694a
Author: Victor Stinner 
Date:   Wed Feb 5 12:23:27 2020 +0100

bpo-39542: Exclude trashcan from the limited C API (GH-18362)

Exclude trashcan mechanism from the limited C API: it requires access to
PyTypeObject and PyThreadState structure fields, whereas these structures
are opaque in the limited C API.

The trashcan mechanism never worked with the limited C API. Move it
from object.h to cpython/object.h.

commit 38965ec5411da60d312b59be281f3510d58e0cf1
Author: Victor Stinner 
Date:   Fri Mar 13 16:51:52 2020 +0100

bpo-39947: Hide implementation detail of trashcan macros (GH-18971)

Py_TRASHCAN_BEGIN_CONDITION and Py_TRASHCAN_END macro no longer
access PyThreadState attributes, but call new private
_PyTrash_begin() and _PyTrash_end() functions which hide
implementation details.

commit db532a09990c837ec1348e6e6bd2719f5d4a8216
Author: Victor Stinner 
Date:   Wed Jun 23 15:51:47 2021 +0200

bpo-39947: Remove old private trashcan C API functions (GH-26869)

Remove 4 C API private trashcan functions which were only kept for
the backward compatibility of the stable ABI with Python 3.8 and
older, since the trashcan API was not usable with the limited C API
on Python 3.8 and older. The trashcan API was excluded from the
limited C API in Python 3.9.

Removed functions:

* _PyTrash_deposit_object()
* _PyTrash_destroy_chain()
* _PyTrash_thread_deposit_object()
* _PyTrash_thread_destroy_chain()

The trashcan C API was never usable with the limited C API, since old
trashcan macros accessed directly PyThreadState members like
"_tstate->trash_delete_nesting", whereas the PyThreadState structure
is opaque in the limited C API.

Exclude also the PyTrash_UNWIND_LEVEL constant from the C API.

The trashcan C API was modified in Python 3.9 by commit
38965ec5411da60d312b59be281f3510d58e0cf1 and in Python 3.10 by commit
ed1a5a5baca8f61e9a99c5be3adc16b1801514fe to hide implementation
details.

--

___
Python tracker 

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



[issue44881] Consider integration of PyObject_GC_UnTrack() with the trashcan C API

2021-08-11 Thread STINNER Victor


Change by STINNER Victor :


--
title: Consider integration of GC_UNTRACK with TRASHCAN -> Consider integration 
of PyObject_GC_UnTrack() with the trashcan C API

___
Python tracker 

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



[issue44881] Consider integration of PyObject_GC_UnTrack() with the trashcan C API

2021-08-11 Thread STINNER Victor


STINNER Victor  added the comment:

> Now, any object that uses the trashcan *must* be a GC object.

It would be nice to add an assertion in _PyTrash_begin().

--

___
Python tracker 

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-08-11 Thread Łukasz Langa

New submission from Łukasz Langa :

(I'm still investigating at the moment whether something changed in my 
environment.)

Running the following right now hangs on test_input_tty for me:

./python.exe -m test test_builtin test_builtin -v


This fails on all branches up to and including 3.7, so I assume this is 
environment-specific unless it's a regression due to a change that was 
backported all the way back to 3.7, which is out of the question as the last 
functional commit on 3.7 was back in June.

Things I tried so far:
- rebooting;
- using another terminal app (I use iTerm2 by default, tried Terminal.app too);
- another shell (I use fish by default, tried bash 5.0 as well);
- a non-pydebug build (I use pydebug builds by default to run -R:)


The test in question is using deadline if available and 
`sysconfig.get_config_vars()['HAVE_LIBREADLINE']` returns 1. I'll be trying to 
check if that works for me next.

--
messages: 399380
nosy: lukasz.langa
priority: low
severity: normal
stage: test needed
status: open
title: test_input_tty hangs when run multiple times in the same process on 
macOS 10.15
versions: Python 3.10, Python 3.11, 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



[issue44800] Code readability: rename interpreter frames to execution frames

2021-08-11 Thread Nick Coghlan


Nick Coghlan  added the comment:

Mark raised some valid concerns with the proposed naming convention over on the 
PR:

* the proposed names make it sound like there are genuinely two kinds of frame, 
when the actual relationship is between a frame's data storage and a Python 
object providing an interface to that storage
* _PyExecFrame looks like an actual Python type name, so we probably want 
something more like "Py_buffer" (where the lowercase name is intended to 
indicate that the struct isn't a full Python type)

Mark offered "activation record" as a possible name, but I'm going to see how 
"_Py_framedata" looks first (with "fdata" as the abbreviated form, since "fd" 
is so frequently used to mean "file descriptor")

I'm also going to see how the PR looks if both the frame and frame data struct 
keep their existing field prefixes - it may be that changing variable names 
will be enough to avoid ambiguity, in which case leaving the field names alone 
genuinely reduces code churn.

--

___
Python tracker 

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

Hynek confirmed on Big Sur with Python 3.9.5 from asdf that test_input_tty 
hangs, too, if ran for the second time in the same process.

Moreover, readline is not it. First of all, it's libedit on macOS:

❯ ll /usr/lib/libreadline.dylib
lrwxr-xr-x  1 root  wheel15B Feb  2  2020 /usr/lib/libreadline.dylib -> 
libedit.3.dylib


So Python uses that by default:
>>> import readline
>>> readline._READLINE_LIBRARY_VERSION
'EditLine wrapper'
>>> readline._READLINE_RUNTIME_VERSION
1026
>>> readline._READLINE_VERSION
1026


Unless you instruct it to use readline (for example by providing "-I$(brew 
--prefix readline)/include" to CFLAGS and "-L$(brew --prefix readline)/lib" to 
LDFLAGS before running ./configure):
>>> import readline
>>> readline._READLINE_LIBRARY_VERSION
'8.1'
>>> readline._READLINE_RUNTIME_VERSION
2049
>>> readline._READLINE_VERSION
2049


The hang is the same in both cases. 


Next course of action, checking if it's not due to fork shenanigans in 
_run_child():

https://github.com/python/cpython/blob/1841c70f2bdab9d29c1c74a8afffa45daf98/Lib/test/test_builtin.py#L2001

--

___
Python tracker 

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



[issue44878] Clumsy dispatching on interpreter entry.

2021-08-11 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 3f3d5dcac336463bd0eed64ba0bd7666ff2da1e1 by Mark Shannon in 
branch 'main':
bpo-44878:  _PyEval_EvalFrameDefault readability improvements (GH-27725)
https://github.com/python/cpython/commit/3f3d5dcac336463bd0eed64ba0bd7666ff2da1e1


--

___
Python tracker 

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



[issue44878] Clumsy dispatching on interpreter entry.

2021-08-11 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +26206
pull_request: https://github.com/python/cpython/pull/27726

___
Python tracker 

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

Parent process hangs on:
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x7fff6741181e libsystem_kernel.dylib`read + 10
frame #1: 0x00010226a117 python.exe`_Py_read(fd=3, 
buf=0x7f8d24009840, count=8192) at fileutils.c:1744:13
frame #2: 0x0001022f1335 
python.exe`_io_FileIO_readinto_impl(self=0x000103b284d0, 
buffer=0x7ffeedcbe928) at fileio.c:645:9
frame #3: 0x0001022f063e 
python.exe`_io_FileIO_readinto(self=0x000103b284d0, arg=0x000102f5d090) 
at fileio.c.h:205:20
frame #4: 0x0001020050e9 
python.exe`method_vectorcall_O(func=0x0001026fd970, 
args=0x7ffeedcbeaf0, nargsf=2, kwnames=0x) at 
descrobject.c:462:24
frame #5: 0x000101ff323d 
python.exe`_PyObject_VectorcallTstate(tstate=0x7f8d20d04f00, 
callable=0x0001026fd970, args=0x7ffeedcbeaf0, nargsf=2, 
kwnames=0x) at abstract.h:114:11
frame #6: 0x000101ff30c9 
python.exe`PyObject_VectorcallMethod(name=0x0001026fcbe0, 
args=0x7ffeedcbeaf0, nargsf=2, kwnames=0x) at call.c:770:24
frame #7: 0x0001022f92a0 
python.exe`PyObject_CallMethodOneArg(self=0x000103b284d0, 
name=0x0001026fcbe0, arg=0x000102f5d090) at abstract.h:204:12

where "name" in frame #7 is the "readinto" method of <_io.FileIO name=3 
mode='rb' closefd=True> and "arg" is .


Child process hangs on:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x7fff67413bf6 libsystem_kernel.dylib`write + 10
frame #1: 0x00010226a3e0 python.exe`_Py_write_impl(fd=2, 
buf=0x7ffeedcbcbcb, count=1, gil_held=0) at fileutils.c:1813:17
frame #2: 0x00010226a535 python.exe`_Py_write_noraise(fd=2, 
buf=0x7ffeedcbcbcb, count=1) at fileutils.c:1871:12
frame #3: 0x000102257834 python.exe`_Py_DumpASCII(fd=2, 
text=0x000102a1bed0) at traceback.c:1002:13
frame #4: 0x000102258ba5 python.exe`dump_frame(fd=2, 
frame=0x0001025dbba8) at traceback.c:1035:9
frame #5: 0x0001022579fa python.exe`dump_traceback(fd=2, 
tstate=0x7f8d20d04f00, write_header=0) at traceback.c:1084:9
frame #6: 0x000102257bc6 python.exe`_Py_DumpTracebackThreads(fd=2, 
interp=0x7f8d2281b010, current_tstate=0x7f8d20d04f00) at 
traceback.c:1186:9
frame #7: 0x000102311dc3 python.exe`faulthandler_dump_traceback(fd=2, 
all_threads=1, interp=0x7f8d2281b010) at faulthandler.c:245:15
frame #8: 0x00010231224b python.exe`faulthandler_user(signum=14) at 
faulthandler.c:843:5
frame #9: 0x7fff674c85fd libsystem_platform.dylib`_sigtramp + 29
frame #10: 0x7fff6741435f libsystem_kernel.dylib`__ioctl + 11
frame #11: 0x7fff6741434b libsystem_kernel.dylib`ioctl + 150
frame #12: 0x7fff6734ad63 libsystem_c.dylib`tcsetattr + 111
frame #13: 0x000103c772ee libreadline.8.dylib`_set_tty_settings + 28
frame #14: 0x000103c76d87 libreadline.8.dylib`rl_prep_terminal + 683
frame #15: 0x000103c88ce9 libreadline.8.dylib`_rl_callback_newline + 51
frame #16: 0x000103c5ae75 
readline.cpython-311d-darwin.so`readline_until_enter_or_signal(prompt="prompt", 
signal=0x7ffeedcbd63c) at readline.c:1318:5
frame #17: 0x000103c58637 
readline.cpython-311d-darwin.so`call_readline(sys_stdin=0x7fff8d9c8d90, 
sys_stdout=0x7fff8d9c8e28, prompt="prompt") at readline.c:1396:9
frame #18: 0x000101fad9b6 
python.exe`PyOS_Readline(sys_stdin=0x7fff8d9c8d90, 
sys_stdout=0x7fff8d9c8e28, prompt="prompt") at myreadline.c:391:14
frame #19: 0x0001021a071d 
python.exe`builtin_input_impl(module=0x00010268c0b0, 
prompt=0x0001027a0400) at bltinmodule.c:2188:13

--

___
Python tracker 

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

This might be a long-standing problem. I haven't encountered it before because 
I was always running -R: with -j and in this case the test is skipped:

test_input_tty (test.test_builtin.PtyTests) ... skipped 'stdin and stdout must 
be ttys'

--

___
Python tracker 

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



[issue44888] ssl.OP_LEGACY_SERVER_CONNECT missing

2021-08-11 Thread Tee KOBAYASHI


New submission from Tee KOBAYASHI :

Please implement ssl.OP_LEGACY_SERVER_CONNECT constant that corresponds to 
SSL_OP_LEGACY_SERVER_CONNECT in C. This is required to make OpenSSL 3.0.0 
behave like 1.1.1.

--
assignee: christian.heimes
components: SSL
messages: 399386
nosy: christian.heimes, xtkoba
priority: normal
severity: normal
status: open
title: ssl.OP_LEGACY_SERVER_CONNECT missing

___
Python tracker 

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



[issue25782] CPython hangs on error __context__ set to the error itself

2021-08-11 Thread Dong-hee Na


Dong-hee Na  added the comment:

> Serhiy, I'm not closing this yet in case you'd like to finish implementing 
> your PR. If not, feel free to close.

I check that PR 20543 makes CPython works correctly with msg399281 code.

--
nosy: +corona10

___
Python tracker 

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



[issue44889] Specialize LOAD_METHOD with PEP 659 adaptive interpreter

2021-08-11 Thread Ken Jin


New submission from Ken Jin :

Possible specializations:

- LOAD_METHOD_CACHED
Cache the method. We only need to check that type(o) and o.__dict__ was not 
modified.

- LOAD_METHOD_CLASS
For classmethods. Less speedup expected.

- LOAD_METHOD_MODULE
For module methods. Uncommon (<10%).

Please see https://github.com/faster-cpython/ideas/issues/81 for more details.

--
components: Interpreter Core
messages: 399388
nosy: kj
priority: normal
severity: normal
status: open
title: Specialize LOAD_METHOD with PEP 659 adaptive interpreter
versions: Python 3.11

___
Python tracker 

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



[issue16580] [doc] Add examples to int.to_bytes and int.from_bytes

2021-08-11 Thread Gautam Chaudhuri


Gautam Chaudhuri  added the comment:

I've rewritten woparry's patch so that it targets the current codebase as well 
as fixing the issues that Mark mentioned. It appears that the range checks on 
`to_bytes` have already been added to the documentation so I haven't added 
those.

Should a separate issue be raised for the behaviour of `int.from_bytes(b'', 
, signed=True')`? I think it's out of scope for this issue.

--
nosy: +quantum
Added file: https://bugs.python.org/file50210/issue16580.patch

___
Python tracker 

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



[issue44889] Specialize LOAD_METHOD with PEP 659 adaptive interpreter

2021-08-11 Thread Ken Jin


Change by Ken Jin :


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

___
Python tracker 

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



[issue44637] Quoting issue on header Reply-To

2021-08-11 Thread STINNER Victor


STINNER Victor  added the comment:

I change the issue type to security. The bug can be abused to send emails to 
the wrong email address.

--
nosy: +vstinner
type: behavior -> security

___
Python tracker 

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



[issue44878] Clumsy dispatching on interpreter entry.

2021-08-11 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset f66d00fdd7e9a333accc6bf0e37173051aaa55d0 by Mark Shannon in 
branch 'main':
bpo-44878: Remove the switch from the main interpreter loop when using computed 
gotos. (GH-27726)
https://github.com/python/cpython/commit/f66d00fdd7e9a333accc6bf0e37173051aaa55d0


--

___
Python tracker 

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



[issue44878] Clumsy dispatching on interpreter entry.

2021-08-11 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +26208
pull_request: https://github.com/python/cpython/pull/27727

___
Python tracker 

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



[issue44885] Incorrect exception highlighting for fstring format

2021-08-11 Thread Guido van Rossum


Guido van Rossum  added the comment:

(I originally reported this.)

--
nosy: +gvanrossum

___
Python tracker 

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



[issue44637] Quoting issue on header Reply-To

2021-08-11 Thread Julien Castiaux


Julien Castiaux  added the comment:

Hello David, Victor,

Thank you for the triage, it reminds me about this issue. David, the 
solution I tried last month was wrong, it was breaking (for good 
reasons) tons of unittests. It seems to me that there is indeed no other 
solution than to bloat the re-folding function a bit more and to fix the 
dbquotes there as your last email suggested.

I agree with you that the code will be even messier, honestly I spent 
quite some time understanding the _refold_parse_tree function and I 
don't feel like patching it.

Regards,

On 11.08.21 14:57, STINNER Victor wrote:
> STINNER Victor  added the comment:
>
> I change the issue type to security. The bug can be abused to send emails to 
> the wrong email address.
>
> --
> nosy: +vstinner
> type: behavior -> security
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue24955] webbrowser broken on Mac OS X when using the BROWSER variable

2021-08-11 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Also see https://bugs.python.org/issue42255

Hugo: can you convert the patch to a PR?

--
nosy: +andrei.avk

___
Python tracker 

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



[issue41494] Adds window resizing support to Lib/pty.py [ SIGWINCH ]

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Soumendra. Not resolved but superseded by a different issue has its own 
indicators on BPO.

--
nosy: +lukasz.langa
resolution:  -> out of date
status: open -> closed
superseder:  -> Lib/pty.py major revision

___
Python tracker 

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

Amazingly, excluding every other test function with a bunch of `-i` patterns 
still makes it hang when ran twice. On the other hand, only including the test 
function with `-m` works fine.

This is very weird. Looking further.

Semi-relatedly, I found BPO-26228, could reproduce it, and finished an open PR 
on it. While those are separate issues, I'm hoping to solve them both.

--

___
Python tracker 

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



[issue44885] Incorrect exception highlighting for fstring format

2021-08-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The problem lies here:

https://github.com/python/cpython/blob/f66d00fdd7e9a333accc6bf0e37173051aaa55d0/Parser/string_parser.c#L374-L389

The problem is that the strstr call will fail because the string containing the 
expression doesn't have the formatting part in it, so the offsets never get 
corrected.

--
nosy: +lys.nikolaou

___
Python tracker 

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

I found the high-level reason why test_builtin hangs: it runs doctests as well. 
What's the root cause? I don't know yet.


But to confirm, I can also hang the tests by running:

$ python3.9 -m test test_doctest test_builtin -v


Now to discover what it is that doctest does...

--

___
Python tracker 

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



[issue44885] Incorrect exception highlighting for fstring format

2021-08-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Actually, this has even more problems. Because we are using strstr to find the 
start of the expression in the parent string, if the expression is repeated the 
offsets are incorrectly generated:

For example:

print(f"Here is that {xxx} pesky {xxx} again")

This produces:

...
 FormattedValue(
value=Name(
   id='xxx',
   ctx=Load(),
   lineno=1,
   col_offset=22,
   end_lineno=1,
   end_col_offset=25),
...
 FormattedValue(
value=Name(
   id='',
   ctx=Load(),
   lineno=1,
   col_offset=22,
   end_lineno=1,
   end_col_offset=25),
...

while

print(f"Here is that {xxx} pesky {} again")

(different variables) produces:

...
 FormattedValue(
value=Name(
   id='xxx',
   ctx=Load(),
   lineno=1,
   col_offset=22,
   end_lineno=1,
   end_col_offset=25),
...
 FormattedValue(
value=Name(
   id='',
   ctx=Load(),
   lineno=1,
   col_offset=34,
   end_lineno=1,
   end_col_offset=38),
...

--

___
Python tracker 

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



[issue44885] Incorrect exception highlighting for fstring format

2021-08-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Ha, we have test that knows is broken:

https://github.com/python/cpython/blob/f66d00fdd7e9a333accc6bf0e37173051aaa55d0/Lib/test/test_fstring.py#L217

--

___
Python tracker 

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



[issue44890] Enable serialisation stats collection when Py_Debug

2021-08-11 Thread Irit Katriel


New submission from Irit Katriel :

Always collect stats under Py_Debug, which makes them available through the 
python api. Printing at interpreter exit is still disabled by default.

--
components: Interpreter Core
messages: 399401
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Enable serialisation stats collection when Py_Debug
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue44890] Enable specialization stats collection when Py_Debug

2021-08-11 Thread Irit Katriel


Change by Irit Katriel :


--
title: Enable serialisation stats collection when Py_Debug -> Enable 
specialization stats collection when Py_Debug

___
Python tracker 

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



[issue44890] Enable specialization stats collection when in Py_DEBUG

2021-08-11 Thread Irit Katriel


Change by Irit Katriel :


--
title: Enable specialization stats collection when Py_Debug -> Enable 
specialization stats collection when in Py_DEBUG

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 09d814b3833c2c852f4f233297b4561028782d2a by Łukasz Langa in 
branch '3.8':
[3.8] bpo-33930: Fix segfault with deep recursion when cleaning method objects 
(GH-27678) (GH-27721)
https://github.com/python/cpython/commit/09d814b3833c2c852f4f233297b4561028782d2a


--

___
Python tracker 

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



[issue44885] Incorrect exception highlighting for fstring format

2021-08-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

Apparently we've got ourselves refleaks with the patches.

It doesn't always reproduce but put test_exceptions -R: in a loop in 3.10 and 
soon enough you'll get:

0:00:00 load avg: 4.47 Run tests sequentially
0:00:00 load avg: 4.47 [1/1] test_exceptions
beginning 9 repetitions
123456789
.
test_exceptions leaked [2, 2, 2, 2] references, sum=8
test_exceptions leaked [2, 2, 2, 2] memory blocks, sum=8
test_exceptions failed (reference leak) in 59.6 sec

== Tests result: FAILURE ==

1 test failed:
test_exceptions


It's much harder to reproduce on 3.9 and 3.8 because test_exceptions has fewer 
tests and at least on my MBP finishes twice as fast. I ran 3.9 in a loop for an 
hour and no refleak.

--
resolution: fixed -> 
stage: resolved -> patch review
status: closed -> open
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

Interestingly, I can't reproduce the refleaks on `main` either, only on 3.10.

--

___
Python tracker 

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



[issue41710] Timeout is affected by jumps in system time

2021-08-11 Thread Mike Crowe


Mike Crowe  added the comment:

glibc v2.30 onwards provides sem_clockwait which can wait on either 
CLOCK_MONOTONIC or CLOCK_REALTIME. I failed to notice that 
https://sourceware.org/bugzilla/show_bug.cgi?id=14717 existed until today. :(

--
nosy: +mikecrowe

___
Python tracker 

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



[issue33479] Document tkinter and threads

2021-08-11 Thread Łukasz Langa

Change by Łukasz Langa :


--
versions: +Python 3.10, Python 3.11 -Python 2.7, Python 3.6, Python 3.7, Python 
3.8

___
Python tracker 

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



[issue44869] MacOS Monterrey malloc issue

2021-08-11 Thread Eduardo Morales


Eduardo Morales  added the comment:

I've been able to tackle the issue down and reported it to the library. 
Although I'm not sure if it's a Python or library issue.

https://github.com/ibmdb/python-ibmdb/issues/648

--

___
Python tracker 

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



[issue33479] Document tkinter and threads

2021-08-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26210
pull_request: https://github.com/python/cpython/pull/27730

___
Python tracker 

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



[issue33479] Document tkinter and threads

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 08caf2d5d4a9994976e9eafaf345b5a1a4012a81 by Mark Roseman in 
branch 'main':
bpo-33479: Add architecture and threading model sections to Tkinter module docs 
(GH-27717)
https://github.com/python/cpython/commit/08caf2d5d4a9994976e9eafaf345b5a1a4012a81


--

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

I gotta run for the day. The shortest way for me to reproduce is to focus on 
the tests that were added in 3.10 and shortening the repetitions a little:

$ time ./python.exe -E -Wd -m test test_exceptions -R3:3 -m 'test_attribute*' 
-m 'test_getattr*' -m 'test_lineno*' -m 'test_name_error*' -m 'test_recursion*' 
-m 'test_no_hang*'

0:00:00 load avg: 5.92 Run tests sequentially
0:00:00 load avg: 5.92 [1/1] test_exceptions
beginning 6 repetitions
123456
..
test_exceptions leaked [2, 2, 2] references, sum=6
test_exceptions leaked [2, 2, 2] memory blocks, sum=6
test_exceptions failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
test_exceptions

1 re-run test:
test_exceptions

Total duration: 11.8 sec
Tests result: FAILURE
   12.13 real11.44 user 0.61 sys

--

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

(BTW, with this command, it is indeed possible to trigger the ref leak on 
`main` as well, which makes it somewhat less scary.)

--

___
Python tracker 

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



[issue44890] Enable specialization stats collection when in Py_DEBUG

2021-08-11 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue33479] Document tkinter and threads

2021-08-11 Thread miss-islington


miss-islington  added the comment:


New changeset 2666d702e49aa0e4975553bec2e92ca4a2dba4ea by Miss Islington (bot) 
in branch '3.10':
bpo-33479: Add architecture and threading model sections to Tkinter module docs 
(GH-27717)
https://github.com/python/cpython/commit/2666d702e49aa0e4975553bec2e92ca4a2dba4ea


--

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Irit Katriel


Irit Katriel  added the comment:

It seems to have been introduced by 
https://github.com/python/cpython/pull/27626

I don't see how the code change could have introduced a leak. Maybe the new 
tests exposed a pre-existing leak?

--

___
Python tracker 

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

The doctest runner sets an output redirecting debugger, which subclasses Pdb, 
around actually running the doctest. This action causes the hang. New finding, 
we can hang the test with test_pdb too:

$ python3.9 -m test test_pdb test_builtin -v

--

___
Python tracker 

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



[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

It *is* readline-related after all O_O

Commenting out this section in Pdb.__init__ makes the issue go away:
https://github.com/python/cpython/blob/64a7812c170f5d46ef16a1517afddc7cd92c5240/Lib/pdb.py#L234-L239


time ./python.exe -E -Wd -m test test_builtin test_builtin
0:00:00 load avg: 2.12 Run tests sequentially
0:00:00 load avg: 2.12 [1/2] test_builtin
0:00:00 load avg: 2.12 [2/2] test_builtin

== Tests result: SUCCESS ==

All 2 tests OK.

Total duration: 1.3 sec
Tests result: SUCCESS
1.56 real 1.42 user 0.10 sys


I'll be continuing on this tomorrow to find the root cause.

--

___
Python tracker 

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



[issue44891] Tests for `id(a) == id(a * 1)` for `bytes` and `str`

2021-08-11 Thread Nikita Sobolev


New submission from Nikita Sobolev :

While working on `RustPython` (original issue: 
https://github.com/RustPython/RustPython/issues/2840), I've noticed that 
`tuple` in CPython has explicit tests that `id` does not change when multiplied 
by `1`, related:
- 
https://github.com/python/cpython/blob/64a7812c170f5d46ef16a1517afddc7cd92c5240/Lib/test/seq_tests.py#L322
- 
https://github.com/python/cpython/blob/64a7812c170f5d46ef16a1517afddc7cd92c5240/Lib/test/seq_tests.py#L286-L287

But, I cannot find similar tests for `str` and `bytes` which also have the same 
behavior: 
- `str`: 
https://github.com/python/cpython/blob/64a7812c170f5d46ef16a1517afddc7cd92c5240/Objects/unicodeobject.c#L12709-L12710
- `bytes`: 
https://github.com/python/cpython/blob/64a7812c170f5d46ef16a1517afddc7cd92c5240/Objects/bytesobject.c#L1456-L1458

Code:

```python
>>> b = b'abc'
>>> id(b), id(b * 1), id(b) == id(b * 1)
(4491073360, 4491073360, True)

>>> s = 'abc'
>>> id(s), id(s * 1), id(s) == id(s * 1)
(4489513776, 4489513776, True)
```

If tests are indeed missing and should be added, I would love to contribute 
them.

--
components: Tests
messages: 399414
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Tests for `id(a) == id(a * 1)` for `bytes` and `str`
type: enhancement

___
Python tracker 

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



[issue44892] Percentage character (%) inside a comment is badly recognized when using configparser

2021-08-11 Thread Diego Ramirez


New submission from Diego Ramirez :

On the Pip GitHub issue tracker (https://github.com/pypa/pip/issues/10348), a 
user reported a strange behaviour when using a config file (setup.cfg) on its 
project.

The config file had a percentage character ("%") inside a commentary. But the 
module "configparser" failed with traceback:

configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', 
found: "%' in string formatting

We consider that the character was badly recognized as a part of the file, when 
it was just a part of an inline comment.

Is there any way to fix this bug?

--
components: Library (Lib)
messages: 399415
nosy: DiddiLeija
priority: normal
severity: normal
status: open
title: Percentage character (%) inside a comment is badly recognized when using 
configparser
type: crash
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



[issue30952] [Windows] include Math extension in SQlite

2021-08-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

This was fixed in bpo-42686. Closing as duplicate.

--
nosy: +erlendaasland
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> include built-in Math functions in SQLite to 3.35.0 of march 
2021

___
Python tracker 

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



[issue35398] SQLite incorrect row count for UPDATE

2021-08-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

See also bpo-36859.

--
nosy: +erlendaasland

___
Python tracker 

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



[issue36859] sqlite3 dml statement detection does not account for CTEs

2021-08-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

See also bpo-35398

--

___
Python tracker 

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



[issue44893] importlib.metadata Entrypoint has a broken _asdict

2021-08-11 Thread Ronny Pfannschmidt


New submission from Ronny Pfannschmidt :

due to 

```
 def __iter__(self):
"""
Supply iter so one may construct dicts of EntryPoints easily.
"""
return iter((self.name, self))
```

the default namedtuple asdict method is broken

instead of returning the fields, recursive objects are returned as 

```
(Pdb) v
EntryPoint(name='.git', value='setuptools_scm.git:parse', 
group='setuptools_scm.parse_scm')
(Pdb) v._asdict()
{'name': '.git', 'value': EntryPoint(name='.git', 
value='setuptools_scm.git:parse', group='setuptools_scm.parse_scm')}
(Pdb) type(v)

(Pdb)

--
components: Library (Lib)
messages: 399419
nosy: Ronny.Pfannschmidt
priority: normal
severity: normal
status: open
title: importlib.metadata Entrypoint has a broken _asdict
type: behavior
versions: Python 3.10, Python 3.11, 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



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x, 12.1

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 81ab8db235580317edcb0e559cd4c983f70883f5 by Zephyr Shannon in 
branch 'main':
bpo-26228: Fix pty EOF handling (GH-12049)
https://github.com/python/cpython/commit/81ab8db235580317edcb0e559cd4c983f70883f5


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x, 12.1

2021-08-11 Thread Łukasz Langa

Change by Łukasz Langa :


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

___
Python tracker 

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



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x, 12.1

2021-08-11 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Łukasz Langa

Łukasz Langa  added the comment:

Entirely possible, Irit. We've had just this sort of case just last week! See: 
https://bugs.python.org/issue44524#msg399157

--

___
Python tracker 

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



[issue44845] Allow keyword arguments in code.__new__

2021-08-11 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Generally, construction time is faster if the arguments are positional only.  

Also, this isn't a method that people typically call directly — it is only 
quasi-public because the layout of the codestring is implementation dependent 
and changes every now and then.   Given that it is essentially private, there 
is no benefit to exposing keyword argument calls.

Thanks for the suggestion, but I don't think it makes things better for users.

--
nosy: +rhettinger
resolution:  -> rejected
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



[issue44894] HTTP request handler should check sys.stderr for None before use for logging

2021-08-11 Thread Xiaoling Bao


New submission from Xiaoling Bao :

This is about HTTP server library (found on Windows with python 3.9, not sure 
other platforms).

In file Lib\http\server.py, we define:
class BaseHTTPRequestHandler(...):
  def log_message(self, format, *args):
sys.stderr.write(...)

In certain cases, sys.stderr could be None and thus this function call will 
throw exception. My use case: I created an XMLRPC server 
(SimpleXMLRPCRequestHandler derives from BaseHTTPRequestHandler) within a 
Windows service. I guess with that combination, sys.stderr will be None. When 
this issue happens, the client got empty response and not much error log for 
debugging.

I can upload sample source code files if needed.

--
components: Library (Lib)
messages: 399423
nosy: xiaolingbao
priority: normal
severity: normal
status: open
title: HTTP request handler should check sys.stderr for None before use for 
logging
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



[issue44895] refleak test failure in test_exceptions

2021-08-11 Thread Irit Katriel


New submission from Irit Katriel :

For background see https://bugs.python.org/issue33930#msg399403


iritkatriel@Irits-MBP cpython % repeat 10 ./python.exe -m test -R 3:3 
test_exceptions -m test_no_hang_on_context_chain_cycle2 -m 
test_recursion_normalizing_infinite_exception -m 
test_recursion_in_except_handler -m test_recursion_normalizing_with_no_memory
0:00:00 load avg: 2.32 Run tests sequentially
0:00:00 load avg: 2.32 [1/1] test_exceptions
beginning 6 repetitions
123456
..

== Tests result: SUCCESS ==

1 test OK.

Total duration: 5.9 sec
Tests result: SUCCESS
0:00:00 load avg: 2.22 Run tests sequentially
0:00:00 load avg: 2.22 [1/1] test_exceptions
beginning 6 repetitions
123456
..

== Tests result: SUCCESS ==

1 test OK.

Total duration: 5.8 sec
Tests result: SUCCESS
0:00:00 load avg: 2.20 Run tests sequentially
0:00:00 load avg: 2.20 [1/1] test_exceptions
beginning 6 repetitions
123456
..

== Tests result: SUCCESS ==

1 test OK.

Total duration: 5.8 sec
Tests result: SUCCESS
0:00:00 load avg: 2.17 Run tests sequentially
0:00:00 load avg: 2.17 [1/1] test_exceptions
beginning 6 repetitions
123456
..
test_exceptions leaked [6, 6, 4] references, sum=16
test_exceptions leaked [6, 6, 4] memory blocks, sum=16
test_exceptions failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
test_exceptions

1 re-run test:
test_exceptions

Total duration: 5.9 sec
Tests result: FAILURE
0:00:00 load avg: 2.08 Run tests sequentially
0:00:00 load avg: 2.08 [1/1] test_exceptions
beginning 6 repetitions
123456
..
test_exceptions leaked [6, 6, 6] references, sum=18
test_exceptions leaked [6, 6, 6] memory blocks, sum=18
test_exceptions failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
test_exceptions

1 re-run test:
test_exceptions

Total duration: 5.8 sec
Tests result: FAILURE
0:00:00 load avg: 2.39 Run tests sequentially
0:00:00 load avg: 2.39 [1/1] test_exceptions
beginning 6 repetitions
123456
..
test_exceptions leaked [6, 6, 6] references, sum=18
test_exceptions leaked [6, 6, 6] memory blocks, sum=18
test_exceptions failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
test_exceptions

1 re-run test:
test_exceptions

Total duration: 6.0 sec
Tests result: FAILURE
0:00:00 load avg: 2.36 Run tests sequentially
0:00:00 load avg: 2.36 [1/1] test_exceptions
beginning 6 repetitions
123456
..
test_exceptions leaked [6, 6, 6] references, sum=18
test_exceptions leaked [6, 6, 6] memory blocks, sum=18
test_exceptions failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
test_exceptions

1 re-run test:
test_exceptions

Total duration: 6.0 sec
Tests result: FAILURE
0:00:00 load avg: 2.31 Run tests sequentially
0:00:00 load avg: 2.31 [1/1] test_exceptions
beginning 6 repetitions
123456
..

== Tests result: SUCCESS ==

1 test OK.

Total duration: 6.3 sec
Tests result: SUCCESS
0:00:00 load avg: 2.20 Run tests sequentially
0:00:00 load avg: 2.20 [1/1] test_exceptions
beginning 6 repetitions
123456
..
test_exceptions leaked [6, 6, 6] references, sum=18
test_exceptions leaked [6, 6, 6] memory blocks, sum=18
test_exceptions failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
test_exceptions

1 re-run test:
test_exceptions

Total duration: 6.1 sec
Tests result: FAILURE
0:00:00 load avg: 2.35 Run tests sequentially
0:00:00 load avg: 2.35 [1/1] test_exceptions

--
components: Interpreter Core
messages: 399424
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: refleak test failure in test_exceptions
versions: Python 3.11

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Irit Katriel


Irit Katriel  added the comment:

I've narrowed it down a bit more and created issue44895.

--

___
Python tracker 

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



[issue44881] Consider integration of PyObject_GC_UnTrack() with the trashcan C API

2021-08-11 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

I was thinking about this more today and I think the better fix is to actually 
build the trashcan mechanism into _Py_Dealloc().  Requiring that types opt-in 
to the trashcan mechanism by using the trashcan macros is not ideal.  

First, the trashcan macros are a bit tricky to use correctly.  Second, every 
"container" type is potentially a part of a long ref chain and could blow up 
the stack on deallocation (i.e. triggered from DECREF).  So, for 
correctness/robustness, every type that supports cyclic GC should get 
trashcan-style deallocation.

We would have to find a way to do this without incurring a (significant) 
performance hit.  Also, it would have to be done without breaking C extensions. 
 Ideally they would get trashcan-style deallocation without any source code 
changes.  I'm not sure if that can be done but I'm hopeful it's possible.

--

___
Python tracker 

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



[issue44896] Issue with unparse in ast module

2021-08-11 Thread Kai Xia


New submission from Kai Xia :

I was trying to construct an ast object dynamically and I think I can identify 
some potential issue.

With the following snippet:

```
#!/usr/bin/env python3
import ast
import sys

print(sys.version)

good = ast.Assign(
targets=[ast.Name(id="hello", ctx=ast.Store())],
value=ast.Constant(value="world"),
lineno=1
)
print(ast.unparse(good))


bad = ast.Assign(
targets=[ast.Name(id="hello", ctx=ast.Store())],
value=ast.Constant(value="world"),
)
print(ast.unparse(bad))
```

On my box the output looks like:

```
3.9.6 (default, Jun 29 2021, 05:25:02)
[Clang 12.0.5 (clang-1205.0.22.9)]
hello = 'world'
Traceback (most recent call last):
  File "/Users/xiaket/py.py", line 19, in 
print(ast.unparse(bad))
  File 
"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py",
 line 1572, in unparse
return unparser.visit(ast_obj)
  File 
"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py",
 line 801, in visit
self.traverse(node)
  File 
"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py",
 line 795, in traverse
super().visit(node)
  File 
"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py",
 line 407, in visit
return visitor(node)
  File 
"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py",
 line 858, in visit_Assign
if type_comment := self.get_type_comment(node):
  File 
"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py",
 line 786, in get_type_comment
comment = self._type_ignores.get(node.lineno) or node.type_comment
AttributeError: 'Assign' object has no attribute 'lineno'
```

As I can understand, when we need to construct the Assign object, we'll need to 
provide two keyword arguments, targets and value. We don't need to provide the 
`lineno` as it should be an attribute of the statement node. Also, if we don't 
run `unparse` against the object, apparently it works fine.

I think in the `get_type_comment` method, we are making the assumption that the 
lineno is set automatically, this is true when we are parsing python source 
code as string. But when we are creating the object from scratch, we don't have 
that `lineno` attribute and it will fail.

--
components: Library (Lib)
messages: 399427
nosy: xiaket
priority: normal
severity: normal
status: open
title: Issue with unparse in ast module
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
nosy: +benjamin.peterson
nosy_count: 14.0 -> 15.0
pull_requests: +26213
pull_request: https://github.com/python/cpython/pull/27733

___
Python tracker 

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



[issue42560] Improve Tkinter Documentation

2021-08-11 Thread Mark Roseman


Mark Roseman  added the comment:

I was having a peek at the main tkinter doc page again and would like to take a 
broader crack at it. I think most of what is there now (life 
preserver/reference) needs to be substantially reworked or trimmed.

I think exhaustive description of all methods etc. is unrealistic given the 
magnitude of the job and variation between versions, but it seems reasonable 
that the doc page would help identify what tkinter API to use, how to find out 
what it's parameters and options are (interactively), and if needed how to 
figure out the corresponding Tcl command so things can be looked up in the 
Tcl/Tk docs and in general map from Tcl to Python.

Ultimately, if the tkinter docs can get people started and point them to the 
right places to learn more (including things like the TkDocs tutorial or 
Shipman ref, the Tcl/Tk man pages) I'd call it a win. Right now it's a big 
muddle, and one that too easily becomes out-of-date.

--
nosy: +markroseman

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset f08e6d1bb3c5655f184af88c6793e90908bb6338 by Benjamin Peterson in 
branch 'main':
bpo-33930: Fix typo in the test name. (#27733)
https://github.com/python/cpython/commit/f08e6d1bb3c5655f184af88c6793e90908bb6338


--

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26215
pull_request: https://github.com/python/cpython/pull/27735

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26214
pull_request: https://github.com/python/cpython/pull/27734

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +26216
pull_request: https://github.com/python/cpython/pull/27736

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset d7f5796a1ec7ba223f6a844d7580559abef05238 by Miss Islington (bot) 
in branch '3.8':
bpo-33930: Fix typo in the test name. (GH-27735)
https://github.com/python/cpython/commit/d7f5796a1ec7ba223f6a844d7580559abef05238


--

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2021-08-11 Thread miss-islington


miss-islington  added the comment:


New changeset f7635f0e542c916bfd62542e7b60ee23ff681d0d by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-33930: Fix typo in the test name. (GH-27733) (GH-27734)
https://github.com/python/cpython/commit/f7635f0e542c916bfd62542e7b60ee23ff681d0d


--

___
Python tracker 

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



[issue44893] importlib.metadata Entrypoint has a broken _asdict

2021-08-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +jaraco

___
Python tracker 

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



[issue44893] importlib.metadata Entrypoint has a broken _asdict

2021-08-11 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

I'll probably fix the issue in importlib_metadata first 
(https://github.com/python/importlib_metadata/issues/337).

--

___
Python tracker 

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



[issue44892] configparser fails when the file contains a "%" inside a commentary

2021-08-11 Thread Diego Ramirez


Change by Diego Ramirez :


--
title: Percentage character (%) inside a comment is badly recognized when using 
configparser -> configparser fails when the file contains a "%" inside a 
commentary

___
Python tracker 

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



[issue44173] Stored (uncompressed) ZipExtFile in zipfile can be seekable at lower cost

2021-08-11 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +alanmcintyre, serhiy.storchaka, twouters

___
Python tracker 

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



[issue44173] Stored (uncompressed) ZipExtFile in zipfile can be seekable at lower cost

2021-08-11 Thread JuniorJPDJ


Change by JuniorJPDJ :


--
pull_requests: +26217
pull_request: https://github.com/python/cpython/pull/27737

___
Python tracker 

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



[issue44897] Integrate trashcan mechanism into _Py_Dealloc

2021-08-11 Thread Neil Schemenauer


New submission from Neil Schemenauer :

This is a WIP/proof-of-concept of doing away with Py_TRASHCAN_BEGIN and 
Py_TRASHCAN_END and instead integrating the functionality into _Py_Dealloc.  
There are a few advantages:

- all container objects have the risk of overflowing the C stack if a long 
reference chain of them is created and then deallocated.  So, to be safe, the 
tp_dealloc methods for those objects should be protected from overflowing the 
stack.

- the Py_TRASHCAN_BEGIN and Py_TRASHCAN_END macros are hard to understand and a 
bit hard to use correctly.  Making the mechanism internal avoids confusion.  
The code can be slightly simplified as well.

This proof-of-concept seems to pass tests but it will need some careful review. 
 The exact rules related to calling GC Track/Untrack are subtle and this 
changes things a bit.  I.e. tp_dealloc is called with GC objects already 
untracked.  For 3rd party extensions, they are calling PyObject_GC_UnTrack() 
and so I believe they should still work.  

The fact that PyObject_CallFinalizerFromDealloc() wants GC objects to 
definitely be tracked is a bit of a mystery to me (there is an assert to check 
that).  I changed the code to track objects if they are not already tracked but 
I'm not sure that's correct.

There could be a performance hit, due to the _PyType_IS_GC() test that was 
added to the _Py_Dealloc() function.  For non-GC objects, that's going to be a 
new branch and I'm worried it might hurt a bit.  OTOH, maybe it's just in the 
noise.  Profiling will need to be done.

--
components: Interpreter Core
messages: 399433
nosy: nascheme
priority: normal
severity: normal
stage: patch review
status: open
title: Integrate trashcan mechanism into _Py_Dealloc
type: enhancement

___
Python tracker 

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



[issue44897] Integrate trashcan mechanism into _Py_Dealloc

2021-08-11 Thread Neil Schemenauer


Change by Neil Schemenauer :


--
keywords: +patch
pull_requests: +26218
pull_request: https://github.com/python/cpython/pull/27738

___
Python tracker 

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



[issue44881] Consider integration of PyObject_GC_UnTrack() with the trashcan C API

2021-08-11 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

I wrote a proof-of-concept as bpo-44897.  PR 27718 (this issue) might a 
slightly better performance but I like the other one better because it doesn't 
expose so much implementation detail to extension types.  Either of them 
require careful review before merging.

--

___
Python tracker 

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