[issue47198] os.stat on windows doesn't take an open file even though os.stat in os.supports_fd

2022-04-01 Thread Eryk Sun


Eryk Sun  added the comment:

You're mistaken about what `fd` is. It's a TextIOWrapper, which wraps a 
BufferedWriter, which buffers a FileIO raw file object, which accesses the open 
file number fd.fileno(). For example:

>>> f = open('tmp.tmp','w')
>>> os.stat(f.fileno()).st_size
0

--
nosy: +eryksun
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue47198] os.stat on windows doesn't take an open file even though os.stat in os.supports_fd

2022-04-01 Thread Joe Cool


New submission from Joe Cool :

os.stat on windows doesn't take an open file even though os.stat in 
os.supports_fd

>>> fd = open('tmp.tmp', 'w')
>>> fd
<_io.TextIOWrapper name='tmp.tmp' mode='w' encoding='cp1252'>
>>> os.stat(fd)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: stat: path should be string, bytes, os.PathLike or integer, not 
TextIOWrapper
>>> os.stat in os.supports_fd
True

--
messages: 416535
nosy: snoopyjc
priority: normal
severity: normal
status: open
title: os.stat on windows doesn't take an open file even though os.stat in 
os.supports_fd
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue47190] Integrating tkinter and asyncio event loops

2022-04-01 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I did some somewhat similar experiments a few years ago.  I will try to find 
the code sometime.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue47188] ncurses: *** buffer overflow detected ***: terminated with -D_FORTIFY_SOURCE=3

2022-04-01 Thread Siddhesh Poyarekar


Change by Siddhesh Poyarekar :


--
nosy: +siddhesh

___
Python tracker 

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



[issue44660] email.feedparser: support RFC 6532 section 3.5

2022-04-01 Thread Francis Johnson


Francis Johnson  added the comment:

Hello,

I haven't had the time to complete @r.david.murrary's recommendation and 
unfortunately don't anticipate that I will for now.  Any objection to me 
resubmitting the pull request as-is?  Alone, it still delivers business value 
so to speak.

Thanks

--

___
Python tracker 

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



[issue47147] Allow `return yield from`

2022-04-01 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I think that this should be closed as rejected, and that Patrick should remove 
the 'return's that are in front of 'yield from ...'.  Then 'yield from x' will 
be a statement, not an expression, and the ()s will not be needed, as they are 
used to differentiate yield expressions from yield statements. Generator 
functions return generators, not return expressions.  The latter are only used 
for the StopIteration .value attribute, which I believe is always None for 
Patrick's code and in any case is never used.  So his code should run the same 
without these 'return's.

The exception for '= yield ...' is similar to '= a, ...' not needing ()s.  This 
is the only exception for yield expressions because this is normally the only 
place a yield expression should be used by itself instead of with other 
operators or functions, where ()s are needed.

The python-ideas thread archive is at
https://mail.python.org/archives/list/python-id...@python.org/thread/L6XRQ5YWAE535JGZH2MF2TD32C65K5ZI/

Andrew Svetlov objected (-1) because to him ()s make the statement more 
readable.

Michael Smith got to the real problem, which is that one should not be using 
"return (yield from x)" unless one is accessing a possibly non-None value 
attribute of the implicitly raised StopIteration exception.

I oppose adding a second no-() exception for such rare (and somewhat confusing) 
expert uses. 

In a generator function, the return value is a generator based on the entire 
body of the function.  Any return statement value becomes the value attribute 
of the StopIteration raised when the generator is exhausted.  In other words, 
'return x' in this context translates to "raise StopIteration(x)' (which is 
illegal to write directly). I am pretty sure that in your code, the value of 
'yield from func' is always None.  In any case, StopIteration().value is never 
used.

To illustrate:

def g0():
return (yield from ())  # Immediately raise StopIteration(None).

try: next(g0())
except StopIteration as e:
print(e.value)

# Prints 'None'.

--
nosy: +terry.reedy
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



[issue47162] Add call trampoline to work around bad fpcasts on Emscripten

2022-04-01 Thread Hood Chatham


Hood Chatham  added the comment:

Actually, I think the _PyImport_InitFunc trampoline call is only there as a 
work around for the problematic `test_imp` and `test_import` Python tests. I 
don't know of any third party code with a problem there.

--

___
Python tracker 

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



[issue47197] ctypes mishandles `void` return type

2022-04-01 Thread Hood Chatham


Change by Hood Chatham :


--
keywords: +patch
nosy: +hoodmane
nosy_count: 2.0 -> 3.0
pull_requests: +30317
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32246

___
Python tracker 

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



[issue47131] Speedup test_unparse

2022-04-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 0f68c208fa6a36b6c8ad3d775e64292a665ba108 by Jeremy Kloth in 
branch 'main':
bpo-47131: Speedup AST comparisons in test_unparse by using node traversal 
(GH-32132)
https://github.com/python/cpython/commit/0f68c208fa6a36b6c8ad3d775e64292a665ba108


--
nosy: +pablogsal

___
Python tracker 

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



[issue47089] Avoid sporadic failure of test_compileall on Windows

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for this enhancement. I close the issue.

Do you know if it does fix the old bpo-37387 issue?

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



[issue47089] Avoid sporadic failure of test_compileall on Windows

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 306a93b4819db611041da735ca3b34117a3bc961 by Jeremy Kloth in 
branch '3.9':
[3.9] bpo-47089: Avoid test_compileall failures on Windows (GH-32037). 
(GH-32240)
https://github.com/python/cpython/commit/306a93b4819db611041da735ca3b34117a3bc961


--

___
Python tracker 

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



[issue12387] IDLE save keyboard shortcut problem

2022-04-01 Thread David Goncalves


Change by David Goncalves :


--
nosy: +dpg
nosy_count: 9.0 -> 10.0
pull_requests: +30316
pull_request: https://github.com/python/cpython/pull/32245

___
Python tracker 

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



[issue47197] ctypes mishandles `void` return type

2022-04-01 Thread Hood Chatham


New submission from Hood Chatham :

On wasm targets, `test_code` fails. It's because of a bad function pointer 
cast. The problematic code is as follows:
```py
import ctypes

py = ctypes.pythonapi
freefunc = ctypes.CFUNCTYPE(None, ctypes.c_voidp)

RequestCodeExtraIndex = py._PyEval_RequestCodeExtraIndex
RequestCodeExtraIndex.argtypes = (freefunc,)
RequestCodeExtraIndex.restype = ctypes.c_ssize_t

SetExtra = py._PyCode_SetExtra
SetExtra.argtypes = (ctypes.py_object, ctypes.c_ssize_t, ctypes.c_voidp)
SetExtra.restype = ctypes.c_int

LAST_FREED = None
def myfree(ptr):
global LAST_FREED
LAST_FREED = ptr

FREE_FUNC = freefunc(myfree)
FREE_INDEX = RequestCodeExtraIndex(FREE_FUNC)


# Verify that the provided free function gets invoked
# when the code object is cleaned up.
f = eval('lambda:42')

SetExtra(f.__code__, FREE_INDEX, ctypes.c_voidp(100))
del f # crashes!!
```

The problem: `freefunc = ctypes.CFUNCTYPE(None, ctypes.c_voidp)` declares a 
function with signature `int f(void*)`. However, the definition of `freefunc` 
is `void f(void*)`. These function signatures do not agree, and trying to make 
the call crashes.

Due to a bug(?) ctypes can produce closures that have `void` return type but it 
can't produce simple functions with void return type.

Closures code: checks if `restype == Py_None` and if so gives the callback a 
void return type
https://github.com/python/cpython/blob/main/Modules/_ctypes/callbacks.c#L381

Direct call code: calls `_ctypes_get_ffi_type` which never returns 
`ffi_type_void`:
https://github.com/python/cpython/blob/b183f486493e7e4c332566392ef18c6b346a6561/Modules/_ctypes/callproc.c#L1212

--
components: ctypes
messages: 416526
nosy: christian.heimes, hoodchatham
priority: normal
severity: normal
status: open
title: ctypes mishandles `void` return type

___
Python tracker 

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



[issue47196] Function pointer cast in test_imp

2022-04-01 Thread Hood Chatham


Hood Chatham  added the comment:

Every other `PyInit` function in that module also needs the spec argument to be 
removed in order for test_importlib to pass.

--

___
Python tracker 

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



[issue47196] Function pointer cast in test_imp

2022-04-01 Thread Hood Chatham


Change by Hood Chatham :


--
keywords: +patch
nosy: +hoodmane
nosy_count: 2.0 -> 3.0
pull_requests: +30315
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32244

___
Python tracker 

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



[issue47196] Function pointer cast in test_imp

2022-04-01 Thread Hood Chatham


New submission from Hood Chatham :

The function PyInit_imp_dummy is declared as void f(PyObject* spec) and ignores 
the argument. In the test, it is called via imp.load_dynamic as void f(void). 
On wasm targets without the call trampolines added in 
https://bugs.python.org/issue47162
this causes a fatal error. (There's a bit more discussion about this issue in 
that thread.)

--
messages: 416524
nosy: christian.heimes, hoodchatham
priority: normal
severity: normal
status: open
title: Function pointer cast in test_imp

___
Python tracker 

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



[issue47152] Reorganize the re module sources

2022-04-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

1. If we're reorganizing anyway, I see no reason to keep the old names.
2. For maximum backwards compatibility, I'd say keep as much as you can, as 
long as keeping it won't interfere with the reorganization.

--

___
Python tracker 

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



[issue47162] Add call trampoline to work around bad fpcasts on Emscripten

2022-04-01 Thread Hood Chatham


Hood Chatham  added the comment:

As an update, building the chrome devtools with the wasm limit set to 12Mb 
following that guide worked fantastic. Highly recommend it. (Though there are a 
few paths that are out of date, I had to consult google's devtools docs.)

The problem is that `PyInit_imp_dummy` takes a spec argument which it ignores. 
Then the test calls it without a spec.
https://github.com/python/cpython/blob/082d3495d0c820972f09f6109a98ed7eb5a7b79f/Modules/_testmultiphase.c#L897

Minimized trigger:
```
import importlib
import imp
spec = importlib.util.find_spec('_testmultiphase')
imp.load_dynamic("test.imp_dummy", spec.origin)
```
Causes `RuntimeError: null function or function signature mismatch`

--

___
Python tracker 

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



[issue47162] Add call trampoline to work around bad fpcasts on Emscripten

2022-04-01 Thread Hood Chatham


Hood Chatham  added the comment:

I'm having trouble pinpointing the bad function pointer because chrome cuts off 
the end of the wasm file with: 
```
;;  text is truncated due to size
```
Maybe I should follow the directions here, since this is a consistent nuisance.
https://www.diverto.hr/en/blog/2020-08-15-WebAssembly-limit/
I have a stack trace but the key info of what function is being called is 
missing. If chrome didn't truncate the wasm I could figure out what the callee 
is too.

I looked into this before at some point and IIRC the issue is that one 
initialization code path hands the Init function a spec but the a different 
path doesn't give it the spec. It wasn't obvious how to fix the problem.

--

___
Python tracker 

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



[issue47162] Add call trampoline to work around bad fpcasts on Emscripten

2022-04-01 Thread Christian Heimes


Christian Heimes  added the comment:

Interesting, can you pin point the buggy function pointer? If you link with 
-gsource-map and deploy the map file, your browser should give you a decent 
stack trace.

--

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-04-01 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +30314
pull_request: https://github.com/python/cpython/pull/32243

___
Python tracker 

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


--
pull_requests: +30313
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32242

___
Python tracker 

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



[issue47089] Avoid sporadic failure of test_compileall on Windows

2022-04-01 Thread miss-islington


miss-islington  added the comment:


New changeset 1069d529590850e87a11b8c559a7fb296e9c626a by Miss Islington (bot) 
in branch '3.10':
bpo-47089: Avoid test_compileall failures on Windows (GH-32037)
https://github.com/python/cpython/commit/1069d529590850e87a11b8c559a7fb296e9c626a


--

___
Python tracker 

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



[issue47185] code.replace(co_code=new_code) no longer catch exceptions on Python 3.11

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

Guido (msg416498)
> Surely the bigger issue is that the contents of new_code itself must be 
> totally different? Also there are other tables that need to be adjusted if 
> you really do change co_code, e.g. the debugging tables.

Do you consider that .replace() must reject changing co_code if other tables 
are not updated?

Debugging tables are not strictly required just to *execute* code, no?

If you consider that the caller *must* update co_exceptiontable, replace() must 
raise an exception in this case, to prevent creating a code object which would 
behave in a strange way (broken exception handling).

If someone really wants testing an empty exception table just for fun, it would 
still be possible to pass co_exceptiontable=b''.

My concern is more about people upgrading to Python 3.11 and who "suddenly" 
don't get their exceptions handled anymore. I would prefer catching such bug at 
the replace() call, rather than having to execute the code (and only notice the 
bug in production? oops).

--

___
Python tracker 

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



[issue47192] sys._getframe audit event has frame as argument in 3.8-3.10

2022-04-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +steve.dower

___
Python tracker 

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



[issue47195] importlib lock race issue in deadlock handling code

2022-04-01 Thread Richard Purdie


New submission from Richard Purdie :

We've seen tracebacks in production like:

  File "", line 1004, in 
_find_and_load(name='oe.gpg_sign', import_=)
  File "", line 158, in 
_ModuleLockManager.__enter__()
  File "", line 110, in _ModuleLock.acquire()
 KeyError: 139622474778432

and

  File "", line 1004, in 
_find_and_load(name='oe.path', import_=)
  File "", line 158, in 
_ModuleLockManager.__enter__()
  File "", line 110, in _ModuleLock.acquire()
 KeyError: 140438942700992

I've attached a reproduction script which shows that if an import XXX is in 
progress and waiting at the wrong point when an interrupt arrives (in this case 
a signal) and triggers it's own import YYY, _blocking_on[tid] in 
importlib/_bootstrap.py gets overwritten and lost, triggering the traceback we 
see above upon exit from the second import.

I'm using a signal handler here as the interrupt, I don't know what our 
production source is as yet but this reproducer proves it is possible.

--
components: Interpreter Core
files: testit2.py
messages: 416517
nosy: rpurdie
priority: normal
severity: normal
status: open
title: importlib lock race issue in deadlock handling code
versions: Python 3.10
Added file: https://bugs.python.org/file50714/testit2.py

___
Python tracker 

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



[issue47191] inspect - getasyncgeneratorstate, getasyncgeneratorlocals

2022-04-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems to be duplicate of https://bugs.python.org/issue35759

--
nosy: +xtreak

___
Python tracker 

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



[issue46023] Modules/makesetup generated rules ignore *disabled*

2022-04-01 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue47174] Define behavior of descriptor-typed fields on dataclasses

2022-04-01 Thread mike bayer


Change by mike bayer :


--
nosy: +zzzeek

___
Python tracker 

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



[issue47162] Add call trampoline to work around bad fpcasts on Emscripten

2022-04-01 Thread Hood Chatham


Hood Chatham  added the comment:

Note that there are still Python test suite failures in emscripten without 
these trampolines enabled, for instance test_imp fails. The only trampoline 
needed to pass the core test suite is _PyImport_InitFunc_TrampolineCall.

--
nosy: +hoodchatham

___
Python tracker 

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



[issue47194] Upgrade to zlib v1.2.12 in CPython binary releases

2022-04-01 Thread Zachary Ware


Change by Zachary Ware :


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

___
Python tracker 

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-04-01 Thread Sam Ezeh


Sam Ezeh  added the comment:

This is what functionality looks like when supplying incorrect attribute names 
with the patch.

Python 3.11.0a6+ (heads/bpo-47135-dirty:d4bb38f82b, Apr  1 2022, 20:01:56) [GCC 
11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _pydecimal
>>> ctx = _pydecimal.getcontext()
>>> ctx.precision = 10
Traceback (most recent call last):
  File "", line 1, in 
  File "/run/media/sam/OS/Git/cpython/Lib/_pydecimal.py", line 3974, in 
__setattr__
raise AttributeError(
^
AttributeError: 'decimal.Context' object has no attribute 'precision'
>>> with _pydecimal.localcontext(precision=10) as ctx:
... pass
... 
Traceback (most recent call last):
  File "", line 1, in 
  File "/run/media/sam/OS/Git/cpython/Lib/_pydecimal.py", line 506, in 
localcontext
setattr(ctx, key, value)

  File "/run/media/sam/OS/Git/cpython/Lib/_pydecimal.py", line 3974, in 
__setattr__
raise AttributeError(
^
AttributeError: 'decimal.Context' object has no attribute 'precision'
>>> import decimal
>>> ctx = decimal.getcontext()
>>> ctx.precision = 10
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'decimal.Context' object has no attribute 'precision'
>>> with decimal.localcontext(precision=10) as ctx:
... pass
... 
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'precision' is an invalid keyword argument for this function
>>>

--

___
Python tracker 

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-04-01 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I'm not sure what the implementation uses to enforce this, but decimal 
contexts already seem to reject arbitrary attributes. So a naive 
implementation that just setattr()'s the keyword arguments will 
automatically fail:

>>> from decimal import getcontext
>>> ctx = getcontext()
>>> setattr(ctx, 'precision', 10)
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'decimal.Context' object has no attribute 'precision'

But you are absolutely correct that however we enforce it, we should 
avoid allowing typos to silently fail.

--

___
Python tracker 

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



[issue47170] py launcher on windows opens new terminal window when parsing python script with shebang

2022-04-01 Thread Eryk Sun


Eryk Sun  added the comment:

> This is Windows (shell) behaviour. To avoid this, you need to 
> add the .py extension to the PATHEXT environment variable.

PowerShell reuses the current console session only if .PY is set in PATHEXT. 
Otherwise Python gets executed with a flag that tells the system to allocate a 
new console session.

For CMD, PATHEXT only affects the file search, not how the file is executed. If 
the internal START command isn't used, CMD reuses the current console session. 
The START command defaults to making the system allocate a new console, unless 
the /B option is used.

--
nosy: +eryksun

___
Python tracker 

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-04-01 Thread Sam Ezeh


Sam Ezeh  added the comment:

I've uploaded a patch and it seems to work, which I'm very proud of.

I'll create some tests, amend documentation and create a news entry. After 
that, I'll create a pull request on GitHub.

--
keywords: +patch
Added file: https://bugs.python.org/file50713/sam_ezeh.patch

___
Python tracker 

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



[issue47193] Use zlib-ng rather than zlib in binary releases

2022-04-01 Thread Oleg Iarygin


Change by Oleg Iarygin :


--
nosy: +arhadthedev

___
Python tracker 

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



[issue47194] Upgrade to zlib v1.2.12 in CPython binary releases

2022-04-01 Thread Gregory P. Smith


New submission from Gregory P. Smith :

zlib v1.2.11 as used in Windows binary releases contains a security issue that, 
while fixed in its git repo years ago, never wound up in a release or a CVE 
until just now.

Folllow the https://www.openwall.com/lists/oss-security/2022/03/24/1 thread and 
the and recently assigned CVE-2018-25032.

I believe we only ship our own zlib on Windows so this issue is tagged as such. 
 The above oss-security thread is where an idea of severity will come out.

--
components: Extension Modules, Windows
messages: 416510
nosy: gregory.p.smith, lukasz.langa, ned.deily, pablogsal, paul.moore, 
steve.dower, tim.golden, zach.ware
priority: release blocker
severity: normal
stage: needs patch
status: open
title: Upgrade to zlib v1.2.12 in CPython binary releases
type: security
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2022-04-01 Thread Brett Cannon


Change by Brett Cannon :


--
nosy: +barneygale

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-04-01 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 082d3495d0c820972f09f6109a98ed7eb5a7b79f by Christian Heimes in 
branch 'main':
bpo-40280: Emscripten fork_exec now fails early (GH-32224)
https://github.com/python/cpython/commit/082d3495d0c820972f09f6109a98ed7eb5a7b79f


--

___
Python tracker 

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



[issue47193] Use zlib-ng rather than zlib in binary releases

2022-04-01 Thread Gregory P. Smith


New submission from Gregory P. Smith :

zlib-ng is an optimized zlib library with better performance on most 
architectures (with contributions from the likes of Google, Cloudflare, and 
Intel).  It is API compatible with zlib.  https://github.com/zlib-ng/zlib-ng

I believe the only platform we don't use the OS's own zlib on is Windows so I'm 
tagging this issue Windows.

--
components: Windows
messages: 416508
nosy: gregory.p.smith, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Use zlib-ng rather than zlib in binary releases
type: performance
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



[issue47089] Avoid sporadic failure of test_compileall on Windows

2022-04-01 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
pull_requests: +30311
pull_request: https://github.com/python/cpython/pull/32240

___
Python tracker 

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-04-01 Thread Sam Ezeh


Sam Ezeh  added the comment:

I'm looking into adding this

> Seems reasonable to me, but I think a full implementation would want to throw 
> an error for keyword args that don't already exist as context attributes 
> (otherwise typos would fail silently)

For _pydecimal, I think this would automatically happen automatically as 
Context.__setattr__ raises AttributeError when it's passed a name that isn't a 
context attribute.

For _decimal this can be done with keyword arguments and 
`PyArg_ParseTupleAndKeywords`.

--
nosy: +sam_ezeh

___
Python tracker 

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



[issue47192] sys._getframe audit event has frame as argument in 3.8-3.10

2022-04-01 Thread Dutcho


New submission from Dutcho :

Documentation (https://docs.python.org/3/library/audit_events.html and 
https://docs.python.org/3/library/sys.html#sys._getframe) states that 
`sys._getframe()` "raises [...] an auditing event with no arguments".
However, Python 3.8-3.10 provide the frame as argument to the hook function. 
Python 3.11 behaves consistently with documentation.
But I couldn't find the change mentioned in the change log. Therefore, I'm 
uncertain whether that's intentional or not, so whether it'll remain in the 
release version.

This is demonstrated by running snippet `audit.py`
```
import sys
sys.addaudithook(print)
print(sys.version)
sys._getframe()
```
in various versions:
```
3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
sys._getframe (>,)

3.9.11 (tags/v3.9.11:2de452f, Mar 16 2022, 14:33:45) [MSC v.1929 64 bit (AMD64)]
sys._getframe (>,)

3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)]
sys._getframe (>,)

3.11.0a6 (main, Mar  7 2022, 16:46:19) [MSC v.1929 64 bit (AMD64)]
sys._getframe ()
```

--
messages: 416506
nosy: Dutcho
priority: normal
severity: normal
status: open
title: sys._getframe audit event has frame as argument in 3.8-3.10
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



[issue47191] inspect - getasyncgeneratorstate, getasyncgeneratorlocals

2022-04-01 Thread Animatea Animatea


New submission from Animatea Animatea :

Create inspect introspection functions for asyncgen.

```py
ASYNCGEN_CREATED = 'ASYNCGEN_CREATED'
ASYNCGEN_RUNNING = 'ASYNCGEN_RUNNING'
ASYNCGEN_SUSPENDED = 'ASYNCGEN_SUSPENDED'
ASYNCGEN_CLOSED = 'ASYNCGEN_CLOSED'

def getasyncgeneratorstate(asyncgenerator):
"""Get current state of a async generator-iterator.

Possible states are:
  ASYNCGEN_CREATED: Waiting to start execution.
  ASYNCGEN_RUNNING: Currently being executed by the interpreter.
  ASYNCGEN_SUSPENDED: Currently suspended at a yield expression.
  ASYNCGEN_CLOSED: Execution has completed.
"""
if asyncgenerator.ag_running:
return ASYNCGEN_RUNNING
if asyncgenerator.ag_frame is None:
return ASYNCGEN_CLOSED
if asyncgenerator.ag_frame.f_lasti == -1:
return ASYNCGEN_CREATED
return ASYNCGEN_SUSPENDED


def getasyncgeneratorlocals(asyncgenerator):
"""
Get the mapping of async generator local variables to their current values.

A dict is returned, with the keys the local variable names and values the
bound values."""

if not isasyncgen(asyncgenerator):
raise TypeError("{!r} is not a Python generator".format(asyncgenerator))

frame = getattr(asyncgenerator, "ag_frame", None)
if frame is not None:
return asyncgenerator.ag_frame.f_locals
else:
return {}
```

--
components: Library (Lib)
messages: 416505
nosy: animatea.programming
priority: normal
severity: normal
status: open
title: inspect - getasyncgeneratorstate, getasyncgeneratorlocals
type: enhancement
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue47009] Streamline list.append for the common case

2022-04-01 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +30310
pull_request: https://github.com/python/cpython/pull/32239

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-04-01 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +30309
pull_request: https://github.com/python/cpython/pull/32238

___
Python tracker 

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



[issue47089] Avoid sporadic failure of test_compileall on Windows

2022-04-01 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +30308
pull_request: https://github.com/python/cpython/pull/32237

___
Python tracker 

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



[issue47089] Avoid sporadic failure of test_compileall on Windows

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 76b8a075b8a79b08468fd0ed06a489a5c815bc11 by Jeremy Kloth in 
branch 'main':
bpo-47089: Avoid test_compileall failures on Windows (GH-32037)
https://github.com/python/cpython/commit/76b8a075b8a79b08468fd0ed06a489a5c815bc11


--

___
Python tracker 

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



[issue47185] code.replace(co_code=new_code) no longer catch exceptions on Python 3.11

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

python-dev thread:
https://mail.python.org/archives/list/python-...@python.org/thread/KWSPCLXDHBAP2U4LBSMLQEOC7LREDMPB/

Mark wrote:

"You can pass the exception table the same way you pass all the other 
arguments. The exception table depends on the code, but that is nothing new. 
The bytecode library already recomputes the consts, names, etc."

Constants and names are easy to build, it's just an array and the bytecode 
refers to their index.

Building the exception table is more complicated. It's nice that the format is 
documented in 
https://github.com/python/cpython/blob/main/Objects/exception_handling_notes.txt
 but it would be more convenient to put it in the regular Python documentation 
(docs.python.org), no? I discovered that file by mistake with filename 
completion in my editor while looking for Objects/exceptions.c :-)

--

___
Python tracker 

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



[issue47152] Reorganize the re module sources

2022-04-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Modules with old names are kept (deprecated). The questions are:

1. Should we keep the sre_ prefix in new submodules? Should we prefix them with 
underscores?
2. Should we keep only non-underscored names in the sre_* modules or undescored 
names too?

--

___
Python tracker 

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



[issue47185] code.replace(co_code=new_code) no longer catch exceptions on Python 3.11

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> How would you compute the exception table from the bytecode? There are no 
> clues in the bytecode about where the try and except blocks are.

Disassemble the bytecode to rebuild basic blocks and detect which ones are 
except blocks. I don't know how the exception table works :-) It's just a guess.

Or do you think that this job should be done by the caller?

--

___
Python tracker 

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



[issue47190] Integrating tkinter and asyncio event loops

2022-04-01 Thread Skip Montanaro


New submission from Skip Montanaro :

After looking around and asking, it appears there is no built-in integration of 
the tkinter and asyncio event loops. That would seem to be a good thing, at 
least as an example. I wrote a simple hello world which creates an AsyncTk 
class and uses asyncio-driven event handling. This is clearly incomplete, but 
might be a useful starting point, even if just as a seed for discussion or as 
an example for tkinter or asyncio documentation.

Discussion/thread references:

https://mail.python.org/pipermail/python-list/2022-March/905783.html
https://discuss.python.org/t/connecting-asyncio-and-tkinter-event-loops/14722/7

The code in its most basic form is attached. (I have another version which uses 
pynput to track keyboard and mouse events.)

--
components: Tkinter
files: tkasyncio.py
messages: 416500
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: Integrating tkinter and asyncio event loops
versions: Python 3.11
Added file: https://bugs.python.org/file50712/tkasyncio.py

___
Python tracker 

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



[issue47185] code.replace(co_code=new_code) no longer catch exceptions on Python 3.11

2022-04-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

How would you compute the exception table from the bytecode? There are no clues 
in the bytecode about where the try and except blocks are.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2022-04-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

> See bpo-47185: code.replace(co_code=new_code) no longer catch exceptions on 
> Python 3.11.

Surely the bigger issue is that the contents of new_code itself must be totally 
different? Also there are other tables that need to be adjusted if you really 
do change co_code, e.g. the debugging tables.

--

___
Python tracker 

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



[issue47185] code.replace(co_code=new_code) no longer catch exceptions on Python 3.11

2022-04-01 Thread Eric Snow


Change by Eric Snow :


--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue47152] Reorganize the re module sources

2022-04-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't mind reorganizing this, but I would insist that we keep code using old 
undocumented things (like the sre_* modules) working for several releases, 
using the standard deprecation approach.

--

___
Python tracker 

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



[issue47189] What's new in Python 3.11: Faster CPython

2022-04-01 Thread Ken Jin


Change by Ken Jin :


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

___
Python tracker 

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



[issue47189] What's new in Python 3.11: Faster CPython

2022-04-01 Thread Ken Jin


Change by Ken Jin :


--
assignee: docs@python
components: Documentation
nosy: docs@python, kj
priority: normal
severity: normal
status: open
title: What's new in Python 3.11: Faster CPython
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



[issue47161] pathlib method relative_to doesnt work with // in paths

2022-04-01 Thread Barney Gale


Change by Barney Gale :


--
nosy: +barneygale

___
Python tracker 

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



[issue47146] PR check "Check if generated files are up to date" failing intermittently

2022-04-01 Thread Eric Snow


Eric Snow  added the comment:

Looks like gh-32218 worked.

--
status: open -> closed

___
Python tracker 

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



[issue47188] ncurses: *** buffer overflow detected ***: terminated with -D_FORTIFY_SOURCE=3

2022-04-01 Thread Martin Liška

New submission from Martin Liška :

Note -D_FORTIFY_SOURCE=3 will come newly with GCC12. So I noticed the following 
error:

demo.py:
```python
import curses

curses.initscr()
curses.unget_wch('a')
```

Error message:
*** buffer overflow detected ***: terminated

Backtrace:
#0  __pthread_kill_implementation (threadid=, 
signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x77d1e1e3 in __pthread_kill_internal (signo=6, threadid=) at pthread_kill.c:78
#2  0x77cce306 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/posix/raise.c:26
#3  0x77cb7813 in __GI_abort () at abort.c:79
#4  0x77d111b7 in __libc_message (action=action@entry=do_abort, 
fmt=fmt@entry=0x77e573cf "*** %s ***: terminated\n") at 
../sysdeps/posix/libc_fatal.c:155
#5  0x77db630a in __GI___fortify_fail (msg=msg@entry=0x77e57375 
"buffer overflow detected") at fortify_fail.c:26
#6  0x77db48b6 in __GI___chk_fail () at chk_fail.c:28
#7  0x77db5be8 in __wcrtomb_chk (s=s@entry=0xaae440 "\376\271\255", 
wchar=wchar@entry=97 L'a', ps=ps@entry=0x7fffd4f0, buflen=buflen@entry=1) 
at wcrtomb_chk.c:31
#8  0x77a18b31 in wcrtomb (__ps=, __wchar=, __s=, __s=, __wchar=, 
__ps=) at /usr/include/bits/wchar2.h:402
#9  unget_wch_sp (sp=0xab0920, wch=97 L'a') at 
../ncurses/./widechar/lib_unget_wch.c:89
#10 0x77a18b61 in unget_wch (wch=) at 
../ncurses/./widechar/lib_unget_wch.c:113
#11 0x77a55be5 in _curses_unget_wch (module=, ch='a') at 
/home/marxin/Programming/cpython/Modules/_cursesmodule.c:4497
#12 0x006f6669 in cfunction_vectorcall_O (func=, args=0x77b355b0, 
nargsf=, kwnames=0x0) at Objects/methodobject.c:512
#13 0x0042d0e8 in _PyObject_VectorcallTstate (kwnames=0x0, 
nargsf=, args=, callable=, tstate=) 
at ./Include/cpython/abstract.h:114
#14 PyObject_Vectorcall (kwnames=0x0, nargsf=, args=, callable=) at ./Include/cpython/abstract.h:123
#15 call_function (kwnames=0x0, oparg=, pp_stack=, bounds=0x7fffd640, tstate=0xa70520) at Python/ceval.c:5379
#16 _PyEval_EvalFrameDefault (tstate=, f=, 
throwflag=) at Python/ceval.c:3772

So as seen __wcrtomb_chk is called with buflen == 1 and the function aborts if:

size_t
__wcrtomb_chk (char *s, wchar_t wchar, mbstate_t *ps, size_t buflen)
{
  /* We do not have to implement the full wctomb semantics since we
 know that S cannot be NULL when we come here.  */
  if (buflen < MB_CUR_MAX)
__chk_fail ();

  return __wcrtomb (s, wchar, ps);
}

Where MB_CUR_MAX == 6.

So the question is if the issue is in libcurses library (that is compiler with 
-D_FORTIFY_SOURCE=3), or in Modules/_cursesmodule.c?

--
messages: 416495
nosy: Martin Liška
priority: normal
severity: normal
status: open
title: ncurses: *** buffer overflow detected ***: terminated with 
-D_FORTIFY_SOURCE=3

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-04-01 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 17245c815e44e79d4dad6a99b54000956a4a7229 by Christian Heimes in 
branch 'main':
bpo-40280: Add debug Emscripten flavors (GH-32233)
https://github.com/python/cpython/commit/17245c815e44e79d4dad6a99b54000956a4a7229


--

___
Python tracker 

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



[issue46023] Modules/makesetup generated rules ignore *disabled*

2022-04-01 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset abdd69c95c1711c2dc75be4e784c6d6c80a409b9 by Christian Heimes in 
branch 'main':
bpo-46023: makesetup: skip all duplicate modules (GH-32234)
https://github.com/python/cpython/commit/abdd69c95c1711c2dc75be4e784c6d6c80a409b9


--

___
Python tracker 

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



[issue47168] Improvements for stable ABI definition files

2022-04-01 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 079143df7e40c4d336cb5c385b166aa91058d050 by Petr Viktorin in 
branch 'main':
bpo-47168: Mark files generated by `make regen-limited-abi` as generated 
(GH-32195)
https://github.com/python/cpython/commit/079143df7e40c4d336cb5c385b166aa91058d050


--

___
Python tracker 

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



[issue46992] If use textwrap.dedent with string formatting, may get unintended sentences.

2022-04-01 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm going to close this. If you have a more concrete proposal, either re-open 
this or bring it up on python-ideas.

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

___
Python tracker 

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



[issue47172] Make virtual opcodes in the compiler negative and is_jump() identify only proper jumps

2022-04-01 Thread Irit Katriel


Change by Irit Katriel :


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



[issue47172] Make virtual opcodes in the compiler negative and is_jump() identify only proper jumps

2022-04-01 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 997ba5d126f5040d5b7536f73bc89049e9f9421d by Irit Katriel in 
branch 'main':
bpo-47172: Compiler enhancements (GH-32200)
https://github.com/python/cpython/commit/997ba5d126f5040d5b7536f73bc89049e9f9421d


--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue47161] pathlib method relative_to doesnt work with // in paths

2022-04-01 Thread Eryk Sun


Eryk Sun  added the comment:

> Hmm..., I get it, but Im not gonna lie it's pretty confusing given 
> that in other places `//` works as a substitute for `/`. Maybe it 
> should be mentioned in the documentation?

In Linux, the system resolves "//" as just "/". In other POSIX systems, such as 
Cygwin or MSYS2 (running in Windows), "//" is a UNC path of the form 
"//server/share/filepath". I would expect resolve() to handle this. For example:

Linux:

>>> p = pathlib.Path('//tmp')
>>> p
PosixPath('//tmp')
>>> p.resolve()
PosixPath('/tmp')

However, resolve() is broken for a UNC path in 3.9 under MSYS2:

>>> p = pathlib.Path('//localhost/C$/temp')
>>> p.exists()
True
>>> p.resolve()
PosixPath('/localhost/C$/temp')
>>> p.resolve().exists()
False

realpath() is also broken for this case in 3.9 under MSYS2:

>>> os.path.realpath(p)
'/localhost/C$/temp'

--
nosy: +eryksun

___
Python tracker 

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



[issue46023] Modules/makesetup generated rules ignore *disabled*

2022-04-01 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +30306
pull_request: https://github.com/python/cpython/pull/32234

___
Python tracker 

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



[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2022-04-01 Thread Eryk Sun


Eryk Sun  added the comment:

> Now a file that doesn't exist:
> >>> mike = Path("palin.jpg")
> >>> mike.resolve()
> WindowsPath('palin.jpg')

This is a bug in resolve(). It was fixed in 3.10+ by switching to 
ntpath.realpath(). I don't remember why a fix for 3.9 was never applied. Work 
on the PR may have stalled due to a minor disagreement.

> 'C:\Windows\..\Program Files' and '/usr/../bin' == relative path

No, a relative path depends on either the current working directory or, for a 
symlink target, the path of the directory that contains the symlink.

In Windows, a rooted path such as r"\spam" is a relative path because it 
depends on the drive of the current working directory. For example, if the 
current working directory is r"Z:\eggs", then r"\spam" resolves to r"Z:\spam". 
Also, a drive-relative paths such as "Z:spam" depends on the working directory 
of the given drive. Windows supports a separate working directory for each 
drive. For example, if the working directory of drive "Z:" is r"Z:\eggs", then 
"Z:spam" resolves to r"Z:\eggs\spam".

--
nosy: +eryksun

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-04-01 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +30305
pull_request: https://github.com/python/cpython/pull/32233

___
Python tracker 

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



[issue47187] locale module example is wrong for some platforms

2022-04-01 Thread Sylvain Marie


New submission from Sylvain Marie :

The example in the doc shows

```python
>>> import locale
>>> loc = locale.getlocale()  # get current locale
# use German locale; name might vary with platform
>>> locale.setlocale(locale.LC_ALL, 'de_DE')
>>> locale.strcoll('f\xe4n', 'foo')  # compare a string containing an umlaut
>>> locale.setlocale(locale.LC_ALL, '')   # use user's preferred locale
>>> locale.setlocale(locale.LC_ALL, 'C')  # use default (C) locale
>>> locale.setlocale(locale.LC_ALL, loc)  # restore saved locale
```

However locale.getlocale() does not return the locale for all categories 
(locale.LC_ALL is even not allowed) but the locale for the LC_CTYPE category.

Therefore restoring it using `locale.setlocale(locale.LC_ALL, loc)` does not 
actually restore the initial settings, and may even fail on some platforms (on 
mine it does).

The correct example should have the first line of code replaced with

```
>>> loc = locale.setlocale(locale.LC_ALL)  # get current locale
```

Note: this issue was first reported in the `pandas` library at 
https://github.com/pandas-dev/pandas/issues/46595

--
assignee: docs@python
components: Documentation
messages: 416487
nosy: docs@python, smarie
priority: normal
severity: normal
status: open
title: locale module example is wrong for some platforms
versions: Python 3.10

___
Python tracker 

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



[issue38668] Update os.path documentation regarding recommended types

2022-04-01 Thread Jack DeVries


Change by Jack DeVries :


--
keywords: +patch
nosy: +jack__d
nosy_count: 2.0 -> 3.0
pull_requests: +30304
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32232

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2022-04-01 Thread Jack DeVries


Jack DeVries  added the comment:

Did you run ``make venv`` to setup your virtual environment? Sphynx themes are 
usually pip dependencies, so if you're getting a "missing theme" error, it 
sounds like your virtual environment is not setup right.

--
nosy: +jack__d

___
Python tracker 

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



[issue47186] split JUMP_IF_NOT_EXC/EG_MATCH into CHECK_EXC/EG_MATCH + jump

2022-04-01 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 04e07c258f4f2ac85e25355242a113f98a706f04 by Irit Katriel in 
branch 'main':
bpo-47186: Replace JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH + jump (GH-32231)
https://github.com/python/cpython/commit/04e07c258f4f2ac85e25355242a113f98a706f04


--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue47186] split JUMP_IF_NOT_EXC/EG_MATCH into CHECK_EXC/EG_MATCH + jump

2022-04-01 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue47186] split JUMP_IF_NOT_EXC/EG_MATCH into CHECK_EXC/EG_MATCH + jump

2022-04-01 Thread Irit Katriel


New submission from Irit Katriel :

It would help issue47120 to reduce the number of jump opcodes.

The exception matching opcodes JUMP_IF_NOT_EXC_MATCH  and JUMP_IF_NOT_EG_MATCH 
are not hot, and we can split them into a check + ordinary jump. 

For JUMP_IF_NOT_EXC_MATCH  this is simple because the stack effect is the same 
for the jump and non-jump case. For JUMP_IF_NOT_EG_MATCH the stack effect will 
need to be made the same, and the opcodes emitted around it adapted.

--
assignee: iritkatriel
components: Interpreter Core
messages: 416484
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: split JUMP_IF_NOT_EXC/EG_MATCH into CHECK_EXC/EG_MATCH + jump
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



[issue46841] Inline bytecode caches

2022-04-01 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset ae9de82e321581e1906c6ef2a7ad83ab30ae3325 by Brandt Bucher in 
branch 'main':
bpo-46841: Use a `bytes` object for `_co_code_adaptive` (GH-32205)
https://github.com/python/cpython/commit/ae9de82e321581e1906c6ef2a7ad83ab30ae3325


--

___
Python tracker 

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



[issue32658] Metacharacter (\) documentation suggestion

2022-04-01 Thread mike mcleod


Change by mike mcleod :


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

___
Python tracker 

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



[issue46841] Inline bytecode caches

2022-04-01 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset bd2e47c8830d1b2869f2b4345945a5e0c3b4e3fb by Brandt Bucher in 
branch 'main':
bpo-46841: Avoid unnecessary allocations in code object comparisons (GH-3)
https://github.com/python/cpython/commit/bd2e47c8830d1b2869f2b4345945a5e0c3b4e3fb


--

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2022-04-01 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +30301
pull_request: https://github.com/python/cpython/pull/32229

___
Python tracker 

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



[issue47009] Streamline list.append for the common case

2022-04-01 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset a0ea7a116ce52a178c02d42b684089758bd7f355 by Dennis Sweeney in 
branch 'main':
bpo-47009: Streamline list.append for the common case (GH-31864)
https://github.com/python/cpython/commit/a0ea7a116ce52a178c02d42b684089758bd7f355


--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

See bpo-47185: code.replace(co_code=new_code) no longer catch exceptions on 
Python 3.11.

--
nosy: +vstinner

___
Python tracker 

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



[issue47185] code.replace(co_code=new_code) no longer catch exceptions on Python 3.11

2022-04-01 Thread STINNER Victor


New submission from STINNER Victor :

Since bpo-40222 "Zero cost exception handling", code object created by from 
bytecode with code.replace(co_code=new_code) no longer catch exceptions on 
Python 3.11, unless an exception table is set explicitly.

Example:
---
def f():
try:
print("raise")
raise ValueError
except ValueError:
print("except")
else:
print("else")
print("exit func")

def g(): pass

if 1:
code = f.__code__
g.__code__ = g.__code__.replace(
co_code=code.co_code,
co_consts=code.co_consts,
co_names=code.co_names,
co_flags=code.co_flags,
co_stacksize=code.co_stacksize)
else:
g.__code__ = f.__code__  # this code path works on Python 3.11

g()
---

Output with Python 3.10 (ok):
---
raise
except
exit func
---

Output with Python 3.11 (oops):
---
raise
Traceback (most recent call last):
  ...
ValueError
---

Would it make sense to automatically compute co_exceptiontable on 
code.replace(co_code=new_code)? If it's computed automatically, I don't know if 
it makes still sense to call code.replace(co_code=new_code, 
co_exceptiontable=new_table).

It seems like currently, the only implementation to build an exception table 
lives in Python/compile.c which compiles AST to bytecode. It cannot be reused 
for code.replace() which takes bytecode as input, not AST.

--

If code.replace() is not updated to recompute co_exceptiontable, at least, it 
would be nice to document the bpo-40222 changes in What's New in Python 3.11 
and in the CodeType documentation:

* https://docs.python.org/dev/library/types.html#types.CodeType
* https://docs.python.org/dev/whatsnew/3.11.html

--
components: Interpreter Core
messages: 416479
nosy: vstinner
priority: normal
severity: normal
status: open
title: code.replace(co_code=new_code) no longer catch exceptions on Python 3.11
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



[issue47183] Cant compile html docs

2022-04-01 Thread mike mcleod


mike mcleod  added the comment:

Works for me. The command installed the correct version of Sphinx.
Thanks.

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

___
Python tracker 

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



[issue47169] Stable ABI: Some optional (#ifdef'd) functions aren't handled correctly

2022-04-01 Thread Jakub Kulik


Jakub Kulik  added the comment:

Solaris is affected by missing `PyThread_get_thread_native_id`; all other 
symbols from the SYMBOL_NAMES tuple (in test_stable_abi_ctypes.py) are 
available.

--

___
Python tracker 

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



[issue47169] Stable ABI: Some optional (#ifdef'd) functions aren't handled correctly

2022-04-01 Thread Jakub Kulik


Change by Jakub Kulik :


--
nosy: +kulikjak

___
Python tracker 

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



[issue46850] [C API] Move _PyEval_EvalFrameDefault() to the internal C API

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f877b40e3f7e0d97878884d80fbec879a85ab7e8 by Victor Stinner in 
branch 'main':
bpo-46850: Move _PyInterpreterState_SetEvalFrameFunc() to internal C API 
(GH-32054)
https://github.com/python/cpython/commit/f877b40e3f7e0d97878884d80fbec879a85ab7e8


--

___
Python tracker 

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported on Unix

2022-04-01 Thread Jakub Kulik


Jakub Kulik  added the comment:

Yes, it still does, and PyThread_get_thread_native_id is the only symbol 
missing.

--

___
Python tracker 

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



[issue47182] _PyUnicode_Fini should invalidate ucnhash_capi capsule pointer

2022-04-01 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 55d5c96c57738766eb6f3b5ccfa6599d5f094c18 by Christian Heimes in 
branch '3.10':
[3.10] bpo-47182: Fix crash by named unicode characters after interpreter 
reinitialization (GH-32212) (GH-32216)
https://github.com/python/cpython/commit/55d5c96c57738766eb6f3b5ccfa6599d5f094c18


--

___
Python tracker 

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


--
pull_requests: +30300
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32225

___
Python tracker 

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


Added file: https://bugs.python.org/file50711/sam_ezeh.patch

___
Python tracker 

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


Removed file: https://bugs.python.org/file50710/sam_ezeh.patch

___
Python tracker 

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


Added file: https://bugs.python.org/file50710/sam_ezeh.patch

___
Python tracker 

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


Removed file: https://bugs.python.org/file50709/sam_ezeh.patch

___
Python tracker 

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Sam Ezeh  added the comment:

I've submitted a patch that introduces code that raises TypeError at 
construction if `fieldnames` is not a sequence

--
keywords: +patch
nosy: +sam_ezeh
Added file: https://bugs.python.org/file50709/sam_ezeh.patch

___
Python tracker 

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



[issue46850] [C API] Move _PyEval_EvalFrameDefault() to the internal C API

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b9a5522dd952125a99ff554f01f311cae25f5a91 by Victor Stinner in 
branch 'main':
bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API (GH-32052)
https://github.com/python/cpython/commit/b9a5522dd952125a99ff554f01f311cae25f5a91


--

___
Python tracker 

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



[issue47152] Reorganize the re module sources

2022-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

sre_constants, sre_compile and sre_parse are not tested and are not documented. 
I don't consider them as public API currently.

If someone has good reason to use them, IMO we must clearly define which exact 
API is needed, properly document and test it.

If we expose something, I don't think that the API would be exposed as 
re.sre_xxx.xxx, but as re.xxx. 

I suggest to hide sre_xxx submodules by adding an underscore to their name. 
Moreover, the "sre_" prefix is now redundant. I suggest renaming:

* sre_constants => re._constants
* sre_compile => re._compile
* sre_parse => re._parse

--
nosy: +vstinner

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-04-01 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +30299
pull_request: https://github.com/python/cpython/pull/32224

___
Python tracker 

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



[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2022-04-01 Thread Vedran Čačić

Vedran Čačić  added the comment:

> First, I hope we all agree:
> 'C:\Windows\..\Program Files' and '/usr/../bin' == relative path

I don't agree. To me, absolute means regardless of a reference point. So, 
absolute path would be a path that refers to the same entity from whichever 
directory you reference it. And that is surely the case for these two.

--

___
Python tracker 

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



  1   2   >