[issue46162] Make `builtins.property` generic

2022-01-11 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Looks like no one showed much interest in it :(
So, yeah, closing it is probably the best idea.

Thanks everyone!

--
resolution:  -> rejected
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



[issue46340] DeprecationWarning emitted when running asyncio tests

2022-01-11 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Providing some more background, based on the changes proposed by Kumar in 
GH-30486:

asyncio.get_event_loop() was marked as deprecated in Python 3.10. Quoting from 
the asyncio documentation , 
https://docs.python.org/3/library/asyncio-eventloop.html (as of 3.10):

Because this function has rather complex behavior (especially when custom
event loop policies are in use), using the get_running_loop() function is
preferred to get_event_loop() in coroutines and callbacks.

[...]

Deprecated since version 3.10: Deprecation warning is emitted if there is
no running event loop. In future Python releases, this function will be an
alias of get_running_loop().


GH-30486 proposes to replace asyncio.get_event_loop() with 
asyncio.new_event_loop().

--
nosy: +erlendaasland

___
Python tracker 

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



[issue46340] DeprecationWarning emitted when running asyncio tests

2022-01-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Kumar, did you consider using get_running_loop() to retrieve the event loop in 
the current thread, instead of creating a new one?

--

___
Python tracker 

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



[issue46340] DeprecationWarning emitted when running asyncio tests

2022-01-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FTR, a rough grep for other users of get_event_loop in Lib/test (some false 
positives):

```
$ grep -rE "\" Lib/test
Lib/test/test_contextlib_async.py:loop = 
asyncio.get_event_loop_policy().get_event_loop()
Lib/test/test_asyncio/test_base_events.py:'loop = 
asyncio.get_event_loop()',
Lib/test/test_asyncio/test_windows_events.py:loop = 
asyncio.get_event_loop()
Lib/test/test_asyncio/test_runners.py:def get_event_loop(self):
Lib/test/test_asyncio/test_runners.py:loop = 
asyncio.get_event_loop()
Lib/test/test_asyncio/test_unix_events.py:
self.assertIsInstance(policy.get_event_loop(),
Lib/test/test_asyncio/test_unix_events.py:
policy.get_event_loop().close()
Lib/test/test_asyncio/test_unix_events.py:loop = policy.get_event_loop()
Lib/test/test_asyncio/test_events.py:
self.assertRaises(NotImplementedError, policy.get_event_loop)
Lib/test/test_asyncio/test_events.py:loop = policy.get_event_loop()
Lib/test/test_asyncio/test_events.py:self.assertIs(loop, 
policy.get_event_loop())
Lib/test/test_asyncio/test_events.py:loop = policy.get_event_loop()
Lib/test/test_asyncio/test_events.py:self.assertRaises(RuntimeError, 
policy.get_event_loop)
Lib/test/test_asyncio/test_events.py:
self.assertRaises(RuntimeError, policy.get_event_loop)
Lib/test/test_asyncio/test_events.py:old_loop = policy.get_event_loop()
Lib/test/test_asyncio/test_events.py:self.assertIs(loop, 
policy.get_event_loop())
Lib/test/test_asyncio/test_events.py:self.assertIsNot(old_loop, 
policy.get_event_loop())
Lib/test/test_asyncio/test_events.py:self.get_event_loop_saved = 
events.get_event_loop
Lib/test/test_asyncio/test_events.py:events.get_event_loop = 
type(self).get_event_loop_impl
Lib/test/test_asyncio/test_events.py:asyncio.get_event_loop = 
type(self).get_event_loop_impl
Lib/test/test_asyncio/test_events.py:events.get_event_loop = 
self.get_event_loop_saved
Lib/test/test_asyncio/test_events.py:asyncio.get_event_loop = 
self.get_event_loop_saved
Lib/test/test_asyncio/test_events.py:def get_event_loop(self):
Lib/test/test_asyncio/test_events.py:
asyncio.get_event_loop()
Lib/test/test_asyncio/test_events.py:
asyncio.get_event_loop()
Lib/test/test_asyncio/test_events.py:
self.assertIs(asyncio.get_event_loop(), loop)
Lib/test/test_asyncio/test_events.py:
asyncio.get_event_loop()
Lib/test/test_asyncio/test_events.py:
asyncio.get_event_loop()
Lib/test/test_asyncio/test_events.py:loop2 = 
asyncio.get_event_loop()
Lib/test/test_asyncio/test_events.py:
asyncio.get_event_loop()
Lib/test/test_asyncio/test_events.py:
self.assertIs(asyncio.get_event_loop(), loop)
Lib/test/test_asyncio/test_events.py:
self.assertIs(asyncio.get_event_loop(), loop)
Lib/test/test_asyncio/test_events.py:
asyncio.get_event_loop()
```

--

___
Python tracker 

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



[issue46326] 'virtualenv --clear' should prompt user before nuking entire directory

2022-01-11 Thread Ali Mohammad Pur


Ali Mohammad Pur  added the comment:

> If similar behavior is also an issue with the Python standard library venv 
> module (which is a derivative of virtualenv), please update this issue 
> accordingly

Yes, my bad, I should have mentioned that this applies to venv, I will update 
the issue title.

Not sure if I can modify my earlier comment however (I don't see any way to).

--

___
Python tracker 

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



[issue46326] 'venv --clear' should prompt user before nuking entire directory

2022-01-11 Thread Ali Mohammad Pur


Change by Ali Mohammad Pur :


--
title: 'virtualenv --clear' should prompt user before nuking entire directory 
-> 'venv --clear' should prompt user before nuking entire directory

___
Python tracker 

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



[issue46244] typing._TypeVarLike missing __slots__

2022-01-11 Thread Alex Waygood


Change by Alex Waygood :


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

___
Python tracker 

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



[issue41987] singledispatchmethod raises an error when relying on a forward declaration

2022-01-11 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood, lukasz.langa

___
Python tracker 

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



[issue46338] libc_ver() runtime error when sys.executable is empty

2022-01-11 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 10.01.2022 23:01, Allie Hammond wrote:
> 
> libc_ver() in platform.py (called from platform()) causes a runtime error if 
> sys.executable returns null. In my case, FreeRADIUS offers a module 
> rlm_python3 which allows you to run python code from the C based FreeRADIUS 
> server - since this module doesn't use a python binary to execute 
> sys.executable returns null trigering this error.

Interesting. I guess rlm_python3 embeds Python. Is sys.executable an
empty string or None ?

--

___
Python tracker 

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



[issue45729] [doc] "history and license" link has wrong target

2022-01-11 Thread Julien Palard


Julien Palard  added the comment:

This should be fixed in python-docs-theme==2022.1.

I'll close the issue when I actually see the fix applied on docs.python.org.

--
nosy: +mdk

___
Python tracker 

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



[issue45729] [doc] "history and license" link has wrong target

2022-01-11 Thread Julien Palard


Change by Julien Palard :


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

___
Python tracker 

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



[issue46335] asyncio.create_subprocess_exec throws RuntimeError yet still executes subprogram

2022-01-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

What do you mean by *process-limited environment*?

It is very unusual configuration IMHO.

--

___
Python tracker 

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



[issue46340] DeprecationWarning emitted when running asyncio tests

2022-01-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

get_event_loop() is deprecated when there is no running event loop.
Otherwise, it is equal to get_running_loop() and IS NOT deprecated.

I think there is no reason to replace all occurrences where get_event_loop() 
works fine.

--

___
Python tracker 

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



[issue46310] Simplify `for` loop in `.close()` method in `asyncio/windows_events`

2022-01-11 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue46310] Simplify `for` loop in `.close()` method in `asyncio/windows_events`

2022-01-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset fc75bfb8be8494e22123f2c14d1ab497c77cc22d by Nikita Sobolev in 
branch 'main':
bpo-46310: simplify `for` loop in `asyncio/windows_events` (GH-30334)
https://github.com/python/cpython/commit/fc75bfb8be8494e22123f2c14d1ab497c77cc22d


--

___
Python tracker 

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ea1a54506b4ac38b712ba63ec884292025f16111 by Victor Stinner in 
branch 'main':
bpo-46303: Move fileutils.h private functions to internal C API (GH-30484)
https://github.com/python/cpython/commit/ea1a54506b4ac38b712ba63ec884292025f16111


--

___
Python tracker 

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



[issue46340] DeprecationWarning emitted when running asyncio tests

2022-01-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> I think there is no reason to replace all occurrences where get_event_loop() 
> works fine.

+1

I provided the grep for information only, hence FTR (for the record).

--

___
Python tracker 

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



[issue46340] DeprecationWarning emitted when running asyncio tests

2022-01-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> get_event_loop() is deprecated when there is no running event loop.

Yes, I see that now. So using asyncio.new_event_loop instead makes sense.

--

___
Python tracker 

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



[issue46339] PEG parser segfault from ast.literal_eval

2022-01-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Seems that the regression is caused by this commit:

6fa8b2ceee38187b0ae96aee12fe4f0a5c8a2ce7 is the first bad commit
commit 6fa8b2ceee38187b0ae96aee12fe4f0a5c8a2ce7
Author: Pablo Galindo Salgado 
Date:   Sat Jan 8 00:23:40 2022 +

bpo-46237: Fix the line number of tokenizer errors inside f-strings 
(GH-30463)

 Lib/test/test_exceptions.py  | 12 
 .../2022-01-07-19-33-05.bpo-46237.9A6Hpq.rst |  2 ++
 Parser/pegen.c   |  8 
 Parser/string_parser.c   |  5 -
 4 files changed, 22 insertions(+), 5 deletions(-)
 create mode 100644 Misc/NEWS.d/next/Core and 
Builtins/2022-01-07-19-33-05.bpo-46237.9A6Hpq.rst

--

___
Python tracker 

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28729
pull_request: https://github.com/python/cpython/pull/30528

___
Python tracker 

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

> While attempting to embed the full cpython source in my application, I found 
> that during compilation on Windows, there was a compilation issue due to 
> struct stat not being defined.

Do you get the error when building Python? Or on #include  when using 
the Python C API?

How do you build Python? What is your C compiler?

Can you test if my proposed PR 30528 fix your issue?

--

___
Python tracker 

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



[issue39298] add BLAKE3 to hashlib

2022-01-11 Thread Christian Heimes


Christian Heimes  added the comment:

You could upload the code to https://test.pypi.org/

--

___
Python tracker 

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



[issue46339] PEG parser segfault from ast.literal_eval

2022-01-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The reason is that the line numbers are now correctly identified, and that 
causes existing code to not work correctly :(

--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2022-01-11 Thread Tommy Vercetti


Tommy Vercetti  added the comment:

Hi everyone,

I'm Tommy from OBS Projects, and I'm currently working on bring OBS Studio to 
Windows ARM64. 

I still prefer the regular executable installer on ARM64, because it's probably 
the least intrusive way of making Python scripting work with OBS Studio. Please 
provide the regular executable installer for ARM64.

I'm also interested in ARM64EC. I haven't tried it yet, but what's your 
confidence that it will compile on ARM64EC toolchain?

--
nosy: +TommyVCT

___
Python tracker 

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



[issue46331] 3.11: tracing revisits class line after class docstring

2022-01-11 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset bd04fac7eb929cd11ab6985deb61d9780447fbff by Mark Shannon in 
branch 'main':
bpo-46331: Do not set line number of instruction storing doc-string. (GH-30518)
https://github.com/python/cpython/commit/bd04fac7eb929cd11ab6985deb61d9780447fbff


--

___
Python tracker 

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



[issue46339] PEG parser segfault from ast.literal_eval

2022-01-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue46331] 3.11: tracing revisits class line after class docstring

2022-01-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

I recon this can be closed now?

--
nosy: +erlendaasland
status: open -> pending

___
Python tracker 

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



[issue46341] duplicate paragraphs - asyncio Coroutines and Tasks file

2022-01-11 Thread David


Change by David :


--
assignee: docs@python
components: Documentation
nosy: davem, docs@python
priority: normal
pull_requests: 28731
severity: normal
status: open
title: duplicate paragraphs - asyncio Coroutines and Tasks file
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



[issue46342] Make @final introspectable at runtime

2022-01-11 Thread Jelle Zijlstra


New submission from Jelle Zijlstra :

Currently, @typing.final is implemented as an identity function, which makes it 
impossible for type checkers that look at runtime objects to support it.

I propose that we implement it as something like:

def final(f):
try:
f.__final__ = True
except AttributeError:
pass  # in case it is used on an object that doesn't support 
setting attributes
return f

I will submit a PR implementing this idea.

--
assignee: Jelle Zijlstra
components: Library (Lib)
messages: 410298
nosy: Jelle Zijlstra, gvanrossum, kj
priority: normal
severity: normal
stage: needs patch
status: open
title: Make @final introspectable at runtime
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



[issue46342] Make @final introspectable at runtime

2022-01-11 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


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

___
Python tracker 

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



[issue46342] Make @final introspectable at runtime

2022-01-11 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

___
Python tracker 

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



[issue46343] Add PyErr_GetActiveException and PyErr_SetActiveException

2022-01-11 Thread Irit Katriel


New submission from Irit Katriel :

Following the removal of exc_type and exc_traceback from the interpreter's 
active exception in issue45711, we can now provide simplified get-set functions 
in the C Api:

PyAPI_FUNC(void) PyErr_GetActiveException(PyObject **);
PyAPI_FUNC(void) PyErr_SetActiveException(PyObject *);

as alternatives to 

PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **);
PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *);

See also issue46328 re the corresponding change in the sys module.

--
assignee: iritkatriel
components: C API, Interpreter Core
messages: 410299
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Add PyErr_GetActiveException and PyErr_SetActiveException
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



[issue46343] Add PyErr_GetActiveException and PyErr_SetActiveException

2022-01-11 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46344] 3.11: except/else/if/raise traced incorrectly

2022-01-11 Thread Ned Batchelder


New submission from Ned Batchelder :

This code shows a raise inside an except/else/if that isn't run, but 
incorrectly appears in the trace output (see the * line):


$ cat arcs_1160.py
def func(x):
try:
b = 6
except ZeroDivisionError:
pass
else:
if x == "raise":
raise ValueError()
finally:
f = 23

func("other")

$ python3.10 -c "import sys; print(sys.version)"
3.10.1 (main, Dec 14 2021, 08:30:13) [Clang 12.0.0 (clang-1200.0.32.29)]

$ python3.10 -m trace --trace arcs_1160.py
 --- modulename: arcs_1160, funcname: 
arcs_1160.py(1): def func(x):
arcs_1160.py(12): func("other")
 --- modulename: arcs_1160, funcname: func
arcs_1160.py(2): try:
arcs_1160.py(3): b = 6
arcs_1160.py(7): if x == "raise":
arcs_1160.py(10): f = 23

$ python3.11 -c "import sys; print(sys.version)"
3.11.0a3+ (heads/main:d24cd49acb, Jan 11 2022, 07:29:41) [Clang 12.0.0 
(clang-1200.0.32.29)]

$ python3.11 -m trace --trace arcs_1160.py
 --- modulename: arcs_1160, funcname: 
arcs_1160.py(1): def func(x):
arcs_1160.py(12): func("other")
 --- modulename: arcs_1160, funcname: func
arcs_1160.py(2): try:
arcs_1160.py(3): b = 6
arcs_1160.py(7): if x == "raise":
arcs_1160.py(8): raise ValueError()  <<**
arcs_1160.py(10): f = 23

--
components: Interpreter Core
keywords: 3.11regression
messages: 410300
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: 3.11: except/else/if/raise traced incorrectly
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



[issue28159] Deprecate isdst argument in email.utils.localtime

2022-01-11 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions: +Python 3.11 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue46331] 3.11: tracing revisits class line after class docstring

2022-01-11 Thread Mark Shannon


Mark Shannon  added the comment:

Ned, does this fix work for you?

--
status: pending -> open

___
Python tracker 

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



[issue46344] 3.11: except/else/if/raise traced incorrectly

2022-01-11 Thread Mark Shannon


Change by Mark Shannon :


--
nosy: +iritkatriel

___
Python tracker 

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



[issue46253] C API documentation of Py_UNICODE_* character properties macros use Py_UNICODE instead of Py_UCS4

2022-01-11 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +28734
pull_request: https://github.com/python/cpython/pull/30533

___
Python tracker 

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



[issue46253] C API documentation of Py_UNICODE_* character properties macros use Py_UNICODE instead of Py_UCS4

2022-01-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 43c5c1369cb21f08a1dc1d63923c3586b883e3e8 by Julian Gilbey in 
branch 'main':
closes bpo-46253: Change Py_UNICODE to Py_UCS4 in the C API docs to match the 
current source code (GH-30387)
https://github.com/python/cpython/commit/43c5c1369cb21f08a1dc1d63923c3586b883e3e8


--
nosy: +benjamin.peterson
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



[issue46253] C API documentation of Py_UNICODE_* character properties macros use Py_UNICODE instead of Py_UCS4

2022-01-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28735
pull_request: https://github.com/python/cpython/pull/30534

___
Python tracker 

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



[issue46253] C API documentation of Py_UNICODE_* character properties macros use Py_UNICODE instead of Py_UCS4

2022-01-11 Thread miss-islington


miss-islington  added the comment:


New changeset 4cfb10979d74b8513ec751b81454709f38e3b51a by Miss Islington (bot) 
in branch '3.10':
closes bpo-46253: Change Py_UNICODE to Py_UCS4 in the C API docs to match the 
current source code (GH-30387)
https://github.com/python/cpython/commit/4cfb10979d74b8513ec751b81454709f38e3b51a


--

___
Python tracker 

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



[issue46253] C API documentation of Py_UNICODE_* character properties macros use Py_UNICODE instead of Py_UCS4

2022-01-11 Thread miss-islington


miss-islington  added the comment:


New changeset 238a36b753affd373a315b81a5024aed7ebf6479 by Miss Islington (bot) 
in branch '3.9':
closes bpo-46253: Change Py_UNICODE to Py_UCS4 in the C API docs to match the 
current source code (GH-30387)
https://github.com/python/cpython/commit/238a36b753affd373a315b81a5024aed7ebf6479


--

___
Python tracker 

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



[issue46249] [sqlite3] move set lastrowid out of the query loop and enable it for executemany()

2022-01-11 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

On 08.01.2022 21:56, Erlend E. Aasland wrote:
>  
> Marc-André: since Python 3.6, the sqlite3.Cursor.lastrowid attribute does no 
> longer comply with the recommendations of PEP 249:
> 
> Previously, lastrowid was set to None for operations other than INSERT or 
> REPLACE. This changed with ab994ed8b97e1b0dac151ec827c857f5e7277565 (in 
> Python 3.6), so that lastrowid is _unchanged_ for operations other than 
> INSERT or REPLACE, and it is set to 0 after the first valid SQL (that is not 
> INSERT/REPLACE) is executed on the cursor.
> 
> Now, PEP 249 only _recommends_ that lastrowid is set to None for operations 
> that do not modify a row, so it's probably not a big deal. No-one has ever 
> mentioned this change in behaviour; there have been no bug reports.
> 
> FTR, here is the relevant quote from PEP 249:
> 
> If the operation does not set a rowid or if the database does not support
> rowids, this attribute should be set to None.
> 
> (I interpret "should" as understood by RFC 2119.)

Well, it may be a little stronger than the SHOULD in the RFC, but then
again the whole DB-API is about conventions and if they don't make sense
for a database backend, it is possible to deviate from the spec, esp. for
optional extensions such as .lastrowid.

> So, my follow-up question becomes:
> I see no point in reverting to pre Python 3.6 behaviour. I would rather 
> change the default value to be 0 (to get rid of the dirty flag in GH-30380), 
> and to make the behaviour more consistent with how the actual SQLite API 
> behaves.
> 
> 
> Do you have an opinion about such a change (in behaviour)?

Is 0 a valid row ID in SQLite ? If not, then I guess this would be
an alternative to None as suggested by the DB-API.

If it is a valid row ID, I'd suggest to go back to resetting to None,
since otherwise code might get confused: if an UPDATE does not get
applied (e.g. a condition is false), code could then still take
.lastrowid as referring to the UPDATE and not a previous
operation, since code will now know whether the condition was met
or not.
 --
Marc-Andre Lemburg
eGenix.com

--
title: [sqlite3] lastrowid improvements -> [sqlite3] move set lastrowid out of 
the query loop and enable it for executemany()

___
Python tracker 

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread Paul Campbell


Paul Campbell  added the comment:

I was trying to build python core (-DMS_WINDOWS -DPy_BUILD_CORE). I was using 
clang, which I think is unsupported looking at Windows doc. After looking at 
the issue though, it seemed that it was just some slight mistake which is why I 
filed the bug.

clang version 13.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix

I can test to see if it fixes the immediate build problem, but I still find 
your fix not quite addressing the issue which I initially tried to create a 
patch for. Someone has already developed a shim here for Windows and it just 
was not used properly. `_Py_stat_struct` is a define which either evaluates to 
`stat` on non-Windows systems or a compatibility structure on Windows. Simply 
replacing the use of `struct stat` with `struct _Py_stat_struct` should solve 
the issue.

--

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-11 Thread Nikita Sobolev


New submission from Nikita Sobolev :

Right now this corner case is not tested:

```python
class Some:
x: int = None

import typing
assert typing.get_type_hints(Some) == {'x': int}
```

Notice that we don't add implicit `Optional` type to `x`. This is different for 
function arguments that will have `Optional` added.

I think it is a good idea to add a test for this. Espeically given that we can 
change function's behavior.

Context:
- https://bugs.python.org/issue46195
- https://github.com/python/cpython/pull/30304

--
components: Library (Lib)
messages: 410307
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Add an explicit test for `get_type_hints` for a class field with `None` 
default
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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-11 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

I will send a PR today :)

--

___
Python tracker 

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-11 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue30677] [doc] mention that os.mkdir() raises FileNotFound if path does not exist

2022-01-11 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
title: Enhance documentation of os.mkdir() -> [doc] mention that os.mkdir() 
raises FileNotFound if path does not exist
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.3, Python 3.4, Python 
3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-11 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 5.0 -> 6.0
pull_requests: +28737
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30536

___
Python tracker 

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



[issue46309] Task created by StreamReaderProtocol gets garbage collected.

2022-01-11 Thread Simon Wrede


Change by Simon Wrede :


--
versions: +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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Python.h indirectly (via fileutils.h) defines _Py_wstat() and _Py_stat() 
functions which use the "struct stat*" type for 12 years:

commit 4e31443c4d2c1fb211a6ea90fc6a8fbd9ff81c97
Author: Victor Stinner 
Date:   Thu Oct 7 21:45:39 2010 +

Create fileutils.c/.h

 * _Py_fopen() and _Py_stat() come from Python/import.c
 * (_Py)_wrealpath() comes from Python/sysmodule.c
 * _Py_char2wchar(), _Py_wchar2char() and _Py_wfopen() come from 
Modules/main.c
 * (_Py)_wstat(), (_Py)_wgetcwd(), _Py_wreadlink() come from 
Modules/getpath.c

--

___
Python tracker 

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



[issue46309] Task created by StreamReaderProtocol gets garbage collected.

2022-01-11 Thread Alex Waygood


Alex Waygood  added the comment:

I'm removing 3.7 and 3.8 from the "versions" field, since those branches are 
old enough that they're now only accepting security-related patches.

--
nosy: +AlexWaygood
versions:  -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



[issue46309] Task created by StreamReaderProtocol gets garbage collected.

2022-01-11 Thread Alex Waygood


Change by Alex Waygood :


--
nosy:  -AlexWaygood

___
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-01-11 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28738
pull_request: https://github.com/python/cpython/pull/30538

___
Python tracker 

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28739
pull_request: https://github.com/python/cpython/pull/30539

___
Python tracker 

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like _Py_stat() and _Py_wstat() are only needed on non-Windows 
platforms: only the _get_tcl_lib_path() function of Modules/_tkinter.c uses 
_Py_stat(). I wrote PR 30539 to not define _Py_stat() and _Py_wstat() on 
Windows.

--

___
Python tracker 

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



[issue46343] Add PyErr_GetActiveException and PyErr_SetActiveException

2022-01-11 Thread Eric Snow


Eric Snow  added the comment:

Why not `PyAPI_FUNC(PyObject *) PyErr_GetActiveException(void);`?

--
nosy: +eric.snow

___
Python tracker 

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



[issue46339] PEG parser segfault from ast.literal_eval

2022-01-11 Thread miss-islington


miss-islington  added the comment:


New changeset cedec19be81e6bd153678bfb28c8e217af8bda58 by Pablo Galindo Salgado 
in branch 'main':
bpo-46339: Fix crash in the parser when computing error text for multi-line 
f-strings (GH-30529)
https://github.com/python/cpython/commit/cedec19be81e6bd153678bfb28c8e217af8bda58


--
nosy: +miss-islington

___
Python tracker 

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



[issue46237] Incorrect line reported in syntax error

2022-01-11 Thread miss-islington


miss-islington  added the comment:


New changeset 19a85501cee24a6e426a431243d0adcb5664c6fe by Miss Islington (bot) 
in branch '3.10':
bpo-46237: Fix the line number of tokenizer errors inside f-strings (GH-30463)
https://github.com/python/cpython/commit/19a85501cee24a6e426a431243d0adcb5664c6fe


--

___
Python tracker 

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



[issue46339] PEG parser segfault from ast.literal_eval

2022-01-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28740
pull_request: https://github.com/python/cpython/pull/30542

___
Python tracker 

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



[issue45953] Statically allocate interpreter states as much as possible.

2022-01-11 Thread Eric Snow


Eric Snow  added the comment:


New changeset cf496d657a1a82eaf9ebfb47d721676fef6effa5 by Eric Snow in branch 
'main':
bpo-45953: Statically allocate and initialize global bytes objects. (gh-30096)
https://github.com/python/cpython/commit/cf496d657a1a82eaf9ebfb47d721676fef6effa5


--

___
Python tracker 

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



[issue46237] Incorrect line reported in syntax error

2022-01-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +28741
pull_request: https://github.com/python/cpython/pull/30543

___
Python tracker 

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



[issue46237] Incorrect line reported in syntax error

2022-01-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue33125] Windows 10 ARM64 platform support

2022-01-11 Thread Steve Dower


Steve Dower  added the comment:

Hi Tommy! Glad to have you join the discussion (I'm a huge fan of OBS Studio, 
and if the license wasn't incompatible with my employer, I'd be actively 
contributing :) )

Our challenge with the installer is the portability of Wix Toolset. I'm pretty 
sure our current version doesn't support ARM64, and they haven't released a 
newer version that does yet. It's possible that emulation will handle the main 
part of our installer, but AFAIK nobody has tested it to see whether it 
confuses the underlying installer service. (I can probably do that at some 
point, as I have access to some test machines now.)

At the same time, any reason why OBS doesn't just include a copy of Python with 
it? It should be quite easy to include the embeddable runtime on Windows, which 
would then mean that you're able to ship the exact version necessary and have 
the paths preconfigured. (It *might* complicate installing 3rd party packages a 
bit, but you can always allow search paths to be set/PYTHONPATH to be 
respected, or the executable path overridden.)

Possibly this is something you guys have already looked into, so if you know 
there's an issue I'd love to hear about it. Making it easy/easier to bundle 
Python with apps like OBS is one of my major focuses.

--

___
Python tracker 

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



[issue46344] 3.11: except/else/if/raise traced incorrectly

2022-01-11 Thread Irit Katriel


Irit Katriel  added the comment:

Thanks, I have a fix and will make a PR once I've written the test.

--

___
Python tracker 

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



[issue46343] Add PyErr_GetActiveException and PyErr_SetActiveException

2022-01-11 Thread Irit Katriel

Irit Katriel  added the comment:

Yes, you’re right of course ;)

--

___
Python tracker 

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



[issue46237] Incorrect line reported in syntax error

2022-01-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Backporting this to 3.9 is a bit more challenging and more changes are 
required, so I am not backporting for 3.9 to avoid unintended side effects.

--

___
Python tracker 

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



[issue46344] 3.11: except/else/if/raise traced incorrectly

2022-01-11 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46346] New compilation warnings on Windows

2022-01-11 Thread Guido van Rossum


New submission from Guido van Rossum :

I am getting these warnings:

C:\Users\gvanrossum\cpython\PC\_testconsole.c(70,38): warning C4013: 
'_Py_get_osfhandle' undefined; assuming extern returnin
g int [C:\Users\gvanrossum\cpython\PCbuild\_testconsole.vcxproj]
C:\Users\gvanrossum\cpython\PC\_testconsole.c(70,1): warning C4047: 
'initializing': 'HANDLE' differs in levels of indirectio
n from 'int' [C:\Users\gvanrossum\cpython\PCbuild\_testconsole.vcxproj]
C:\Users\gvanrossum\cpython\Modules\_tkinter.c(144,37): warning C4013: 
'_Py_stat' undefined; assuming extern returning int [
C:\Users\gvanrossum\cpython\PCbuild\_tkinter.vcxproj]

I noticed that GitHub also was flagging these in unrelated PRs.

--
components: Build, Windows
messages: 410320
nosy: gvanrossum, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: New compilation warnings on Windows
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



[issue46339] PEG parser segfault from ast.literal_eval

2022-01-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +28743
pull_request: https://github.com/python/cpython/pull/30545

___
Python tracker 

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



[issue46335] asyncio.create_subprocess_exec throws RuntimeError yet still executes subprogram

2022-01-11 Thread Clint Olsen


Clint Olsen  added the comment:

In a multi-user environment, you should not expect to be able to spawn infinite 
processes. In some cases system administrators have reduced the thresholds to 
values that guarantee a machine is still responsive under heavy load. See 
limits.conf(5) as an example.

I just used ulimit to synthesize this situation.

Does this make sense?

--

___
Python tracker 

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



[issue46307] string.Template should allow inspection of identifiers

2022-01-11 Thread miss-islington


miss-islington  added the comment:


New changeset dce642f24418c58e67fa31a686575c980c31dd37 by Ben Kehoe in branch 
'main':
bpo-46307: Add string.Template.get_identifiers() method (GH-30493)
https://github.com/python/cpython/commit/dce642f24418c58e67fa31a686575c980c31dd37


--
nosy: +miss-islington

___
Python tracker 

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



[issue46249] [sqlite3] move set lastrowid out of the query loop and enable it for executemany()

2022-01-11 Thread Erlend E. Aasland

Erlend E. Aasland  added the comment:

> Is 0 a valid row ID in SQLite ? If not, then I guess this would be
> an alternative to None as suggested by the DB-API.

Yes. Any 64 bit signed integer value is a valid row id in SQLite.

> If it is a valid row ID, I'd suggest to go back to resetting to None,
> since otherwise code might get confused: if an UPDATE does not get
> applied (e.g. a condition is false), code could then still take
> .lastrowid as referring to the UPDATE and not a previous
> operation, since code will now know whether the condition was met
> or not.

True. OTOH, we've had no requests for reverting to pre Python 3.6 behaviour.

If we are to revert to this behaviour, we'll have to start examining the SQL we 
are given (search for INSERT and REPLACE keywords, determine if they are valid 
(i.e. not a comment, not part of a column or table name, etc.), which will lead 
to a noticeable performance hit for every new statement (not for statements 
reused via the LRU cache though). I'm not sure this is a good idea. However I 
will give it a good thought.

My first thought now, is that it would be better for the sqlite3 module to 
align lastrowid with the behaviour of the C API sqlite3_last_insert_rowid() 
(also available as an SQL function: last_insert_rowid). OTOH, the SQLite API is 
tied to the _connection_ object, so it may not make sense to align it with 
lastrowid which is a _cursor_ attribute.

Perhaps the Right Thing To Do™ is to be conservative and just leave it as it 
is. I still want to apply the optimisation, though. It does not alter the 
behaviour in any kind of way, and it speeds up executemany().

--

___
Python tracker 

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



[issue46249] [sqlite3] move set lastrowid out of the query loop and enable it for executemany()

2022-01-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> OTOH, the SQLite API is tied to the _connection_ object, so it may not make 
> sense to align it with lastrowid which is a _cursor_ attribute.

That came out weird; let's try again:

The SQLite API is tied to the _connection_ object, so it may not make sense to 
force that behaviour onto lastrowid which is a _cursor_ attribute.

--

___
Python tracker 

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



[issue46346] New compilation warnings on Windows

2022-01-11 Thread Steve Dower


Steve Dower  added the comment:

Possibly related to Victor's change in issue46303?

--
nosy: +vstinner

___
Python tracker 

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



[issue45729] [doc] "history and license" link has wrong target

2022-01-11 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +28744
pull_request: https://github.com/python/cpython/pull/30540

___
Python tracker 

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



[issue45729] [doc] "history and license" link has wrong target

2022-01-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28745
pull_request: https://github.com/python/cpython/pull/30541

___
Python tracker 

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



[issue46249] [sqlite3] move set lastrowid out of the query loop and enable it for executemany()

2022-01-11 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

On 11.01.2022 20:46, Erlend E. Aasland wrote:
> 
> If we are to revert to this behaviour, we'll have to start examining the SQL 
> we are given (search for INSERT and REPLACE keywords, determine if they are 
> valid (i.e. not a comment, not part of a column or table name, etc.), which 
> will lead to a noticeable performance hit for every new statement (not for 
> statements reused via the LRU cache though). I'm not sure this is a good 
> idea. However I will give it a good thought.
>
> My first thought now, is that it would be better for the sqlite3 module to 
> align lastrowid with the behaviour of the C API sqlite3_last_insert_rowid() 
> (also available as an SQL function: last_insert_rowid). OTOH, the SQLite API 
> is tied to the _connection_ object, so it may not make sense to align it with 
> lastrowid which is a _cursor_ attribute.

I've had a look at the API description and find it less than useful,
to be honest:

https://sqlite.org/c3ref/last_insert_rowid.html

You don't know on which cursor the last row was inserted, it's
possible that this was or is done by a trigger and the last row
is not updated in case the INSERT does not succeed for some reason,
leaving it unchanged - without the user getting a notification of
this failure, since the .execute() call itself will succeed for
e.g. "INSERT INTO table SELECT ...;".

It also seems that the function really only works for INSERTs and
not for UPDATEs.

> Perhaps the Right Thing To Do™ is to be conservative and just leave it as it 
> is. I still want to apply the optimisation, though. It does not alter the 
> behaviour in any kind of way, and it speeds up executemany().

I'd suggest to deprecate the cursor.lastrowid attribute and
instead point people to the much more useful

"INSERT INTO t (name) VALUES ('two'), ('three') RETURNING ROWID;"

https://sqlite.org/lang_insert.html
https://sqlite.org/forum/forumpost/058ac49cc3

(good to know that SQLite has adopted this PostgreSQL variant as
well)

RETURNING is also available for UPDATES:

https://sqlite.org/lang_update.html

If people really want to use the sqlite3_last_insert_rowid()
functionality, they can use the SQL function of the same name:

https://www.sqlite.org/lang_corefunc.html#last_insert_rowid

which then has known semantics and doesn't conflict with the DB-API
specs.

But this is your call :-)

--

___
Python tracker 

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



[issue46249] [sqlite3] move set lastrowid out of the query loop and enable it for executemany()

2022-01-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> You don't know on which cursor the last row was inserted [...]

SQLite has no concept of cursors :)

> It also seems that the function really only works for INSERTs and
> not for UPDATEs.

Yes, hence it's name: sqlite3_last_insert_rowid() !

> I'd suggest to deprecate the cursor.lastrowid attribute and
> instead point people to the much more useful [...]

Yes, I think mentioning the RETURNING ROWID trick in the sqlite3 docs is a very 
nice improvement. Mentioning the last_insert_rowid SQL function is probably 
also worth consideration.

I'm reluctant to deprecate cursor.lastrowid, though. ATM, I'm leaning towards 
just keeping the current behaviour.

> But this is your call :-)

I hear you are saying that, but strictly speaking I'm _not_ the sqlite3 module 
maintainer; I'm just a very eager contributor :)

--

___
Python tracker 

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



[issue46237] Incorrect line reported in syntax error

2022-01-11 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I understand.  I think that for IDLE, I should check that the error .text is in 
the line indicated, and if not, recover somehow rather than blindly marking the 
the indicated column.  For a shell statement entry, try to find the right line. 
 Not sure for an editor syntax error.  This is a rare situation in any case.

--

___
Python tracker 

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



[issue46346] New compilation warnings on Windows

2022-01-11 Thread Christian Heimes


Change by Christian Heimes :


--
dependencies: +_Py_stat and _Py_wstat using incorrect type for status argument
nosy: +christian.heimes, pablogsal
priority: normal -> release blocker
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov


New submission from Yury Selivanov :

I'm investigating a memory leak in 3.10, and while looking at the offending 
commit I stumbled upon this: in ceval.c:PyEval_EvalCodeEx, there's this 
allocation:

PyObject **kwargs = PyMem_Malloc(sizeof(PyObject *)*kwcount);

The problem is that this isn't ever freed. And `kwargs` isn't used anywhere in 
the function body. It seems to me that this is silently leaking memory.

--
messages: 410329
nosy: Elvis.Pranskevichus, Mark.Shannon, pablogsal, vstinner, yselivanov
priority: normal
severity: normal
status: open
title: memory leak in PyEval_EvalCodeEx

___
Python tracker 

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



[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov


Yury Selivanov  added the comment:

(this is the context of our current investigation btw: 
https://github.com/MagicStack/asyncpg/issues/874#issuecomment-1009383262)

--

___
Python tracker 

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



[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov


Yury Selivanov  added the comment:

This is the questionable place in the code: 
https://github.com/python/cpython/blob/dce642f24418c58e67fa31a686575c980c31dd37/Python/ceval.c#L6131-L6166

See that `kwargs` is allocated but never freed or used.

--

___
Python tracker 

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



[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Elvis Pranskevichus


Elvis Pranskevichus  added the comment:

I can confirm that removing the kwargs allocation prevents the leak described 
in the asyncpg issue from happening.

--

___
Python tracker 

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



[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov


Change by Yury Selivanov :


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

___
Python tracker 

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



[issue46348] Morernize `test_typing`

2022-01-11 Thread Nikita Sobolev


New submission from Nikita Sobolev :

There are several very old details in `test_typing`.

Some examples:
1. `@skipUnless(sys.version_info >= (3, 3), 'ChainMap was added in 3.3')` 
https://github.com/python/cpython/blame/dce642f24418c58e67fa31a686575c980c31dd37/Lib/test/test_typing.py#L3583
 Probably we don't care about `3.3` anymore, so this decorator cam be removed
2. Lib/test/mod_generics_cache.py has a specific path for 3.6, which has 
reached its EOL, so it can also be simplified
3. `ASYNCIO_TESTS` can be written as a regular code now (this is the one I am 
not 100% sure about, but let's see what the CI will say)

PR is on its way!

--
components: Library (Lib)
messages: 410333
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Morernize `test_typing`
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



[issue46348] Morernize `test_typing`

2022-01-11 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part

2022-01-11 Thread Daniel Lenski


Change by Daniel Lenski :


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

___
Python tracker 

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



[issue46348] Modernize `test_typing`

2022-01-11 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood, gvanrossum, kj
title: Morernize `test_typing` -> Modernize `test_typing`
type:  -> behavior

___
Python tracker 

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



[issue46348] Modernize `test_typing`

2022-01-11 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Alex, thanks a lot for fixing so many of my titles! Highly appreciated!

--
components: +Tests -Library (Lib)

___
Python tracker 

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



[issue46349] inspect.getdoc() should append parent class method docs when encountering a local one line docstring

2022-01-11 Thread Gregory P. Smith


New submission from Gregory P. Smith :

Today `inspect.getdoc()` is quite simple. If a method has any docstring, it 
returns it.

There is one idiom where this is not very useful to our users.  A """See base 
class.""" docstring on a method.

Rather than having to repeat the canonical base class documentation in all 
methods or argue with tooling about not having a docstring in this common 
scenario, a single line docstring being used as a hint to just bring in the 
parent's docstring would be more helpful to the user.

Today's inspect.getdoc() could would turn from:
https://github.com/python/cpython/blob/main/Lib/inspect.py#L850

into something like:

```
...
if doc is None or (isinstance(doc, str) and '\n' not in doc.strip()):
  try:
  parent_doc = _finddoc(object)
  if doc is None:
  doc = parent_doc
  elif isinstance(parent_doc, str):
  doc = f'{doc}\nParent class MRO doc:\n{parent_doc}'
  except (AttributeError, TypeError):
  return doc
   ...
```

Why not just tell people to omit docstrings when they want parent docs?  
Because not all coding styles and linter tooling allows for this as they aim to 
enforce that documentation _is_ written.  Source analysis tooling and IDEs may 
not have a whole transitive dependency view of where the base classes even come 
from and are thus incapable of reliably analyzing whether a parent MRO method 
even exists or has a docstring.  This allows for trivial one line docstrings in 
that situation while still providing better information to the help() user.

This would add value to when using 
help(typical_subclass_of_abstract_thing.method) in notebooks.

--
components: Library (Lib)
messages: 410335
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: inspect.getdoc() should append parent class method docs when 
encountering a local one line docstring
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



[issue46348] Modernize `test_typing`

2022-01-11 Thread Alex Waygood


Alex Waygood  added the comment:

Heh, no worries!

--

___
Python tracker 

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



[issue46349] inspect.getdoc() should append parent class method docs when encountering a local one line docstring

2022-01-11 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Many docstrings are only 1 line without being "See base class." And many 
docstrings are multiple lines while also referring the reader to see the parent 
class for further details. So this DWIM heuristic to guess whether or not to 
display a parent class docstring will have a lot of both false positives and 
false negatives.

The false negatives just revert to the status quo, but the false positives will 
be annoying.

I am leery of DWIM code. The reader should be capable of recognising that sort 
of message and calling up help for that class, so I think the benefit here is 
minimal and the failures common.

But if we do go ahead with this, I have a style issue.

At the moment, getdoc shadows `object`, for no good purpose. (I'm fine with 
shadowing builtins if there is a good reason.) This is a minor issue that is 
not worth fixing on its own, but if you do end up touching getdoc to implement 
this, could you please remove the unnecessary shadowing? If we can call the 
function "get *doc*" we can call the parameter *obj* :-)

--
nosy: +steven.daprano

___
Python tracker 

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



[issue46350] re.sub, re.Match.expand, etc doesn't allow x, u, U, or N escapes in the template

2022-01-11 Thread Dan Snider

New submission from Dan Snider :

The docs use the phrase "unknown escapes of ASCII letters are reserved for 
future use and treated as errors". That seems ambiguous enough to question why 
"\x", "\u", "\U", and "\N{}" escapes aren't expanded in the template parameter 
like they are in patterns. 

Since I didn't get a response to the security report I submitted a few weeks 
ago about \N{} escapes, I'm cautiously assuming it's safe to bring it up here 
that the "unicode-escape" encoding and re and probably everything else that 
uses it ignores two obvious clues that a name lookup will fail: length and the 
presence of invalid characters. I didn't look very hard for a  definite length 
cap in the spec, but 255 seems more than sufficient, based on longest name at 
present with its 82 characters. Even something as absurd as 65535 would be 
preferable to the current implementations, which will keep going to the end as 
in:

>>> r"\N{%s}" % ("\ufb03"*2**30)

searching or a terminating "}" and still perform a lookup of the 2**30 
character name.

Another tangentially related "bug" (which probably deserves its own issue) is 
the inconsistency between group names and standard Python identifiers. The 
following example shows how the python compiler decomposes a ligature 'ffi' in 
source code to the ASCII string "ffi", while re merely checks if it could be 
converted to an identifier:

>>> ffi = re.search("(?P<ffi>.)", "xxx")
>>> ffi.groupdict()
{'ffi': 'x'}
>>> "\ufb03" in vars(), "\ufb03" in _
(False, True)

--
messages: 410337
nosy: bup
priority: normal
severity: normal
status: open
title: re.sub, re.Match.expand, etc doesn't allow x, u, U, or N escapes in the 
template
type: behavior

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2022-01-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I've been experimenting with a modification of Serhiy's recurrence relation, 
using a different value of j rather than j=k//2.  

The current design splits-off three ways when it recurses, so the number of 
calls grows quickly.  For C(200,100), C(225,112), and C(250,125), the 
underlying 64 bit modular arithmetic routine is called 115 times, 150 times, 
and 193 times respectively.

But with another 2kb of precomputed values, it drops to 3, 16, and 26 calls.

The main idea is to precompute one diagonal of Pascal's triangle, starting 
where the 64-bit mod arithmetic version leaves off and going through a limit as 
high as we want, depending on our tolerance for table size.  A table for C(n, 
20) where 67 < n <= 225 takes 2101 bytes.

The new routine adds one line and modifies one line from the current code:

  def C(n, k):
k = min(k, n - k)
if k == 0: return 1
if k == 1: return n
if k < len(k2n) and n <= k2n[k]: return ModArith64bit(n, k)
if k == FixedJ and n <= Jlim:  return lookup_known(n)  # New line
j = min(k // 2, FixedJ)# Modified
return C(n, j) * C(n-j, k-j) // C(k, j)

The benefit of pinning j to match the precomputed diagonal is that two of the 
three splits-offs are to known values where no further work is necessary.  
Given a table for C(n, 20), we get:

C(200, 100) = C(200, 20) * C(180, 80) // C(100, 20)
  \_known_/   \_recurse_/\_known_/

A proof of concept is attached.  To make it easy to experiment with, the 
precomputed diagonal is stored in a dictionary.  At the bottom, I show an 
equivalent function to be used in a C version.

It looks promising at this point, but I haven't run timings, so I am not sure 
this is a net win.

--
Added file: https://bugs.python.org/file50555/comb_pole.py

___
Python tracker 

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



[issue46350] re.sub, re.Match.expand, etc doesn't allow x, u, U, or N escapes in the template

2022-01-11 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

It is better to raise each issue in its own ticket.

You seem to have three distinct issues here:

- The issue listed in the title, which I don't understand. A demonstration of 
the issue would be helpful.

- The unrelated(?) issue of bad \N{} escapes, which appears to have nothing to 
do with regexes, but maybe I'm wrong? In any case, whether this is regular 
expressions or plain old strings, it seems reasonable to me to limit \N{} to 
ASCII-only (Unicode guarantees that code point names are ASCII) and some 
reasonable length. I can't imagine the Unicode consortium ever deciding on a 
name > 255 characters, it wouldn't be practical.

- The difference in normalisation between group names and identifiers.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +28750
pull_request: https://github.com/python/cpython/pull/30549

___
Python tracker 

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



[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset 607d8a838f29ad3c4c4e85b39f338dade5f9cafe by Yury Selivanov in 
branch 'main':
bpo-46347: Fix memory leak in PyEval_EvalCodeEx. (#30546)
https://github.com/python/cpython/commit/607d8a838f29ad3c4c4e85b39f338dade5f9cafe


--

___
Python tracker 

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



[issue46347] memory leak in PyEval_EvalCodeEx

2022-01-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Turns out this leak affects CYthon quite a lot:

https://github.com/cython/cython/blob/29ad96444b8b1a4f05a6ac2328fde01de4782691/Cython/Utility/ObjectHandling.c#L2139-L2155

This seems to imply that every function call using __Pyx_PyCFunction_FastCall 
is leaking memory in 3.10, which is quite bad. We may need an urgent release 
for this :(

--

___
Python tracker 

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



  1   2   >