[issue45876] Improve accuracy of stdev functions in statistics

2021-11-25 Thread Mark Dickinson


Mark Dickinson  added the comment:

There's also a potential double-rounding issue with ldexp, when the first 
argument is an int: ldexp(n, e) will first round n to a float, and then (again 
for results in the subnormal range) potentially also need to round the result.

>>> n = 2**53 + 1
>>> e = -1128
>>> math.ldexp(n, e)
0.0
>>> n / (1 << -e)
5e-324

I'm a bit (but only a bit) surprised and disappointed by the Windows issue; 
thanks, Tim. It seems to be okay on Mac (Intel, macOS 11.6.1):

>>> import math
>>> d = math.nextafter(0.0, 1.0)
>>> d
5e-324
>>> d3 = 7 * d
>>> d3
3.5e-323
>>> d3 / 4.0
1e-323
>>> math.ldexp(d3, -2)
1e-323

--

___
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

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset ee1e2c604c8a66a407116d9c3e589ab0b9580c54 by Christian Heimes in 
branch 'main':
bpo-40280: Use Setup.stdlib static for wasm builds (GH-29784)
https://github.com/python/cpython/commit/ee1e2c604c8a66a407116d9c3e589ab0b9580c54


--

___
Python tracker 

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



[issue45653] Freeze the encodings module.

2021-11-25 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303
nosy_count: 3.0 -> 4.0
pull_requests: +28024
pull_request: https://github.com/python/cpython/pull/29788

___
Python tracker 

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



[issue45619] Mentioning structural pattern matching in the list of binding

2021-11-25 Thread Guido van Rossum


Change by Guido van Rossum :


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



[issue45901] store app file type ignores command-line arguments

2021-11-25 Thread Eryk Sun


New submission from Eryk Sun :

The file association for the store app uses '"%1"' for the command-line 
parameters. This ignores the rest of the command-line arguments, i.e. '%*'. In 
PC/layout/support/appxmanifest.py, the add_application() calls that add the 
"Python" and "PythonW" applications should be changed to use the parameters 
string '"%1" %*' in the file types.

--
components: Installation, Windows
messages: 407029
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: store app file type ignores command-line arguments
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



[issue45619] Mentioning structural pattern matching in the list of binding

2021-11-25 Thread miss-islington


miss-islington  added the comment:


New changeset 7842aed7a7938df20b652177458407683e7f1a0b by Miss Islington (bot) 
in branch '3.10':
bpo-45619: documentation of execution model: clarify and update binding summary 
(GH-29232)
https://github.com/python/cpython/commit/7842aed7a7938df20b652177458407683e7f1a0b


--

___
Python tracker 

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



[issue45619] Mentioning structural pattern matching in the list of binding

2021-11-25 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset cd876c84932ecc2f7a6c41f3fc800a34d5b06b95 by Arthur Milchior in 
branch 'main':
bpo-45619: documentation of execution model: clarify and update binding summary 
(#29232)
https://github.com/python/cpython/commit/cd876c84932ecc2f7a6c41f3fc800a34d5b06b95


--

___
Python tracker 

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



[issue45619] Mentioning structural pattern matching in the list of binding

2021-11-25 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-11-25 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 93c65df83cef71a4bc77d71afecdec8744c4f73a by Alex Waygood in 
branch 'main':
bpo-44353: Correct docstring for `NewType` (#29785)
https://github.com/python/cpython/commit/93c65df83cef71a4bc77d71afecdec8744c4f73a


--

___
Python tracker 

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



[issue45876] Improve accuracy of stdev functions in statistics

2021-11-25 Thread Tim Peters


Tim Peters  added the comment:

Note that, on Windows, ldexp() in the presence of denorms can truncate. 
Division rounds, so

assert x / 2**i == ldexp(x, -i)

can fail.

>>> import math
>>> d = math.nextafter(0.0, 1.0)
>>> d
5e-324
>>> d3 = 7 * d # ....0111
>>> d3
3.5e-323
>>> d3 / 4.0   # rounds
1e-323
>>> math.ldexp(d3, -2)  # truncates
5e-324

or, perhaps more dramatically,

>>> d3 / 8.0, math.ldexp(d3, -3)
(5e-324, 0.0)

--

___
Python tracker 

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



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2021-11-25 Thread Inada Naoki


Change by Inada Naoki :


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



[issue44353] PEP 604 NewType

2021-11-25 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood
nosy_count: 12.0 -> 13.0
pull_requests: +28022
pull_request: https://github.com/python/cpython/pull/29785

___
Python tracker 

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



[issue45876] Improve accuracy of stdev functions in statistics

2021-11-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Mark, would it preferable to use ldexp() to build the float?

+   return math.ldexp(isqrt_frac_rto(n << -2 * q, m), q)
-   return isqrt_frac_rto(n << -2 * q, m) / (1 << -q)

--

___
Python tracker 

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



[issue33393] update config.guess and config.sub

2021-11-25 Thread Christian Heimes


Change by Christian Heimes :


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



[issue33393] update config.guess and config.sub

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 3f565f8edf84cfe8fa3e9cbf5da7c5911acaa6f9 by Christian Heimes in 
branch '3.10':
[3.10] bpo-33393: Update config.guess and config.sub (GH-29781) (GH-29782)
https://github.com/python/cpython/commit/3f565f8edf84cfe8fa3e9cbf5da7c5911acaa6f9


--

___
Python tracker 

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



[issue33393] update config.guess and config.sub

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset b5249349845c21a07e13888aa12c5b86c0f06c31 by Christian Heimes in 
branch '3.9':
[3.9] bpo-33393: Update config.guess and config.sub (GH-29781) (GH-29783)
https://github.com/python/cpython/commit/b5249349845c21a07e13888aa12c5b86c0f06c31


--

___
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

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:

https://github.com/emscripten-core/emscripten/issues/13393

--

___
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

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:

I have uploaded my config.site override to 
https://gist.github.com/tiran/5ccffa28723d3e4739db848451bd9efa . It contains 
overrides based on pyodide and overrides for new features.

I'm also getting this error with emscripten 2.0.13. _sys_shutdown is the 
syscall for shutdown(2) used by the socket module.

error: undefined symbol: __sys_shutdown (referenced by top-level compiled C/C++ 
code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on 
undefined symbols
warning: To disable errors for undefined symbols use `-s 
ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: ___sys_shutdown may need to be added to EXPORTED_FUNCTIONS if it 
arrives from a system library
Error: Aborting compilation due to previous errors

--

___
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

2021-11-25 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28021
pull_request: https://github.com/python/cpython/pull/29784

___
Python tracker 

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



[issue43137] webbrowser to support "gio open "

2021-11-25 Thread miss-islington


miss-islington  added the comment:


New changeset 97dcab783279444ff721a301e1faca6f29fdc600 by Simon McVittie in 
branch 'main':
bpo-43137: webbrowser: Replace gvfs-open and gnome-open with "gio open" 
(GH-29154)
https://github.com/python/cpython/commit/97dcab783279444ff721a301e1faca6f29fdc600


--
nosy: +miss-islington

___
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

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 1052a39b7603e4d8401a5987af0c36f4a1d0b1e4 by Christian Heimes in 
branch 'main':
bpo-40280: Add wasm cross build targets (GH-29771)
https://github.com/python/cpython/commit/1052a39b7603e4d8401a5987af0c36f4a1d0b1e4


--

___
Python tracker 

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



[issue33393] update config.guess and config.sub

2021-11-25 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28020
pull_request: https://github.com/python/cpython/pull/29783

___
Python tracker 

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



[issue33393] update config.guess and config.sub

2021-11-25 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28019
pull_request: https://github.com/python/cpython/pull/29782

___
Python tracker 

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



[issue33393] update config.guess and config.sub

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset dfcc6ff36f8bedae420fe228312527ec3937c973 by Christian Heimes in 
branch 'main':
bpo-33393: Update config.guess and config.sub (GH-29781)
https://github.com/python/cpython/commit/dfcc6ff36f8bedae420fe228312527ec3937c973


--

___
Python tracker 

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



[issue45881] Cross compiling on Linux is untested, undocumented, and broken

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset cd6d2577fadc4cc0275017f27f46b0a628216353 by Christian Heimes in 
branch '3.9':
[3.9] bpo-45881: Use CC from env first for cross building (GH-29752) (GH-29754)
https://github.com/python/cpython/commit/cd6d2577fadc4cc0275017f27f46b0a628216353


--

___
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

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:

Our config.sub agrees with LLVM:

$ ./config.sub wasm32-wasi
wasm32-unknown-wasi

The config.sub and config.guess scripts in main are recent enough for wasm. 
Just to be sure I created https://github.com/python/cpython/pull/29781 and plan 
to backport the changeset to 3.10 and 3.9. It's generally safe to update the 
files to latest version.

--

___
Python tracker 

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



[issue33393] update config.guess and config.sub

2021-11-25 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes
nosy_count: 3.0 -> 4.0
pull_requests: +28018
pull_request: https://github.com/python/cpython/pull/29781

___
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

2021-11-25 Thread Brett Cannon


Brett Cannon  added the comment:

To help keep links up-to-date, Pyodide now lives at:

https://github.com/pyodide/pyodide/tree/main/cpython

--

___
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

2021-11-25 Thread Brett Cannon


Brett Cannon  added the comment:

Do we need to care about our `config.guess` being updated as well? This is a 
totally ignorant question based on 
https://github.com/WebAssembly/wasi-sdk#notes-for-autoconf mentioning 
`config.guess`.

--

___
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

2021-11-25 Thread Brett Cannon


Brett Cannon  added the comment:

My last message had a couple of typos; should have been `wasm32-wasi` and 
"Discord", not "Discovery".

--

___
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

2021-11-25 Thread Brett Cannon


Brett Cannon  added the comment:

LLVM considers `was32-wasi` an alias for `wasm32-unknown-wasi`. Verified on the 
WebAssembly Discover server at 
https://discord.com/channels/453584038356058112/596492540388179976/898618010221310062.

--

___
Python tracker 

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



[issue41498] Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set

2021-11-25 Thread Brett Cannon


Change by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue45711] Simplify the interpreter's (type, val, tb) exception representation

2021-11-25 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +28017
pull_request: https://github.com/python/cpython/pull/29780

___
Python tracker 

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



[issue45568] @asynccontextmanager is missing in decorator usage example

2021-11-25 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



[issue45568] @asynccontextmanager is missing in decorator usage example

2021-11-25 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue45568] @asynccontextmanager is missing in decorator usage example

2021-11-25 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 52d10f6485a168141e7a50d68f9a9566fdd8379d by Andrew Svetlov in 
branch '3.10':
[3.10] bpo-45568: Actually use @asynccontextmanager in usage example (GH-29151) 
(GH-29779)
https://github.com/python/cpython/commit/52d10f6485a168141e7a50d68f9a9566fdd8379d


--

___
Python tracker 

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



[issue45900] Type annotations needed for convenience functions in ipaddress module

2021-11-25 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Typing for stdlib is provided by https://github.com/python/typeshed
CPython policy discourages embedded typing declarations.

--
nosy: +asvetlov
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



[issue45299] SMTP.send_message() does from mangling when it should not

2021-11-25 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Grant: sounds good! I can do the initial PR review. Note that the PR will need 
a test and a news entry. See the link below on authoring PRs:

https://devguide.python.org/pullrequest/

--

___
Python tracker 

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



[issue45568] @asynccontextmanager is missing in decorator usage example

2021-11-25 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
nosy: +asvetlov
nosy_count: 3.0 -> 4.0
pull_requests: +28016
pull_request: https://github.com/python/cpython/pull/29779

___
Python tracker 

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



[issue45299] SMTP.send_message() does from mangling when it should not

2021-11-25 Thread Grant Edwards


Grant Edwards  added the comment:

Yes, passing the mangle_from value to BytesGenerator seems like the safest fix. 
It's unfortunate that BytesGenerator defaults to doing "the wrong thing" in the 
absence of a policy argument, but there might be code that depends on it.

I've never done a PR before, but I could work on it next week.

--

___
Python tracker 

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



[issue45900] Type annotations needed for convenience functions in ipaddress module

2021-11-25 Thread William George


Change by William George :


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

___
Python tracker 

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



[issue45886] Fix Program/_freeze_module for cross compiling Python

2021-11-25 Thread Guido van Rossum

Guido van Rossum  added the comment:

Imthink I prefer the ‘make clean’ extension.--
--Guido (mobile)

--

___
Python tracker 

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



[issue45900] Type annotations needed for convenience functions in ipaddress module

2021-11-25 Thread William George


New submission from William George :

The convenience factory functions in the ipaddress module each return one of 
two types (IPv4Network vs IPv6Network, etc).  Modern code wants to be friendly 
to either stack, and these functions are great at enabling that, but current 
implementation blocks type inference for most (all?) IDEs.

Proposal is easy enough, specifying return type of e.g. `Union[IPv4Network, 
IPv6Network]` for these factory functions.  

I believe the rest of the public interface for this module is unambiguous 
enough that annotations aren't needed, but if others see value they could be 
added easily enough.

For some of these there exists a version-independent base class that could be 
referenced instead of a union, but it's not clear to me how well IDEs will 
actually honor such an annotation referencing an internal class 
(single-underscore).  My limited testing of that didn't work well and there's 
no such base class for the Interface classes anyway. 

PR for this incomming.

--
components: Library (Lib)
messages: 407005
nosy: pmoody, wrgeorge1983
priority: normal
severity: normal
status: open
title: Type annotations needed for convenience functions in ipaddress module
type: enhancement
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



[issue45899] NameError on if clause of class-level list comprehension

2021-11-25 Thread Matthew Barnett


Matthew Barnett  added the comment:

It's not just in the 'if' clause:

>>> class Foo:
... a = ['a', 'b']
... b = ['b', 'c']
... c = [b for x in a]
...
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in Foo
  File "", line 4, in 
NameError: name 'b' is not defined

--
nosy: +mrabarnett

___
Python tracker 

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



[issue45899] NameError on if clause of class-level list comprehension

2021-11-25 Thread Mark Dickinson

Mark Dickinson  added the comment:

This is expected behaviour. See the docs here: 
https://docs.python.org/3.9/reference/executionmodel.html#resolution-of-names

> The scope of names defined in a class block is limited to the class block; it 
> does not extend to the code blocks of methods – this includes comprehensions 
> and generator expressions since they are implemented using a function scope.

--
nosy: +mark.dickinson
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



[issue45899] NameError on if clause of class-level list comprehension

2021-11-25 Thread ThiefMaster


Change by ThiefMaster :


--
nosy: +ThiefMaster

___
Python tracker 

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



[issue45899] NameError on if clause of class-level list comprehension

2021-11-25 Thread jhpfjyne


New submission from jhpfjyne :

Accessing an attribute defined at class-level in the if clause of a list 
comprehension at class-level throws a NameError.

>>> class Foo:
... a = ['a', 'b']
... b = ['b', 'c']
... c = [x for x in a if x not in b]
...
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in Foo
  File "", line 4, in 
NameError: name 'b' is not defined

--
components: Interpreter Core
messages: 407002
nosy: jhpfjyne
priority: normal
severity: normal
status: open
title: NameError on if clause of class-level list comprehension
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-11-25 Thread Irit Katriel


Irit Katriel  added the comment:

Try the search function on the tracker (that's what I would need to do to find 
what to link).

--

___
Python tracker 

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



[issue45299] SMTP.send_message() does from mangling when it should not

2021-11-25 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

R. David: `mangle_from_` is the only exception; I agree it seems likely it was 
done this way for backwards compatibility.

Grant: do you agree with the fix to logic? Also do you agree that mangle_from_ 
is the only setting that's not being applied to msg generation from message 
policy? Would you like to work on the PR? If not, I can create the PR.

--

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-11-25 Thread Martin


Martin  added the comment:

Thanks for your definitive answer, this is what I was waiting for.

I understand and I totally agree that subclassing is the way to go to make 
traceback more flexible.

Would you mind linking the other issues concerning the general improvement of 
traceback?

--

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-11-25 Thread Irit Katriel

Irit Katriel  added the comment:

While I do think this module should be more customisable than it is, I think it 
should be done via support for subclassing rather than injecting functions that 
get forwarded on as you do here.

There are other issues on bpo related to customising this module, with more 
convincing use cases than suppressing errors. I think it’s more likely that a 
patch will be accepted which solves the general problem of this module being 
inflexible (while being backwards compatible).

The patch you propose here solves a small part of the problem while making the 
api clunkier and it commits us to supporting this new parameter when we try to 
solve the general problem.

--

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-11-25 Thread Martin


Martin  added the comment:

Irit, would you be able to take a look at the patch?

---

I found another application scenario for the patch: In Numpy and Pandas, the 
assert_* functions in testing have a __tracebackhide__ local that advises 
pytest to hide the frame. With the patch in place, we could at least not 
display any locals if __tracebackhide__ is present.

--

___
Python tracker 

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



[issue45476] [C API] Disallow using PyFloat_AS_DOUBLE() as l-value

2021-11-25 Thread STINNER Victor


STINNER Victor  added the comment:

I decided to exclude macros which can be used as l-value from the PEP 670, 
since the motivation to disallow using them as l-value is different, and I 
prefer to restrict PEP 670 scope.

Disallowing using macros as l-value is more about hide implementation details 
and improving compatibility with Python implementations other than CPython, 
like PyPy or RustPython.

The PEP 670 is restricted to advantages and disavantages of converting macros 
to functions (static inline or regular functions).

--

___
Python tracker 

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



[issue45897] Frozen dataclasses with slots raise TypeError

2021-11-25 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think the error should be AttributeError, which is what you'd get if the 
class weren't frozen.

--

___
Python tracker 

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



[issue45866] Out of tree build of Python 3.11.0a2+ breaks regen-frozen

2021-11-25 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



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

2021-11-25 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28013
pull_request: https://github.com/python/cpython/pull/29776

___
Python tracker 

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



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

2021-11-25 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ce5a6460aebdc51a810d2755782fe8f0d7918ec2 by Victor Stinner in 
branch '3.10':
bpo-39026: Fix Python.h when building with Xcode (GH-29488) (GH-29732)
https://github.com/python/cpython/commit/ce5a6460aebdc51a810d2755782fe8f0d7918ec2


--

___
Python tracker 

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



[issue45568] @asynccontextmanager is missing in decorator usage example

2021-11-25 Thread miss-islington


miss-islington  added the comment:


New changeset 4dd82194f4a0e48a94191655e571b3aad1c4a22a by Zbigniew Siciarz in 
branch 'main':
bpo-45568: Actually use @asynccontextmanager in usage example (GH-29151)
https://github.com/python/cpython/commit/4dd82194f4a0e48a94191655e571b3aad1c4a22a


--
nosy: +miss-islington

___
Python tracker 

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



[issue45759] Improve error messages for non-matching `elif`/`else` statements

2021-11-25 Thread theeshallnotknowethme


Change by theeshallnotknowethme :


--
pull_requests: +28012
pull_request: https://github.com/python/cpython/pull/29775

___
Python tracker 

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



[issue41498] Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set

2021-11-25 Thread Christian Heimes


Change by Christian Heimes :


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



[issue41498] Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 71b414750eee7af98cc3cee3a64c59d48302a17a by Christian Heimes in 
branch '3.9':
[3.9] bpo-41498: Fix build on platforms without sigset_t (GH-29770) (GH-29774)
https://github.com/python/cpython/commit/71b414750eee7af98cc3cee3a64c59d48302a17a


--

___
Python tracker 

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



[issue45898] ctypes cfield.c defines duplicate ffi_type_* symbols

2021-11-25 Thread Christian Heimes


New submission from Christian Heimes :

ctypes's cfield.c redefines a couple of symbols like ffi_type_void and others. 
The symbols are exported by ffi.h and libffi for more than 12 years: 
https://github.com/libffi/libffi/blame/e1539266e6c6dde3c99832323586f33f977d1dc0/include/ffi.h.in#L184

I think we can safely remove the symbols from the file. The idea is inspired by 
pyodide patch 
https://github.com/pyodide/pyodide/blob/main/cpython/patches/remove-duplicate-symbols-from-cfield.c.patch

--
components: ctypes
messages: 406991
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: ctypes cfield.c defines duplicate ffi_type_* symbols
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



[issue41498] Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set

2021-11-25 Thread miss-islington


miss-islington  added the comment:


New changeset 632d589afcaac3b8441c8c042a98e1ae452533e0 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-41498: Fix build on platforms without sigset_t (GH-29770) (GH-29773)
https://github.com/python/cpython/commit/632d589afcaac3b8441c8c042a98e1ae452533e0


--

___
Python tracker 

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



[issue41498] Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set

2021-11-25 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28011
pull_request: https://github.com/python/cpython/pull/29774

___
Python tracker 

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



[issue41498] Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset dc19e8698327cae3d6274b73c135375955f1d0d0 by Christian Heimes in 
branch 'main':
bpo-41498: Fix build on platforms without sigset_t (GH-29770)
https://github.com/python/cpython/commit/dc19e8698327cae3d6274b73c135375955f1d0d0


--

___
Python tracker 

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



[issue41498] Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set

2021-11-25 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45886] Fix Program/_freeze_module for cross compiling Python

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:

The FREEZE_MODULE trick fails with out-of-tree builds when SRCDIR contains the 
frozen_modules header files from a previous build. When doing OOT building, 
make includes the SRCDIR in the search path for dependencies (VPATH). It 
considers $(srcdir)/Python/frozen_modules/importlib._bootstrap_external.h as 
recent enough and therefore does not generate 
$(builddir)/Python/frozen_modules/importlib._bootstrap_external.h. The 
freeze_module program does not know about VPATH and looks up the file in the 
$(builddir) tree:

$ make 
FREEZE_MODULE=/cpython/builddep/ubuntu-impish-x86_64/Programs/_freeze_module
...
python3.9 ../../Tools/scripts/deepfreeze.py 
Python/frozen_modules/importlib._bootstrap_external.h -m 
importlib._bootstrap_external -o 
Python/deepfreeze/importlib._bootstrap_external.c
Traceback (most recent call last):
  File "/cpython/builddep/wasi/../../Tools/scripts/deepfreeze.py", line 463, in 

main()
  File "/cpython/builddep/wasi/../../Tools/scripts/deepfreeze.py", line 451, in 
main
with open(args.file, encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: 
'Python/frozen_modules/importlib._bootstrap_external.h'
make: *** [Makefile:1055: Python/deepfreeze/importlib._bootstrap_external.c] 
Error 1

$ make 
FREEZE_MODULE=/cpython/builddep/ubuntu-impish-x86_64/Programs/_freeze_module 
Python/frozen_modules/importlib._bootstrap_external.h  
make: '../../Python/frozen_modules/importlib._bootstrap_external.h' is up to 
date.


I see two possible solutions for the problem:

* extend ``make clean`` to also remove $(FROZEN_FILES_OUT). The make clean 
command is suppose to remove all files that interferes with OOT builds (see 
check-clean-src in Makefile.pre.in).
* prefix $(FROZEN_FILES_OUT) and their targets with $(abs_builddir) to avoid 
VPATH lookups. abs_builddir is the absolute path to the build directory.

--

___
Python tracker 

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



[issue45019] Freezing modules has manual steps but could be automated.

2021-11-25 Thread Oleg Iarygin


Oleg Iarygin  added the comment:

If a directory is renamed anyway, maybe `deepfrozen_modules` is better? 
`deepfreeze_modules` looks like "modules that are part of deepfreeze tool 
itself". Also it rhymes with `frozen_modules`.

--

___
Python tracker 

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



[issue45019] Freezing modules has manual steps but could be automated.

2021-11-25 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303
nosy_count: 6.0 -> 7.0
pull_requests: +28009
pull_request: https://github.com/python/cpython/pull/29772

___
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

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:

Our config.sub is recent enough and has support for wasm32, wasm64, wasi, and 
emscripten:

$ grep was[mi] config.sub 
| wasm32 | wasm64 \
 | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \

--

___
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

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:

I have added wasm32/wasm64 architectures with emscripten/wasi operating system 
as cross-build targets. The values are based on Rust targets: 

$ rustc --print target-list | grep wasm
wasm32-unknown-emscripten
wasm32-unknown-unknown
wasm32-wasi
wasm64-unknown-unknown

wasm (WebAssembly) is "native instruction set" for the JavaScript VM while wasi 
or emscripten provide operating system facilities like memory management and 
I/O.

--
nosy: +brett.cannon
versions: +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



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

2021-11-25 Thread Christian Heimes


Change by Christian Heimes :


--
keywords: +patch
nosy: +christian.heimes
nosy_count: 7.0 -> 8.0
pull_requests: +28008
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29771

___
Python tracker 

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



[issue45711] Simplify the interpreter's (type, val, tb) exception representation

2021-11-25 Thread Irit Katriel


Irit Katriel  added the comment:

Following the analysis/discussion on 
https://github.com/faster-cpython/ideas/issues/106:

* exc_info is always normalized, so we actually will never need to create a 
tuple of these three values (exc_curinfo, the exception raised but not yet 
caught can be unnormalized, but it is not pushed/popped on the stack). 

* We will reduce the interpreter's exc_info representation to just the 
exception instance.

* There are two APIs that are impacted, both in non-documented edge cases:

1. sys.exc_info()[2] can currently be different from 
sys.exc_info()[1].__traceback__ because changes to the latter (while an except 
clause is executing) don't show up in the former. This is arguably a bug, we 
will change it so that the type and traceback are always consistent with the 
exception.

2. PyErr_SetExcInfo does no arg checking, and will set exc_info to an 
inconsistent triplet if you ask it to. However, the exc_value arg must be an 
exception instance so the only thing you can do is pass in nonsensical args 
where the type/traceback do not match the exception. This function's purpose is 
to save/restore exc_info. We will make it ignore the type and traceback and 
document that change.

--

___
Python tracker 

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



[issue45711] Simplify the interpreter's (type, val, tb) exception representation

2021-11-25 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset c456dfafe9f9f6614fbcf2213a93707f0e101f4e by Irit Katriel in 
branch 'main':
bpo-45711: use exc_value instead of exc_type to determine if exc_info is valid. 
Add more assertions. (GH-29627)
https://github.com/python/cpython/commit/c456dfafe9f9f6614fbcf2213a93707f0e101f4e


--

___
Python tracker 

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



[issue45892] Improve REPL with the underscore separators for int/float

2021-11-25 Thread Alex


Alex  added the comment:

Thanks a lot Eric for your answers, I did not know about sys.displayhook.
Now I know I can easily implement this myself, but the larger question would 
be: "do we want to update the default displayhook for those simple use cases".

--

___
Python tracker 

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



[issue41498] Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set

2021-11-25 Thread Christian Heimes


Change by Christian Heimes :


--
keywords: +patch
nosy: +christian.heimes
nosy_count: 3.0 -> 4.0
pull_requests: +28007
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29770

___
Python tracker 

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



[issue1284670] Allow to restrict ModuleFinder to get "direct" dependencies

2021-11-25 Thread Irit Katriel


Irit Katriel  added the comment:

Mike, from looking at the code the change proposed here is not there, so while 
the patch may not apply cleanly anymore, the commits you mention do not make 
this issue irrelevant.

--
nosy: +iritkatriel

___
Python tracker 

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



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

2021-11-25 Thread Jakub Kulik


Jakub Kulik  added the comment:

On Solaris (and most likely several other platforms), 
`PyThread_get_thread_native_id` is also not available.

--
nosy: +kulikjak

___
Python tracker 

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



[issue45842] AddressSanitizer: bad-free - hello world c extension

2021-11-25 Thread Francesc Elies


Francesc Elies  added the comment:

I tested the same script in ubuntu and got the following.

==1361==ASan runtime does not come first in initial library list; you should 
either link runtime to your application or manually preload it with LD_PRELOAD.

While on windows he does not complain about ASan runtime not bein first in 
initial library list.

Once I use LD_PRELOAD in linux. Lsan detected memory leaks, after suppressing 
them with LSAN_OPTIONS=detect_leaks=0, the script ran fine.

So far I could not find an LD_PRELOAD equivalent in windows.

I am suspecting if one would compile python with asan and run the test on 
windows, I would get similar results as in linux. Sadly at the moment asan 
suppressions doesn't seem to work on windows.

I think this is not a real bug on python but the way we are loading asan-rt in 
windows. Once I am sure I will colse this bug.

--

___
Python tracker 

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



[issue42238] Deprecate suspicious.py?

2021-11-25 Thread Julien Palard


Julien Palard  added the comment:

A new false positive in b48ac6fe38b2fca9963b097c04cdecfc6083104e:

+++ b/Misc/NEWS.d/next/Tests/2021-11-23-12-36-21.bpo-45878.eOs_Mp.rst
@@ -0,0 +1,2 @@
+Test ``Lib/ctypes/test/test_functions.py::test_mro`` now uses
+``self.assertRaises`` instead of ``try/except``.

It's been only one month since the last true positive, so I'll still watching 
this closely...

--

___
Python tracker 

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



[issue45895] _Py_Sigset_Converter used without #ifdef HAVE_SIGSET_T check

2021-11-25 Thread Christian Heimes


Christian Heimes  added the comment:

The problem has been reported before in bpo-41498.

--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not 
set

___
Python tracker 

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