[issue46646] `address` arg can be `bytes` for `ip_*` functions in `ipaddress` module

2022-02-04 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46646] `address` arg can be `bytes` for `ip_*` functions in `ipaddress` module

2022-02-04 Thread Nikita Sobolev


New submission from Nikita Sobolev :

Right now the docs say:

> ipaddress.ip_interface(address)
> Return an IPv4Interface or IPv6Interface object depending on the IP address 
> passed as argument. **address is a string or integer** representing the IP 
> address. Either IPv4 or IPv6 addresses may be supplied; integers less than 
> 2**32 will be considered to be IPv4 by default. A ValueError is raised if 
> address does not represent a valid IPv4 or IPv6 address.

Note the `address is a string or integer` part.

But, this is not true. Counter example:

```
>>> import ipaddress
>>> ipaddress.ip_interface(b'')
IPv4Interface('48.48.48.48/32')
>>> ipaddress.ip_interface(b'')
IPv4Interface('49.49.49.49/32')
```

So, packed version that accepts `bytes`, should be also mentioned.

For `ip_address` types are not mentioned:

> ipaddress.ip_address(address)
> Return an IPv4Address or IPv6Address object depending on the IP address 
> passed as argument. Either IPv4 or IPv6 addresses may be supplied; integers 
> less than 2**32 will be considered to be IPv4 by default. A ValueError is 
> raised if address does not represent a valid IPv4 or IPv6 address.

I will send a PR with proposed changes.

--
assignee: docs@python
components: Documentation
messages: 412562
nosy: docs@python, sobolevn
priority: normal
severity: normal
status: open
title: `address` arg can be `bytes` for `ip_*` functions in `ipaddress` module
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-04 Thread Dong-hee Na


Change by Dong-hee Na :


Added file: https://bugs.python.org/file50604/bench_callback.py

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-04 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue45447] IDLE: Support syntax highlighting for .pyi stub files

2022-02-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

For the open dialog, we only need the expanded extension list.  People with 
no-extension python code file must select 'all files'.  Once the file is open, 
we need the issource function to decide whether to turn on the colorizer.  I 
intend to review the patch itself tomorrow.

--

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-02-04 Thread Dong-hee Na


Change by Dong-hee Na :


--
assignee:  -> corona10
nosy: +corona10

___
Python tracker 

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



[issue41259] Find adverbs is not correct on the documentation

2022-02-04 Thread Jacob Walls


Jacob Walls  added the comment:

Fixed in PR 21420, suggest closing as fixed.

--
nosy: +jacobtylerwalls

___
Python tracker 

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



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2022-02-04 Thread Ethan Furman


Ethan Furman  added the comment:

Thanks, everyone!

--
components: +Library (Lib) -Regular Expressions
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.11 -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



[issue31369] re.RegexFlag is not included in __all__, makes type inference less useful

2022-02-04 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset fea7290a0ecee09bbce571d4d10f5881b7ea3485 by andrei kulakov in 
branch 'main':
bpo-31369: include ``RegexFlag`` in ``re.__all__`` (GH-30279)
https://github.com/python/cpython/commit/fea7290a0ecee09bbce571d4d10f5881b7ea3485


--

___
Python tracker 

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



[issue46631] Implement a "strict" mode for getpass.getuser()

2022-02-04 Thread Eryk Sun


Eryk Sun  added the comment:

Here's an example for the suggested changes to _winapi.

Include these headers:

#include  // LsaGetLogonSessionData
#include  // STATUS_SUCCESS

Add these argument-clinic macros to _winapi_functions:

_WINAPI_GETCURRENTPROCESSTOKEN_METHODDEF
_WINAPI_GETTOKENINFORMATION_METHODDEF
_WINAPI_LSAGETLOGONSESSIONDATA_METHODDEF

Add TokenStatistics in winapi_exec():

WINAPI_CONSTANT(F_DWORD, TokenStatistics);

Add minimal implementations that wrap the WinAPI functions:

/*[clinic input]
_winapi.GetCurrentProcessToken -> HANDLE

Return a handle for the access token of the current process.
[clinic start generated code]*/

static HANDLE
_winapi_GetCurrentProcessToken_impl(PyObject *module)
/*[clinic end generated code: output=cf8e8e20dd41dd6e 
input=73a282cf3718af9e]*/

{
return GetCurrentProcessToken();
}


/*[clinic input]
_winapi.GetTokenInformation

handle: HANDLE
information_class: unsigned_long
/

Get information from an access token.
[clinic start generated code]*/

static PyObject *
_winapi_GetTokenInformation_impl(PyObject *module, HANDLE handle,
 unsigned long information_class)
/*[clinic end generated code: output=caecec0a25658348 
input=b277ad2414f1b03e]*/

{
if (information_class != TokenStatistics) {
return PyErr_Format(
PyExc_NotImplementedError,
"Unsupported information class: %d",
information_class);
}

DWORD returned_size;
TOKEN_STATISTICS info;

if (!GetTokenInformation(handle, information_class, &info, sizeof(info),
&returned_size)) {
return PyErr_SetFromWindowsErr(0);
}

PyObject *result = PyDict_New();
if (!result) {
return NULL;
}

PyObject *value = PyLong_FromUnsignedLongLong(
(((uint64_t)info.AuthenticationId.HighPart) << 32) +
info.AuthenticationId.LowPart);
if (!value) {
goto error;
}
if (PyDict_SetItemString(result, "AuthenticationId", value) < 0) {
Py_DECREF(value);
goto error;
}
Py_DECREF(value);

return result;

error:
Py_CLEAR(result);
return NULL;
}


/*[clinic input]
_winapi.LsaGetLogonSessionData

logon_id: unsigned_long_long
/
Get data for the logon session identified by logon_id.
[clinic start generated code]*/

static PyObject *
_winapi_LsaGetLogonSessionData_impl(PyObject *module,
unsigned long long logon_id)
/*[clinic end generated code: output=680ac7725ef34527 
input=01ff4216b89d01ef]*/

{
SECURITY_LOGON_SESSION_DATA *pdata;
LUID logon_luid;
logon_luid.HighPart = logon_id >> 32;
logon_luid.LowPart = logon_id & 0x;

NTSTATUS status = LsaGetLogonSessionData(&logon_luid, &pdata);
if (status != STATUS_SUCCESS) {
return PyErr_SetFromWindowsErr(LsaNtStatusToWinError(status));
}

PyObject *result = PyDict_New();
if (!result) {
goto error;
}

PyObject *value = PyUnicode_FromWideChar(pdata->UserName.Buffer,
pdata->UserName.Length / sizeof(WCHAR));
if (!value) {
goto error;
}
if (PyDict_SetItemString(result, "UserName", value) < 0) {
Py_DECREF(value);
goto error;
}
Py_DECREF(value);

LsaFreeReturnBuffer(pdata);
return result;

error:
LsaFreeReturnBuffer(pdata);
Py_CLEAR(result);
return NULL;
}

--

___
Python tracker 

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



[issue46645] Portable python3 shebang for Windows, macOS, and Linux

2022-02-04 Thread Josh Triplett


Josh Triplett  added the comment:

Correction to the above evaluation of `#!/usr/bin/env python3`, based on some 
retesting on Windows systems:

The failure case we encounter reasonably often involves the official Python 
installer for Windows, but applies specifically in the case of third-party 
shells such as MSYS2, which fail with that shebang. `#!/usr/bin/env python3` 
does work with the official Python installer when running from cmd or 
PowerShell, it just doesn't work from third-party shells.

We have enough users that cases like this come up reasonably often, and it'd be 
nice to Just Work in those cases too.

Thank you.

--

___
Python tracker 

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



[issue42353] Proposal: re.prefixmatch method (alias for re.match)

2022-02-04 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

What do other APIs in widely used languages do with regex terminology?  We 
appear to be the only popular language who anchors to the start of a string 
with an API named "match".

libpcre C: uses "match" to mean what we call "search" - 
https://www.pcre.org/current/doc/html/pcre2_match.html

Go: Uses "Match" to mean what we call "search" - https://pkg.go.dev/regexp#Match

JavaScript: Uses "match" to mean what we call "search" - 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match

Java: Uses "matches" (I think meaning what we call fullmatch?) - 
https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

C++ RE2: explicit "FullMatch" and "PartialMatch" APIs - 
https://github.com/google/re2 

Jave re2j: uses "matches" like Java regex.Pattern - 
https://github.com/google/re2j 

Ruby: Uses "match" as we do "search" - 
https://ruby-doc.org/core-2.4.0/Regexp.html

Rust: Uses match as we do "search" - https://docs.rs/regex/latest/regex/

--

___
Python tracker 

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



[issue42353] Proposal: re.prefixmatch method (alias for re.match)

2022-02-04 Thread Gregory P. Smith


Change by Gregory P. Smith :


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

___
Python tracker 

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



[issue46645] Portable python3 shebang for Windows, macOS, and Linux

2022-02-04 Thread Josh Triplett


New submission from Josh Triplett :

I'm writing this issue on behalf of the Rust project.

The build system for the Rust compiler is a Python 3 script `x.py`, which 
orchestrates the build process for a user even if they don't already have Rust 
installed. (For instance, `x.py build`, `x.py test`, and various command-line 
arguments for more complex cases.)

We currently run into various issues making this script easy for people to use 
on all common platforms people build Rust on: Windows, macOS, and Linux.

If we use a shebang of `#!/usr/bin/env python3`, then x.py works for macOS and 
Linux users, and also works on Windows systems that install Python via the 
Windows store, but fails to run on Windows systems that install via the 
official Python installer, requiring users to explicitly invoke Python 3 on the 
script, and adding friction, support issues, and complexity to our 
documentation to help users debug that situation.

If we use a shebang of `#!/usr/bin/env python`, then x.py works for Windows 
users, fails on some modern macOS systems, works on other modern macOS systems 
(depending on installation method I think, e.g. homebrew vs Apple), fails on 
some modern Linux systems, and on macOS and Linux systems where it *does* work, 
it might be python2 or python3. So in practice, people often have to explicitly 
run `python3 x.py`, which again results in friction, support issues, and 
complexity in our documentation.

We've even considered things like `#!/bin/sh` and then writing a shell script 
hidden inside a Python triple-quoted string, but that doesn't work well on 
Windows where we can't count on the presence of a shell.

We'd love to write a single shebang that works for all of Windows, macOS, and 
Linux systems, and doesn't resort in recurring friction or support issues for 
us across the wide range of systems that our users use.

As far as we can tell, `#!/usr/bin/env python3` would work on all platforms, if 
the Python installer for Windows shipped a `python3.exe` and handled that 
shebang by using `python3.exe` as the interpreter.

Is that something that the official Python installer could consider adding, to 
make it easy for us to supply cross-platform Python 3 scripts that work out of 
the box for all our users?

Thank you,
Josh Triplett, on behalf of many Rust team members

--
messages: 412553
nosy: joshtriplett
priority: normal
severity: normal
status: open
title: Portable python3 shebang for Windows, macOS, and Linux
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 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



[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-04 Thread Alex Waygood


Alex Waygood  added the comment:

The ~ always only uses the final part of the name for the display text, e.g.  
`~collections.abc.Iterator` would have "Iterator" as the visible text on the 
website.

--

___
Python tracker 

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



[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-04 Thread Alex Waygood


Alex Waygood  added the comment:

:func:`~enum.property` means that the visible text on the webpage will be 
"property", but the link will be to enum.property rather than builtins.property.

--

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-04 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

In addition to the 10 tests failed in test_typing.py, one additional test fails 
in test_types.py with this change: 
https://github.com/python/cpython/blob/bf95ff91f2c1fc5a57190491f9ccdc63458b089e/Lib/test/test_types.py#L834-L838
 and those are all the tests in cpython changed.

This falls in category (1), checking that an int literal is not a type, but 
with the apparent intent to prevent index subscripting.

--

___
Python tracker 

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



[issue42353] Proposal: re.prefixmatch method (alias for re.match)

2022-02-04 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
versions: +Python 3.11 -Python 3.10

___
Python tracker 

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



[issue46643] typing.Annotated cannot wrap typing.ParamSpec args/kwargs

2022-02-04 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

We can also fix this with my proposal in bpo-46644. I'm okay with either fix 
(that or implementing __call__), or both.

--

___
Python tracker 

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-04 Thread Gregory Beauregard


New submission from Gregory Beauregard :

I propose removing the callable() check[1] from typing._type_check. This 
restriction is usually met in typeform instances by implementing a __call__ 
method that raises at runtime[2]. _type_check is called at runtime in a few 
disparate locations, such as in an argument to typing.Annotated or for certain 
stringified annotations in typing.get_type_hints.

Because the requirement to be callable is unexpected and shows up in situations 
not easily discoverable during development or common typing usage, it is the 
cause of several existing cpython bugs and will likely continue to be the cause 
of bugs in typeforms outside of cpython. Known cpython bugs caused by the 
callable() check are bpo-46643, bpo-44799, a substantial contributing factor to 
bpo-46642, and partly bpo-46511. I discovered bpo-46643 with only a cursory 
check of typing.py while writing this proposal. Moreover, it doesn't make any 
particular technical sense to me why it should be required to add an awkward 
__call__ method.

Removing the callable() check fails 10 tests:
7 tests: checking that an int literal is not a type
2 tests: testing that list literals are not valid types (e.g. [3] raises a 
TypeError because the literal [('name', str), ('id', int)] doesn't pass 
callable())
1 test: bpo-46642

The responsibility of determining these invalid typeforms (e.g. int literals) 
would need to be passed to a static type checker. If it's desired to do this at 
runtime it's my opinion that a different check would be more appropriate.

Have I missed any reasons for the callable() check? Can I remove the check and 
adjust or remove the tests?

[1] 
https://github.com/python/cpython/blob/bf95ff91f2c1fc5a57190491f9ccdc63458b089e/Lib/typing.py#L183-L184
[2] 
https://github.com/python/cpython/blob/bf95ff91f2c1fc5a57190491f9ccdc63458b089e/Lib/typing.py#L392-L393
[3] 
https://github.com/python/cpython/blob/bf95ff91f2c1fc5a57190491f9ccdc63458b089e/Lib/test/test_typing.py#L4262-L4263

--
components: Library (Lib)
messages: 412548
nosy: AlexWaygood, GBeauregard, Jelle Zijlstra, gvanrossum, kj, levkivskyi, 
sobolevn
priority: normal
severity: normal
status: open
title: typing: remove callable() check from typing._type_check
type: enhancement

___
Python tracker 

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



[issue46166] Get "self" args or non-null co_varnames from frame object with C-API

2022-02-04 Thread STINNER Victor


STINNER Victor  added the comment:

> PyObject_GetAttrString(frame, "f_locals") doesn't work for PyFrameObject*

Oh, would you mind to elaborate?

Example in Python:

$ ./python
Python 3.11.0a5+ 
>>> import sys
>>> f=sys._getframe()
>>> f.f_locals
{'__name__': '__main__', '__doc__': None, ...}

--

___
Python tracker 

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



[issue46643] typing.Annotated cannot wrap typing.ParamSpec args/kwargs

2022-02-04 Thread Gregory Beauregard


Change by Gregory Beauregard :


--
nosy: +sobolevn

___
Python tracker 

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



[issue46643] typing.Annotated cannot wrap typing.ParamSpec args/kwargs

2022-02-04 Thread Gregory Beauregard


New submission from Gregory Beauregard :

Consider the following.
```
import logging
from typing import Annotated, Callable, ParamSpec, TypeVar

T = TypeVar("T")
P = ParamSpec("P")

def add_logging(f: Callable[P, T]) -> Callable[P, T]:
"""A type-safe decorator to add logging to a function."""
def inner(*args: Annotated[P.args, "meta"], **kwargs: P.kwargs) -> T:
logging.info(f"{f.__name__} was called")
return f(*args, **kwargs)
return inner

@add_logging
def add_two(x: float, y: float) -> float:
"""Add two numbers together."""
return x + y
```
This raises an error at runtime because P.args/P.kwargs cannot pass the 
typing._type_check called by Annotated because they are not callable(). This 
prevents being able to use Annotated on these type annotations.

This can be fixed by adding __call__ methods that raise to typing.ParamSpecArgs 
and typing.ParamSpecKwargs to match other typeforms.

I can write this patch given agreement

--
components: Library (Lib)
messages: 412546
nosy: AlexWaygood, GBeauregard, Jelle Zijlstra, gvanrossum, kj
priority: normal
severity: normal
status: open
title: typing.Annotated cannot wrap typing.ParamSpec args/kwargs
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-04 Thread Ethan Furman


Ethan Furman  added the comment:

What does the tilde (~) do?

--

___
Python tracker 

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



[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-04 Thread Gregory Beauregard


New submission from Gregory Beauregard :

https://github.com/python/cpython/blob/bf95ff91f2c1fc5a57190491f9ccdc63458b089e/Lib/test/test_typing.py#L227-L230

typing's testcases contain the following test to ensure instances of TypeVar 
cannot be subclassed:

def test_cannot_subclass_vars(self):
with self.assertRaises(TypeError):
class V(TypeVar('T')):
pass

The reason this raises a TypeError is incidental and subject to behavior 
change, not because doing so is prohibited per se; what's happening is the 
class creation does the equivalent of type(TypeVar('T')(name, bases, 
namespace), but this calls TypeVar's __init__ function with these items as the 
TypeVar constraints. TypeVar runs typing._type_check on the type constraints 
passed to it, and the literals for the namespace/name do not pass the 
callable() check in typing._type_check, causing it to raise a TypeError. I find 
it dubious this is the behavior the testcase is intending to test and the error 
it gives is confusing

I propose we add __mro_entries__ to the TypeVar class that only contains a 
raise of TypeError to properly handle this case

I can write this patch

--
components: Library (Lib)
messages: 412544
nosy: AlexWaygood, GBeauregard, Jelle Zijlstra, gvanrossum, kj, sobolevn
priority: normal
severity: normal
status: open
title: typing: tested TypeVar instance subclass TypeError is incidental
type: enhancement

___
Python tracker 

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



[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-04 Thread Alex Waygood


Alex Waygood  added the comment:

`enum.property` is new in Python 3.11, so this isn't an issue for 3.9 or 3.10.

--
nosy: +AlexWaygood
versions:  -Python 3.10, Python 3.9

___
Python tracker 

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



[issue46640] Python can now use the C99 NAN constant

2022-02-04 Thread STINNER Victor


STINNER Victor  added the comment:

Using clang -E, I see that clang also replaces NAN with: __builtin_nanf ("").

--

___
Python tracker 

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



[issue46639] Ceil division with math.ceildiv

2022-02-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue31978.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue46640] Python can now use the C99 NAN constant

2022-02-04 Thread STINNER Victor


STINNER Victor  added the comment:

> see attached script: test_nan_bits.py

test_nan_bits.py says "True" for Python built with "clang -O3" and with "clang 
-O0".

--

___
Python tracker 

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



[issue46640] Python can now use the C99 NAN constant

2022-02-04 Thread STINNER Victor


STINNER Victor  added the comment:

Python/dtoa.c uses:

/* Standard NaN used by _Py_dg_stdnan. */

#define NAN_WORD0 0x7ff8
#define NAN_WORD1 0

/* Return a 'standard' NaN value.

   There are exactly two quiet NaNs that don't arise by 'quieting' signaling
   NaNs (see IEEE 754-2008, section 6.2.1).  If sign == 0, return the one whose
   sign bit is cleared.  Otherwise, return the one whose sign bit is set.
*/

double
_Py_dg_stdnan(int sign)
{
U rv;
word0(&rv) = NAN_WORD0;
word1(&rv) = NAN_WORD1;
if (sign)
word0(&rv) |= Sign_bit;
return dval(&rv);
}

--

___
Python tracker 

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



[issue46640] Python can now use the C99 NAN constant

2022-02-04 Thread STINNER Victor


STINNER Victor  added the comment:

Manual test to check if m_nan(), _Py_dg_stdnan(0) and Py_NAN are exactly the 
same number (same bits):

$ ./python
>>> import math, struct
>>> m_nan=math.nan; Py_NAN=math.atan2(m_nan, 1.0)
>>> Py_NAN is m_nan
False
>>> struct.pack('d', m_nan) == struct.pack('d', Py_NAN)
True
>>> struct.pack('d', Py_NAN)
b'\x00\x00\x00\x00\x00\x00\xf8\x7f'

=> see attached script: test_nan_bits.py

"struct.pack('d', m_nan) == struct.pack('d', Py_NAN)" is true with GH-31134 on 
Fedora 35 with gcc-11.2.1-7.fc35.x86_64. I tested with "gcc -O0" and "gcc -O3".

GCC float.h defines NAN with:

#define NAN (__builtin_nanf (""))

GCC: "Built-in Function: double __builtin_nan (const char *str): This is an 
implementation of the ISO C99 function nan."

--
Added file: https://bugs.python.org/file50603/test_nan_bits.py

___
Python tracker 

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



[issue21762] update the import machinery to only use __spec__

2022-02-04 Thread Brett Cannon


Brett Cannon  added the comment:

Dumping my personal notes here as backup and in case anyone else wants to know 
how this is going.


1. `__package__`
- [x]  Make sure all uses of the attribute fall back on `__spec__` (done 
way back when)
- [x]  Add an `ImportWarning` when the attribute is used but it differs 
from `__spec__`  (3.6)
- [x]  Update code to prefer the spec over the attribute, raising 
`ImportWarning` when having to fall back to the attribute (3.10)
- [ ]  Change `ImportWarning` to `DeprecationWarning` when falling back to 
the attribute
- [ ]  Remove code in `importlib` that used the old attribute
2. `__loader__`
- [x]  Make sure all Python code uses of the attribute fall back on 
`__spec__` (3.10)
- [ ]  Update C code to fall back to using `__spec__` 
([issue](https://bugs.python.org/issue42132))
- [ ]  Add an `ImportWarning` when the attribute is used but it differs 
from `__spec__`
- [ ]  Update code to prefer the spec over the attribute, raising 
`ImportWarning` when having to fall back to the attribute
- [ ]  Change `ImportWarning` to `DeprecationWarning` when falling back to 
the attribute
- [ ]  Remove code in `importlib` that used the old attribute
3. `__cached__`
- [ ]  Make sure all uses of the attribute fall back on `__spec__`
- [ ]  Add an `ImportWarning` when the attribute is used but it differs 
from `__spec__`
- [ ]  Update code to prefer the spec over the attribute, raising 
`ImportWarning` when having to fall back to the attribute
- [ ]  Change `ImportWarning` to `DeprecationWarning` when falling back to 
the attribute
- [ ]  Remove code in `importlib` that used the old attribute

--

___
Python tracker 

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



[issue46609] Generator-based coroutines in Python 3.10, 3.9 docs

2022-02-04 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy:  -miss-islington
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: Generator-based coroutines in Python 3.10 docs -> Generator-based 
coroutines in Python 3.10, 3.9 docs

___
Python tracker 

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



[issue46640] Python can now use the C99 NAN constant

2022-02-04 Thread STINNER Victor


STINNER Victor  added the comment:

> mathmodule.c and cmathmodule.c m_nan() still use _Py_dg_stdnan() by default 
> (if PY_NO_SHORT_FLOAT_REPR is not defined).

These functions are only use to create the following constants:

* math.nan
* cmath.nan
* cmath.nanj

--

___
Python tracker 

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



[issue21762] update the import machinery to only use __spec__

2022-02-04 Thread Brett Cannon


Change by Brett Cannon :


--
dependencies: +Use specs instead of just __loader__ in C code

___
Python tracker 

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



[issue46609] Generator-based coroutines in Python 3.10 docs

2022-02-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 459e26f0987a12a19238baba422e13a8f7fcfca3 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-46609: Update asyncio-task coroutine doc (GH-31132) 
https://github.com/python/cpython/commit/459e26f0987a12a19238baba422e13a8f7fcfca3


--

___
Python tracker 

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



[issue46641] multiplication error 2.2 and 2.1

2022-02-04 Thread Zachary Ware


Zachary Ware  added the comment:

See https://docs.python.org/3/tutorial/floatingpoint.html.

Your computer thinks in base 2 rather than base 10, unless you ask it nicely 
(https://docs.python.org/3/library/decimal.html) :)

--
nosy: +zach.ware
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: compile error -> 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



[issue46640] Python can now use the C99 NAN constant

2022-02-04 Thread STINNER Victor


STINNER Victor  added the comment:

The Py_NAN has a special implementation for the ICC compiler, if 
__INTEL_COMPILER and ICC_NAN_STRICT macros are defined, in bpo-21167:
---
commit edbc28ce81f46d042f9d5ddf9c5bc8cecebc715a
Author: R David Murray 
Date:   Thu Aug 13 09:58:07 2015 -0400

#21167: Fix definition of NAN when ICC used without -fp-model strict.

Patch from Chris Hogan of Intel, reviewed by Mark Dickinson.
---

I don't know if it should be kept if Py_NAN is modified to use the NAN 
constant. In case of doubt, I prefer to remove the ICC code since we have no 
ICC buildbot anymore and maybe ICC changed in the meanwhile.

Also, I don't have acess to ICC.

--
nosy: +mark.dickinson, r.david.murray

___
Python tracker 

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



[issue46640] Python can now use the C99 NAN constant

2022-02-04 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue46641] multiplication error 2.2 and 2.1

2022-02-04 Thread Br Km


New submission from Br Km :

Python 3.6.9 (default, Dec  8 2021, 21:08:43) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 2.2 * 2.1
4.621
>>>

--
messages: 412532
nosy: jzradom
priority: normal
severity: normal
status: open
title: multiplication error 2.2 and 2.1
type: compile error
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



[issue46640] Python can now use the C99 NAN constant

2022-02-04 Thread STINNER Victor


New submission from STINNER Victor :

While debugging a GCC regression (*) on "HUGE_VAL * 0" used by Py_NAN macro, I 
noticed that Python can now C99 "NAN" constant.

(*) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104389

In bpo-45440, I already removed legacy code for pre-C99 support and old 
platforms:

"Building Python now requires a C99  header file providing the 
following functions: copysign(), hypot(), isfinite(), isinf(), isnan(), 
round()."

Attached patch modifies Py_NAN to simply reuse NAN.

mathmodule.c and cmathmodule.c m_nan() still use _Py_dg_stdnan() by default (if 
PY_NO_SHORT_FLOAT_REPR is not defined).

--
components: Interpreter Core
messages: 412531
nosy: vstinner
priority: normal
severity: normal
status: open
title: Python can now use the C99 NAN constant
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



[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I think the incorrect qualification should be dropped, if sanely feasible.

More misleading are hidden positional-only args.  Doc:
  min(iterable, *[, key, default])
  min(arg1, arg2, *args[, key])

>>> min(iterator=(1,3))
Traceback (most recent call last):
  File "", line 1, in 
min(iterator=(1,3))
TypeError: min expected at least 1 argument, got 0

1 was passed, but 0 were gotten, as the 1 passed was silently ignored.

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



[issue28686] py.exe ignored PATH when using python3 shebang

2022-02-04 Thread Segev Finer


Change by Segev Finer :


--
nosy: +Segev Finer

___
Python tracker 

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



[issue46609] Generator-based coroutines in Python 3.10 docs

2022-02-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 5603db43ba7ba5568b7516d0e28730a2bc1e1f26 by Terry Jan Reedy in 
branch '3.10':
[3.10] bpo-46609: Update asyncio-task coroutine doc (GH-31132)
https://github.com/python/cpython/commit/5603db43ba7ba5568b7516d0e28730a2bc1e1f26


--

___
Python tracker 

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



[issue46609] Generator-based coroutines in Python 3.10 docs

2022-02-04 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46166] Get "self" args or non-null co_varnames from frame object with C-API

2022-02-04 Thread Aaron Gokaslan


Aaron Gokaslan  added the comment:

I saw the latest Python 3.11 5A release notes on the frame API changes. Do the 
notes mean the only officially supported way of accessing co_varnames is now 
through the Python interface and the inspect module? By using 
PyObject_GetAttrString?

Also, the documentation in the WhatsNew is a bit unclear as 
PyObject_GetAttrString(frame, "f_locals") doesn't work for PyFrameObject*, only 
PyObject* and it doesn't describe how to get the PyObject* version of 
FrameObject. The same problem also happens when trying to access the 
co_varnames field of the PyCodeObject*.

--

___
Python tracker 

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



[issue46639] Ceil division with math.ceildiv

2022-02-04 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue46609] Generator-based coroutines in Python 3.10 docs

2022-02-04 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2022-02-04 Thread Nathaniel Manista


Change by Nathaniel Manista :


--
nosy: +Nathaniel Manista

___
Python tracker 

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



[issue46639] Ceil division with math.ceildiv

2022-02-04 Thread Nathaniel Manista


Change by Nathaniel Manista :


--
nosy: +Nathaniel Manista

___
Python tracker 

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



[issue46639] Ceil division with math.ceildiv

2022-02-04 Thread Vladimir Feinberg


New submission from Vladimir Feinberg :

I have a request related to the rejected proposal 
(https://bugs.python.org/issue43255) to introduce a ceildiv operator.

I frequently find myself wishing for a ceildiv function which computes 
`ceil(x/y)` for integers `x,y`. This comes up all the time when "batching" some 
resource and finding total consumption, be it for memory allocation or GUI 
manipulation or time bucketing or whatnot.

It is easy enough to implement this inline, but `math.ceildiv` would express 
intent clearly.

```
# x, y, out: int

# (A)
import math
out = math.ceil(x / y)  # clear intent but subtly changes type, and also 
incorrect for big ints

# (B)
out = int(math.ceil(x / y))  # wordy, especially if using this multiple times, 
still technically wrong

# (C)
out = (x + y - 1) // y  # too clever if you haven't seen it before, does it 
have desirable semantics for negatives?

# (D)
out = -(-x//y) 

def ceildiv(a: int, b: int) -> int:  # Clearest and correct, but should my 
library code really invent this wheel? 
  """Returns ceil(a/b)."""
  return -(-x//y)

out = ceildiv(x, y)
```

Even though these are all "one-liners", as you can see leaving people to 
complex manually-implemented `ceildiv`s might result in bugs or unclear 
handling of negatives.

--
components: Library (Lib)
messages: 412527
nosy: Vladimir Feinberg
priority: normal
severity: normal
status: open
title: Ceil division with math.ceildiv
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



[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 Thread Andre Roberge


Change by Andre Roberge :


--
nosy: +aroberge

___
Python tracker 

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



[issue41962] Make threading._register_atexit public?

2022-02-04 Thread Ben Darnell


Ben Darnell  added the comment:

> To be clear, by "cancel" you are not talking about Future.cancel().  Rather, 
> your handler causes all running tasks to finish (by sending a special message 
> on the socket corresponding to each running task).  Is that right?

Correct. My tasks here are calls to functions from the `select` module (one 
select call per executor task), and cancelling them means writing a byte to a 
pipe set up for this purpose. 

The select calls could be given a timeout so there is never an infinite task, 
but that's not ideal - a timeout that's too low has a performance cost as calls 
timeout and restart even when the system is "at rest", and a too-long timeout 
is still going to be perceived as a hanging application. 

> * it does not make sure the task associated with the socket finishes (no way 
> of knowing?)
> * so if a task hangs while trying to stop then the running thread in the 
> ThreadPoolExecutor would block shutdown forever
> * similarly, if a task is stuck handling a request then it will never receive 
> the special message on the socket, either blocking the send() in your handler 
> or causing ThreadPoolExecutor shutdown/atexit to wait forever

Correct. If the task were buggy it could still cause a deadlock. In my case the 
task is simple enough (a single selector call) that this is not a risk. 

> * it vaguely implies a 1-to-1 relationship between sockets and *running* tasks
> * likewise that pending (queued) tasks do not have an associated socket 
> (until started)

Each task is associated with a selector object (managing a set of sockets), not 
a single socket. There is only ever one task at a time; a task is enqueued only 
after the previous one finishes. (This thread pool is not used for any other 
purpose)

> * so once your handler finishes, any tasks pending in the ThreadPoolExecutor 
> queue will eventually get started but never get stopped by your handler; thus 
> you're back to the deadlock situation

In my case this one-at-a-time rule means that the queue is always empty. But 
yes, in a more general solution you'd need some sort of interlock between 
cancelling existing tasks and starting new ones. 

> Alternately, perhaps ThreadPoolExecutor isn't the right fit here, as implied 
> by the route you ended up going. 

Yes, this is my conclusion as well. I filed this issue because I was frustrated 
that Python 3.9 broke previously-working code, but I'm willing to chalk this up 
to Hyrum's law and I'm not sure that this is something that ThreadPoolExecutor 
should be modified to support.

--

___
Python tracker 

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



[issue46609] Generator-based coroutines in Python 3.10 docs

2022-02-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Looking at the doc answered the question.  Further down the 3.10 version, 
'3.10' was revised to '3.11', and indeed, the decorator and the entire section 
are gone.  There was no change in 3.9 doc, but should be.  I will submit a PR 
for 3.10 and try to remember to make an additional change in the 3.9 backport.

The doc for iscoroutine and ...function are gone because they have no use in 
new 3.11+ code.  The functions remain though, as they will still work, even 
though redundant.

--
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.9

___
Python tracker 

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



[issue46609] Generator-based coroutines in Python 3.10 docs

2022-02-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Yuri or Andrew: either of you know the fix for "Support for generator-based 
coroutines is deprecated and is scheduled for removal in Python 3.10."?

--
nosy: +asvetlov, terry.reedy, yselivanov

___
Python tracker 

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



[issue46587] datetime and time tests use non-portable "%4Y" format

2022-02-04 Thread Éric Araujo

Change by Éric Araujo :


--
title: datetime and time tests use non-portal "%4Y" format -> datetime and time 
tests use non-portable "%4Y" format

___
Python tracker 

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



[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-04 Thread Éric Araujo

Éric Araujo  added the comment:

Changing the markup to this should fix the link without changing the text:

   :func:`~enum.property`

Would you like to turn this into a pull request?

--
keywords: +easy
nosy: +eric.araujo
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue46635] unittest.defaultTestLoader.discover fails for namespace packages

2022-02-04 Thread Éric Araujo

Change by Éric Araujo :


--
components: +Library (Lib) -Distutils
nosy: +brett.cannon, eric.snow, ezio.melotti, michael.foord, ncoghlan, 
rbcollins -dstufft, eric.araujo
versions:  -Python 3.8

___
Python tracker 

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



[issue46608] Exclude marshalled-frozen data if deep-freezing to save 300 KB space

2022-02-04 Thread Kumar Aditya


Change by Kumar Aditya :


--
pull_requests: +29310
pull_request: https://github.com/python/cpython/pull/31131

___
Python tracker 

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



[issue46638] Inconsistent registry virtualization in Windows Store package

2022-02-04 Thread Steve Dower


Steve Dower  added the comment:

Didn't work on 1809, but it does work on 20H2, which is the earliest update 
that will still be supported when 3.11 ships. I didn't try the ones in between, 
but I think we're okay to ignore them.

Interestingly, double-clicking the MSIX on Windows 11 refuses to install 
because of the unvirtualised resources, but on earlier Windows it's fine. The 
Powershell command (Add-AppxPackage ) does work fine though. I'll see 
if I can find out what happened.

--

___
Python tracker 

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



[issue46638] Inconsistent registry virtualization in Windows Store package

2022-02-04 Thread Steve Dower


Change by Steve Dower :


--
title: Inconsistent registry use in Windows Store package -> Inconsistent 
registry virtualization in Windows Store package

___
Python tracker 

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



[issue46638] Inconsistent registry use in Windows Store package

2022-02-04 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue46608] Exclude marshalled-frozen data if deep-freezing to save 300 KB space

2022-02-04 Thread miss-islington


miss-islington  added the comment:


New changeset bf95ff91f2c1fc5a57190491f9ccdc63458b089e by Kumar Aditya in 
branch 'main':
bpo-46608: exclude marshalled-frozen data if deep-freezing to save 300 KB space 
 (GH-31074)
https://github.com/python/cpython/commit/bf95ff91f2c1fc5a57190491f9ccdc63458b089e


--
nosy: +miss-islington

___
Python tracker 

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



[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 Thread Anders Hovmöller

Anders Hovmöller  added the comment:

For `foo(a, /, b)`, it could be:

"TypeError: foo() missing 1 required argument 'a', and one required positional 
argument 'b'.

If we start on this road there are some more, like for `def foo(a, *, b)` you 
get the error "TypeError: foo() missing 1 required positional argument: 'a'" 
which leaves out that the keyword only argument is also required. 

Another solution would be something like:

TypeError: foo() missing 3 required arguments: 'a' (positional only), 'b', 'c' 
(keyword only)

This solution scales to the worst complex cases, and is a lot clearer imo. 
Could even be further improved with some nicer formatting:

TypeError: foo() missing 3 required arguments: 
'a' (positional only)
'b'
'c' (keyword only)

But that might be a bit overkill :)

--

___
Python tracker 

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



[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

Given this current behavior:

>>> def foo(a, /, b): pass
...
>>> foo()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: foo() missing 2 required positional arguments: 'a' and 'b'

What would you suggest?

I agree the current messages aren't perfect.

--

___
Python tracker 

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



[issue46636] Bugs of 2to3 on built-in function or types(classes)

2022-02-04 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

lib2to3 is going away per https://bugs.python.org/issue40360

but it is behaving as intended above, it does not understand logic.  it was 
only ever intended to maybe work on python 2-only code.  not python 2-and-3 
compatible code.

--
nosy: +gregory.p.smith
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



[issue46638] Inconsistent registry use in Windows Store package

2022-02-04 Thread Steve Dower


Steve Dower  added the comment:

Okay, so it doesn't install at all on 1803. However, that's out of support [1], 
so I guess it doesn't matter.

In theory, 1809 should be the first one that supports it. I'll try that, but I 
think we're okay to leave this turned on for 3.11.

The changes for 3.9-3.10 will be to disable the option unconditionally.

[1]: https://docs.microsoft.com/en-us/lifecycle/products/windows-10-home-and-pro

--

___
Python tracker 

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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-04 Thread miss-islington


miss-islington  added the comment:


New changeset 6da436497a79dea0f3bb756c2d78921b2838e03b by Miss Islington (bot) 
in branch '3.9':
bpo-46629: Update classicAppCompat.sccd for new signing certificate (GH-3)
https://github.com/python/cpython/commit/6da436497a79dea0f3bb756c2d78921b2838e03b


--

___
Python tracker 

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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-04 Thread Steve Dower


Change by Steve Dower :


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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-04 Thread miss-islington


miss-islington  added the comment:


New changeset 7b5b23c31db87cfc5e09ec297147499ba1d47d31 by Miss Islington (bot) 
in branch '3.10':
bpo-46629: Update classicAppCompat.sccd for new signing certificate (GH-3)
https://github.com/python/cpython/commit/7b5b23c31db87cfc5e09ec297147499ba1d47d31


--

___
Python tracker 

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



[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 Thread Anders Hovmöller

Anders Hovmöller  added the comment:

Just dropping the word "positional" is very good. That word is a lie, and just 
removing it makes it true.

--

___
Python tracker 

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



[issue46638] Inconsistent registry use in Windows Store package

2022-02-04 Thread Steve Dower


New submission from Steve Dower :

The build of the Store package detects whether the build PC supports disabling 
registry virtualisation or not when deciding whether to add it to the manifest. 
Because our release builds just moved from the windows-2019 image to the 
windows-2022 image, this setting changed and now builds have virtualisation 
disabled.

While this is probably desirable for some users, having it happen without  
warning is bad.

I'll check whether we can leave it unconditionally enabled for 3.11 and still 
install on older Windows versions. If it won't install, we'll just have to 
leave it disabled.

--
assignee: steve.dower
components: Windows
messages: 412513
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Inconsistent registry use in Windows Store package
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-04 Thread Steve Dower


Steve Dower  added the comment:


New changeset 9b4e3d94a5746af093392ed8e977b26fcc1bfd11 by Steve Dower in branch 
'main':
bpo-46629: Update classicAppCompat.sccd for new signing certificate (GH-3)
https://github.com/python/cpython/commit/9b4e3d94a5746af093392ed8e977b26fcc1bfd11


--

___
Python tracker 

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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29308
pull_request: https://github.com/python/cpython/pull/31129

___
Python tracker 

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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-04 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

I guess the technically correct term is positional-or-keyword, but that seems 
like too much: https://docs.python.org/3/glossary.html

I think dropping "positional" doesn't increase the precision of the error 
message, but I'll admit I can't think of anything better. And lacking something 
better I don't think we should change this.

--
nosy: +eric.smith

___
Python tracker 

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



[issue46637] Incorrect error message: "missing 1 required positional argument"

2022-02-04 Thread Anders Hovmöller

New submission from Anders Hovmöller :

>>> def foo(a):
... pass
... 
>>> foo()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: foo() missing 1 required positional argument: 'a'

This error is incorrect. It says "positional argument", but it's just 
"argument". The proof is that if you call it with

foo(a=3)

it works fine.

--
components: Interpreter Core
messages: 412510
nosy: Anders.Hovmöller
priority: normal
severity: normal
status: open
title: Incorrect error message: "missing 1 required positional argument"
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue46636] Bugs of 2to3 on built-in function or types(classes)

2022-02-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm not sure what you're trying to accomplish here, but long and unichr are not 
available in python 3.

2to3 has been deprecated and is no longer supported.

--
nosy: +eric.smith

___
Python tracker 

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



[issue46636] Bugs of 2to3 on built-in function or types(classes)

2022-02-04 Thread chen-y0y0


Change by chen-y0y0 :


--
title: Bugs of 2to3 -> Bugs of 2to3 on built-in function or types(classes)

___
Python tracker 

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



[issue46636] Bugs of 2to3

2022-02-04 Thread chen-y0y0


New submission from chen-y0y0 :

I have a file named foo.py:
try :
input = raw_input
int = long
chr = unichr
range = xrange
except NameError :
pass

When I process this file to 2to3, it shows:
--- foo.py (original)
+++ foo.py (refactored)
@@ -1,7 +1,7 @@
 try :
 input = raw_input
-int = long
-chr = unichr
+int = int
+chr = chr
 range = xrange
except NameError :
pass
RefactoringTool: Files that need to be modified:
RefactoringTool: foo.py

I don't know why it modifies the Python 2.x and 3.x compatible code.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 412508
nosy: prasechen
priority: normal
severity: normal
status: open
title: Bugs of 2to3
type: behavior
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



[issue46629] Cannot sideload MSIX package on Windows

2022-02-04 Thread Steve Dower


Steve Dower  added the comment:

They got back to me with the files, so I've added them to the PR. I'll run a 
test (signed) build from my branch to validate.

--

___
Python tracker 

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



[issue46633] AddressSanitizer: Skip tests directly in Python, not with external config

2022-02-04 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I have recently added some decorators in test.
support to deactivate tests if running under the sanitizers.

--

___
Python tracker 

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-04 Thread Alex Waygood


Change by Alex Waygood :


--
stage: patch review -> backport needed

___
Python tracker 

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



[issue46066] Remove keyword args syntax for TypedDict definition

2022-02-04 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood, Jelle Zijlstra, sobolevn

___
Python tracker 

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



[issue44791] Substitution of ParamSpec in Concatenate

2022-02-04 Thread Marc Mueller


Change by Marc Mueller :


--
nosy: +cdce8p

___
Python tracker 

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



[issue46635] unittest.defaultTestLoader.discover fails for namespace packages

2022-02-04 Thread Tasos Papastylianou


Change by Tasos Papastylianou :


--
components: +Distutils -Tests
nosy: +dstufft, eric.araujo

___
Python tracker 

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



[issue46635] unittest.defaultTestLoader.discover fails for namespace packages

2022-02-04 Thread Tasos Papastylianou


New submission from Tasos Papastylianou :

Back in python 3.6.9, attempting to import __file__ on a namespace package 
resulted in an attribute error. From at least 3.8 onwards, this behaviour seems 
to have changed, and __file__ simply returns None instead.

This seems to have broken unittest discovery. Looking at the code, it seems 
that discover still seems to rely on a try/except block in order to test for a 
namespace package. Now that the attribute error is no longer present in later 
python versions, discover simply accepts the None value for __file__, and fails 
further down the line when attempting to canonicalise a path containing a None 
value (error effectively expects a string).

On my system with python 3.8, the relevant files/lines are:

- /usr/lib/python3.8/unittest/loader.py()discover()
  The try block starting at line 304 checks for the module's __file__ 
attribute, expecting to redirect to 307 to "look for namespace packages" in 
case of an attribute error. Obviously, now that __file__ returns None instead, 
this logic fails.

- The call to dirname in line 306 therefore proceeds normally, passing a None 
as a file, which then fails with a TypeError: expected str, bytes or 
os.PathLike object, not NoneType
 

See 
https://github.com/tpapastylianou/self-contained-runnable-python-package-template/issues/13#
 for the example in the wild that prompted the discovery of this bug.

--
components: Tests
messages: 412505
nosy: tpapastylianou
priority: normal
severity: normal
status: open
title: unittest.defaultTestLoader.discover fails for namespace packages
type: behavior
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



[issue46200] Discourage logging f-strings due to security considerations

2022-02-04 Thread Tin Tvrtković

Tin Tvrtković  added the comment:

I mean, I agree with your point about being able to accidentally format twice 
when using the standard library logger.

I'm not a core dev but I think getting new APIs in will be challenging. And if 
by some fluke of chance you did get the approval to introduce new logging APIs, 
there are better APIs out there (look at the structlog library). Also the old 
APIs would have to stay for a *long* time since everybody's using them.

Adding clever typing overloads seems actually realistic and useful to me. But 
that depends on the LiteralString PEP being accepted and people actually 
running MyPy. That's probably the best we can do, apart from some documentation.

--

___
Python tracker 

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



[issue46634] [sqlite3] speed up cursor.execute*()

2022-02-04 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue46634] [sqlite3] speed up cursor.execute*()

2022-02-04 Thread Erlend E. Aasland

New submission from Erlend E. Aasland :

`pysqlite_connection_execute_impl()` and friends (executemany, executescript) 
goes all the way through the Call API just to call 
`pysqlite_connection_cursor_impl`. We can same a lot of calls by calling the 
cursor _impl function directly; after all, it does live in the same file scope 
as the callers.

A quick bench (sqlitesynth) shows a small speedup:

Mean +- std dev: [main] 9.55 us +- 0.25 us -> [patched] 9.32 us +- 0.23 us: 
1.02x faster



(Side effect: will get rid of _Py_IDENTIFIER(cursor) in sqlite3)

--
components: Extension Modules
messages: 412503
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: [sqlite3] speed up cursor.execute*()
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



[issue11871] test_default_timeout() of test_threading.BarrierTests failure: BrokenBarrierError

2022-02-04 Thread STINNER Victor


STINNER Victor  added the comment:

The race condition still exists in tests. Recent failure on AMD64 Windows8.1 
Refleaks 3.x:
https://buildbot.python.org/all/#/builders/511/builds/249

0:03:31 load avg: 2.93 [ 42/432/1] test_threading failed (1 error) (1 min 12 
sec) -- running: test_runpy (1 min 8 sec), test_pydoc (55.4 sec), test_io (1 
min 29 sec)
beginning 6 repetitions
123456
...Warning -- Unraisable exceptionWarning -- Unraisable exceptionWarning -- 
Unraisable exception
Exception ignored in thread started by: 
.task at 0x00CA51433CD0>
Exception ignored in thread started by
Exception ignored in thread started by: Traceback (most recent call last):
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 49, in task
.task at 0x00CA51433CD0>: 
.task at 0x00CA51433CD0>
Traceback (most recent call last):
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 49, in task
Traceback (most recent call last):
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 49, in task
f()f()

f()  
   ^  ^

   File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 1021, in f
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 1021, in f
^^^
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 1021, in f
i = barrier.wait()i = barrier.wait()

 i = barrier.wait()  
 ^ ^^^ ^^ ^^^ ^^
^^  File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", 
line 683, in wait

  File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", 
line 683, in wait
^
  File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", 
line 683, in wait
self._wait(timeout)
^self._wait(timeout)^
^self._wait(timeout)
 ^^ ^   ^  ^^ ^
^^  File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", 
line 723, in _wait
^^
  File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", 
line 723, in _wait
^^raise BrokenBarrierError^

 raise BrokenBarrierError  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", line 723, 
in _wait
   ^
^ ^ ^ ^ ^^^^^raise BrokenBarrierError^^
^^ ^^ ^^ ^^ 
^^threading.^^BrokenBarrierError^^: ^^^
^
^threading.BrokenBarrierError^: ^
^^^
threading.BrokenBarrierError: 
Warning -- Unraisable exception
Exception ignored in thread started by: .task 
at 0x00CA51433CD0>
Traceback (most recent call last):
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 49, in task
f()
^^^
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 1021, in f
i = barrier.wait()
^^
  File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", 
line 674, in wait
self._enter() # Block while the barrier drains.
^
  File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", 
line 698, in _enter
raise BrokenBarrierError

threading.BrokenBarrierError: 
test test_threading failed -- Traceback (most recent call last):
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 1026, in test_default_timeout
self.run_threads(f)
^^^
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 855, in run_threads
f()
^^^
  File 
"D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\lock_tests.py", 
line 1021, in f
i = barrier.wait()
^^
  File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", 
line 683, in wait
self._wait(timeout)
^^^
  File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\threading.py", 
line 721, in _wait
raise BrokenBarrierError

threading.BrokenBarrierError

--

___
Python tracker 

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



[issue46633] AddressSanitizer: Skip tests directly in Python, not with external config

2022-02-04 Thread STINNER Victor


STINNER Victor  added the comment:

Notes:

* test.support has check_sanitizer() function. Tests using it:

  * test_crypt
  * test_idle
  * test_tix
  * test_tk
  * test_ttk_guionly


* test_decimal also checks for memory sanitizer and skip some tests if it's 
present:

MEMORY_SANITIZER = (
'-fsanitize=memory' in _cflags or
'--with-memory-sanitizer' in _config_args
)   

* test_faulthandler suppress crash report, similir to 
support.SuppressCrashReport, directly in the C code used by tests: 
faulthandler_suppress_crash_report() function.

* Objects/obmalloc.c checks "#if __has_feature(address_sanitizer)": is ASAN 
enabled?

* GitHub Action config: .github/workflows/build.yml. Skipped tests:

  * test___all__
  * test_concurrent_futures
  * test_multiprocessing_fork
  * test_multiprocessing_forkserver
  * test_multiprocessing_spawn
  * test_peg_generator
  * test_tools

Comment:
---
# Skip test_tools test_peg_generator test_concurrent_futures because
# there are too slow: between 5 and 20 minutes on this CI.
#
# Skip multiprocessing and concurrent.futures tests which are affected by
# bpo-45200 bug: libasan dead lock in pthread_create().
#
# test___all__ is skipped because importing some modules directly can trigger
# known problems with ASAN (like tk or crypt).
---

* Buildbot configuration: UnixAsanBuild class of master/custom/factories.py. 
Options:

  ASAN_OPTIONS='detect_leaks=0:allocator_may_return_null=1:handle_segv=0'

With the comment:
---
# See https://bugs.python.org/issue42985 for more context on why
# SIGSEGV is ignored on purpose.
---

  Skipped tests:
  
  * test_ctypes
  * test_capi
  * test_crypt
  * test_decimal
  * test_faulthandler
  * test_interpreters

With the comment:
---
# These tests are currently raising false positives or are interfering with the 
ASAN mechanism,
# so we need to skip them unfortunately.
---

--

___
Python tracker 

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



[issue46200] Discourage logging f-strings due to security considerations

2022-02-04 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy:  -erlendaasland

___
Python tracker 

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-04 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Right, this of course affects 3.10 and 3.9. Let me know if you want me to do 
the backports :)


(Updating version field for this ticket)

--
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue46633] AddressSanitizer: Skip tests directly in Python, not with external config

2022-02-04 Thread STINNER Victor


New submission from STINNER Victor :

It seems like bpo-45200: "Address Sanitizer: libasan dead lock in 
pthread_create() (test_multiprocessing_fork.test_get() hangs)" is not fixed yet.

In the GitHub Action job, test_multiprocessing_fork is skipped because it's too 
slow, so the job doesn't hang.

Yesterday, I modified the ASAN buildbot to double its timeout from 20 to 40 
minutes:
https://github.com/python/buildmaster-config/commit/5a37411e75c9475d48eabaac18102a3c9fc2d467

But it's useful, when it hangs, it hangs forever. Exmaple on the AMD64 Arch 
Linux Asan Debug 3.9 buildbot (with the new config):

---
(test.test_multiprocessing_fork.WithProcessesTestPicklingConnections) ... ok
Timeout (0:35:00)!
---
https://buildbot.python.org/all/#/builders/588/builds/332

Tests are tuned for ASAN, but the configuration is copied and inconsistent 
between the GitHub Actions job and the buildbot configuration.

I propose to move this configuration directly into Python.

test_decimal.py checks for "-fsanitize=address" in CFLAGS and skip some tests 
if it's present.

--
components: Tests
messages: 412499
nosy: pablogsal, vstinner
priority: normal
severity: normal
status: open
title: AddressSanitizer: Skip tests directly in Python, not with external config
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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-04 Thread Petr Viktorin


Petr Viktorin  added the comment:

Almost. It's a bugfix so it needs backports to 3.10 & 3.9.
Thanks for the reminder!
I should get to them next week.

--
status: pending -> open

___
Python tracker 

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



[issue46632] test_ssl: 2 tests fail on cstratak-CentOS9-fips-x86_64

2022-02-04 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +cstratak

___
Python tracker 

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



[issue46632] test_ssl: 2 tests fail on cstratak-CentOS9-fips-x86_64

2022-02-04 Thread STINNER Victor


New submission from STINNER Victor :

test_load_verify_cadata() and test_connect_cadata() of test_ssl fail on 
cstratak-CentOS9-fips-x86_64 (with OpenSSL FIPS mode enabled):
https://buildbot.python.org/all/#builders/828/builds/63

test.pythoninfo:

fips.linux_crypto_fips_enabled: 1
fips.openssl_fips_mode: 1
ssl.OPENSSL_VERSION: OpenSSL 3.0.1 14 Dec 2021
ssl.OPENSSL_VERSION_INFO: (3, 0, 0, 1, 0)

Logs:

==
ERROR: test_load_verify_cadata (test.test_ssl.ContextTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-CentOS9-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_ssl.py",
 line 1494, in test_load_verify_cadata
ctx.load_verify_locations(cadata=cacert_der)

ssl.SSLError: [EVP] unsupported (_ssl.c:3998)

==
ERROR: test_connect_cadata (test.test_ssl.SimpleBackgroundTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-CentOS9-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_ssl.py",
 line 2138, in test_connect_cadata
ctx.load_verify_locations(cadata=der)
^
ssl.SSLError: [EVP] unsupported (_ssl.c:3998)

Stdout:
 server:  new connection from ('127.0.0.1', 49102)
 server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)

--
assignee: christian.heimes
components: SSL, Tests
messages: 412497
nosy: christian.heimes, vstinner
priority: normal
severity: normal
status: open
title: test_ssl: 2 tests fail on cstratak-CentOS9-fips-x86_64
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



[issue46588] IDLE fix typo in test_calltip.py

2022-02-04 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
assignee:  -> terry.reedy
components: +IDLE
title: fix typo in test_calltip.py -> IDLE fix typo in test_calltip.py
type: enhancement -> behavior
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



  1   2   >