[issue30698] asyncio sslproto do not shutdown ssl layer cleanly

2022-02-27 Thread Kumar Aditya


Kumar Aditya  added the comment:

Since https://bugs.python.org/issue44011 is fixed now, this can be closed.
@asvetlov

--
nosy: +kumaraditya303
versions: +Python 3.11 -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue25743] [doc] Clarify exactly what \w matches in UNICODE mode

2022-02-27 Thread Stanley


Stanley  added the comment:

Would a change like this be accurate?

Matches Unicode word characters; this includes most alphanumeric characters as 
well as the underscore. In Unicode, alphanumeric characters are defined to be 
the general categories L + N (see 
https://unicode.org/reports/tr44/#General_Category_Values). If the 
:const:`ASCII` flag is used, only ``[a-zA-Z0-9_]`` is matched.

--
nosy: +slateny

___
Python tracker 

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



[issue46567] Add Tcl/Tk builds for ARM64

2022-02-27 Thread Niyas Sait


Niyas Sait  added the comment:

Based on my investigation so far, I think Tcl/Tk package generated with VS 2022 
seems to have some issues when used with Tkinter. I could be wrong.

I've created https://github.com/python/cpython/pull/31603 to force the Tcl/Tk 
package build on the fly with VS 2019 and I can see it is passing all tests.

If my analysis is correct, I think it would be better to rebuild Tcl/Tk with VS 
2019 for cpython-bin-deps while we investigate the issue with the compiler.

--

___
Python tracker 

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



[issue46877] unittest.doModuleCleanups() does not exist

2022-02-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-27 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 088dd76dba68c2538776d9920607f81e54544cbd by Dong-hee Na in branch 
'main':
bpo-46541: Remove unnecessary Py_VISIT (GH-31608)
https://github.com/python/cpython/commit/088dd76dba68c2538776d9920607f81e54544cbd


--
nosy: +christian.heimes

___
Python tracker 

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



[issue46877] unittest.doModuleCleanups() does not exist

2022-02-27 Thread Martin Fischer


New submission from Martin Fischer :

The unittest documentation[1] describes unittest.doModuleCleanups().

That function however doesn't exist since it's only in the unittest.case module 
and not re-exported in the unittest module (unlike addModuleCleanup).

So I think either the documentation should be corrected or doModuleCleanups 
should be re-exported in unittest/__init__.py to match the documentation.

[1]: https://docs.python.org/3.8/library/unittest.html

--
assignee: docs@python
components: Documentation
messages: 414177
nosy: docs@python, lisroach, michael.foord, push-f
priority: normal
severity: normal
status: open
title: unittest.doModuleCleanups() does not exist
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

___
Python tracker 

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



[issue46761] functools.update_wrapper breaks the signature of functools.partial objects

2022-02-27 Thread Larry Hastings


Larry Hastings  added the comment:

I emailed the Pydantic and FastAPI guys and didn't hear back.  Given what you 
found on their issue trackers, I think it's unlikely that they care a lot about 
this issue (but were too busy to reply).  It's far more likely that they don't 
care.

Doing a little research (git blame), it looks like the "follow the wrapped 
chain to find the original signature" work was done by Nick Coghlan about nine 
years ago; he touched both functools.update_wrapper and the inspect module.

The only other people to touch the code recently are Yuri and Batuhan.  I've 
nosied Nick and Batuhan (already looped in Yuri), just to ping them and see if 
they have any strong opinions.

If nobody has anything remarkable to say about it, honestly we probably *can* 
just merge your patch, Ofey.  I see your name is now marked with a star; are 
you now authorized to contribute to CPython?

(Note that I only glanced at your patch so far; if we were going to merge this 
bugfix I would of course first do a full review.)

--
nosy: +BTaskaya, ncoghlan

___
Python tracker 

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



[issue46761] functools.update_wrapper breaks the signature of functools.partial objects

2022-02-27 Thread Ofey Chan


Ofey Chan  added the comment:

> Maybe we can loop in someone who works on a popular runtime function 
> introspection library (FastAPI, Pydantic) to see if they have any take on it.

I've checked issues of FastAPI and Pydantic. There is only one issue about 
`update_wrapper()`, and it's about documentation generation:

https://github.com/samuelcolvin/pydantic/issues/1032

Would it be proper to open an issue under FastAPI and Pydantic, to describe the 
situation, and collect their feedbacks?

--

___
Python tracker 

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



[issue46873] inspect.getsource with some lambdas in decorators does not get the full source

2022-02-27 Thread Adam Hopkins


Adam Hopkins  added the comment:

Duplicate of https://bugs.python.org/issue38854

Sorry I didn't come across our before submitting.

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



[issue44807] typing.Protocol silently overrides __init__ method of delivered class

2022-02-27 Thread Adrian Garcia Badaracco


Adrian Garcia Badaracco  added the comment:

Apologies if that was noise, I filed an issue on the MyPy issue tracker: 
https://github.com/python/mypy/issues/12261

--

___
Python tracker 

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



[issue44807] typing.Protocol silently overrides __init__ method of delivered class

2022-02-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

If the problem is in mypy, it should be filed in the mypy tracker, not here.

--

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-27 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +29731
pull_request: https://github.com/python/cpython/pull/31608

___
Python tracker 

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



[issue44807] typing.Protocol silently overrides __init__ method of delivered class

2022-02-27 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46870] Improper Input Validation in urlparse

2022-02-27 Thread Karan


Karan  added the comment:

Here are the results from other languages. Go parses incorrectly at the same 
time rust does it correctly.

Go- https://go.dev/play/p/nNMhyznuGpn
{Scheme:"http", Opaque:"@localhost", User:(*url.Userinfo)(nil), 
Host:"", Path:"", RawPath:"", ForceQuery:false, RawQuery:"", Fragment:"", 
RawFragment:""}


Rust- 
https://play.rust-lang.org/?version=stable=debug=2021=92681b56f7cbd62b7735c962a2f5321e
Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, 
host: Some(Domain("localhost")), port: None, path: "/", query: None, fragment: 
None }

--
nosy: +karanchaudhary

___
Python tracker 

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



[issue45326] Unexpected TypeError with type alias+issubclass+ABC

2022-02-27 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj
type:  -> behavior

___
Python tracker 

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



[issue45326] Unexpected TypeError with type alias+issubclass+ABC

2022-02-27 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This error was added in https://bugs.python.org/issue33018 . See some 
discussion on that issue.

Note that first arg needs to be a type (i.e. instance of `type`) to avoid this 
error:

[ins] In [41]: class C(ABC):0

[ins] In [42]: issubclass(dict, C)
Out[42]: False

[ins] In [43]: issubclass('', C)  # TypeError: issubclass() arg 1 must be a 
class

[ins] In [44]: issubclass(typing.Dict, C)   # same error as above

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44807] typing.Protocol silently overrides __init__ method of delivered class

2022-02-27 Thread Adrian Garcia Badaracco


Adrian Garcia Badaracco  added the comment:

While this is figured out, would it be possible to remove the silent 
overriding? This seems like something type checkers should be doing, not silent 
runtime modification of classes. Pyright already (correctly) checks this, so I 
think it would just need to be added to MyPy.

>>> class C(Protocol):
...   def __init__(self) -> None:
... print('init!')
...
>>> c = C()  # Pyright error, MyPy says it's okay

I came across this while trying to create a class that requires concrete 
subclasses to define a specific field, and it seems like Protocol is the only 
thing that can pull this off because of how type checkers special case it: 
https://gist.github.com/adriangb/6c1a001ee7035bad5bd56df70e0cf5e6

I don't particularly like this use of Protocol, but it works (aside from the 
overriding issue).

I don't know if this usage of implementing `__init__` on a protocol class 
should be valid or not, but I do think it's interesting that `__init__` is 
never called on the protocol class itself, even if the protocol class is the 
one defining it. It is only called on `MyAPIKey`, which is a concrete class 
that happens to inherit the implementation from a protocol class. So maybe that 
should be valid? I'm not sure.

But I do know that making type checkers enforce this instead runtime would 
allow this use case to work while still prohibiting the (in my opinion invalid) 
use case of calling `__init__` on the protocol class itself.

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

___
Python tracker 

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



[issue46876] Walrus operator not in help

2022-02-27 Thread Mohammad Mahdi Zojaji Monfared


New submission from Mohammad Mahdi Zojaji Monfared :

Walrus oprator := not in help("symbols")
and help(":=") does not work.

--
components: Interpreter Core
files: walrus.png
messages: 414168
nosy: mmahdizojajim
priority: normal
severity: normal
status: open
title: Walrus operator not in help
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50651/walrus.png

___
Python tracker 

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



[issue36484] Can't reorder TLS 1.3 ciphersuites

2022-02-27 Thread Sanchayan Ghosh


Sanchayan Ghosh  added the comment:

Here is the PR as well. While I agree that there is no more a reason to reorder 
cipher suites and that we should use our certificates to basically ensure a 
secure connection, the advantage of the OpenSSL API is it provides us the 
function to influence the selection of cipher suites.

So, as a first step, I have added the binding for selecting TLS v1.3 cipher 
suites. And in 2 other pull requests, I will provide the API implementation for 
the other, for users who may just want a way to access OpenSSL through Python.

--
message_count: 4.0 -> 5.0
pull_requests: +29730
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31607

___
Python tracker 

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



[issue36484] Can't reorder TLS 1.3 ciphersuites

2022-02-27 Thread Sanchayan Ghosh


Sanchayan Ghosh  added the comment:

I have written a function that will allow us to reorder TLS v1.3. Since I have 
tried to keep a 1-1 binding, you will have to first remove the cipher suites 
entirely by giving a blank string, and then add TLS v1.2 and v1.3 cipher suites.

--
keywords: +patch
nosy: +sanchayanghosh
Added file: 
https://bugs.python.org/file50650/0001-Add-TLS-v1.3-cipher-suite-set-function.patch

___
Python tracker 

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



[issue46748] Python.h includes stdbool.h

2022-02-27 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Can we close this?

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

___
Python tracker 

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



[issue46868] Improve performance of math.prod with bignums (and functools.reduce?)

2022-02-27 Thread Tim Peters


Tim Peters  added the comment:

Hi. "It's pretty good for a lot of things" is precisely what I'm questioning. 
Name some, and please be specific ;-)

Tree reduction is very popular in the parallel processing world, for obvious 
reasons. But we're talking about a single thread here, and there aren't all 
that many associative binary operators (or, depending on implementation, they 
may need also to be commutative).

I gave floating * as an example: tree reduction buys nothing for accuracy, and 
would be both slower and consume more memory. Other associative operators for 
which all the same are true include bitwise &, bitwise |, bitwise ^, min, and 
max.

Floating + can benefit for accuracy, but we already have math.fsum() for that, 
which delivers the most accurate possible result.

The only unaddressed example we have here so far that could actually benefit is 
bigint *. If that's the real use case, fine, but there are better ways to 
address that case.

I've searched in vain for other languages that try to address this "in 
general", except in the context of parallelization. As Guido will tell you, the 
only original idea in Python is adding an "else" clause to loops ;-)

In any case, I don't believe this belongs hiding in reduce(). As above, it's a 
net loss for most binary operators. Too close to "attractive nuisance" 
territory. Adding a new, e.g., treereduce() would be better - provided that it 
is in fact "pretty good for a lot of things".

--

___
Python tracker 

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



[issue46873] inspect.getsource with some lambdas in decorators does not get the full source

2022-02-27 Thread Adam Hopkins


Change by Adam Hopkins :


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

___
Python tracker 

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



[issue46871] Lambda can't be pickled with "spawn" and only "fork"

2022-02-27 Thread Kyle Smith


Change by Kyle Smith :


--
title: BaseManager.register no longer supports lambda callable 3.8.12+ -> 
Lambda can't be pickled with "spawn" and only "fork"

___
Python tracker 

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



[issue46875] Missing name in TaskGroup.__repr__()

2022-02-27 Thread Joongi Kim


Joongi Kim  added the comment:

Ah, I'm confused with aiotools.TaskGroup (originated from EdgeDB's TaskGroup) 
code while browsing both aiotools and stdlib asyncio.TaskGroup source codes.

The naming facility seems to be intentionally removed when ported to the stdlib.
So I am closing this and sorry fo the noise.

Though, is there any particular reason to remove it?
My guess is that you think that TaskGroup is more like a control-flow structure 
which does not need to be named, just like we don't name "for loop" for 
instance.

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



[issue46875] Missing name in TaskGroup.__repr__()

2022-02-27 Thread Joongi Kim


New submission from Joongi Kim :

The __repr__() method in asyncio.TaskGroup does not include self._name.
I think this is a simple overlook, because asyncio.Task includes the task name 
in __repr__(). :wink:

https://github.com/python/cpython/blob/345572a1a02/Lib/asyncio/taskgroups.py#L28-L42

I'll make a simple PR to fix it.

--
components: asyncio
messages: 414162
nosy: achimnol, asvetlov, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: Missing name in TaskGroup.__repr__()
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



[issue46843] PersistentTaskGroup API

2022-02-27 Thread Joongi Kim


Joongi Kim  added the comment:

I have updated the PersistentTaskGroup implementation referring 
asyncio.TaskGroup and added more detailed test cases, which works with the 
latest Python 3.11 GitHub checkout.

https://github.com/achimnol/aiotools/pull/36/files

Please have a look at the class docstring.
There are two different usage: async context manager vs. attributes of 
long-lived objects.

One of the point is to "revive" asyncio.gather() with return_exceptions=True 
but let it handle/report exceptions immediately with customizable exception 
handler.

Currently two-phase shutdown is not implemented yet as I'm still thinking about 
how to adapt the current implementation.

--

___
Python tracker 

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



[issue21761] [doc] language reference describes the role of module.__file__ inaccurately

2022-02-27 Thread Alex Waygood

Alex Waygood  added the comment:

Hi Vidhya — @slateny submitted a PR for this issue only two days ago (you can 
see that it's linked to this BPO issue in the "Pull Requests" field). I think 
it would be good to wait until that has been reviewed before doing any work on 
a possible PR for this issue :)

If you'd like to help out with this issue, you'd of course be very welcome to 
submit a review for @slateny's patch.

--
nosy: +AlexWaygood

___
Python tracker 

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



[issue21761] [doc] language reference describes the role of module.__file__ inaccurately

2022-02-27 Thread Vidhya


Vidhya  added the comment:

If this is still open, I would like to work on this. Please let me know.

--
nosy: +vidhya

___
Python tracker 

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



[issue46852] Remove the float.__setformat__() method

2022-02-27 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I reopen the issue for the second part of my plan

Hmm. That sounds like it should be a separate issue, or at the least, this 
issue should be retitled. It's helpful to keep issue titles accurate.

--

___
Python tracker 

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



[issue46849] Memory problems detected using Valgrind

2022-02-27 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy:  -terry.reedy

___
Python tracker 

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



[issue46786] embed, source, track, wbr HTML elements not considered empty

2022-02-27 Thread Stefan Behnel


Change by Stefan Behnel :


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



[issue46786] embed, source, track, wbr HTML elements not considered empty

2022-02-27 Thread Stefan Behnel


Stefan Behnel  added the comment:


New changeset 345572a1a0263076081020524016eae867677cac by Jannis Vajen in 
branch 'main':
bpo-46786: Make ElementTree write the HTML tags embed, source, track, wbr as 
empty tags (GH-31406)
https://github.com/python/cpython/commit/345572a1a0263076081020524016eae867677cac


--

___
Python tracker 

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



[issue46873] inspect.getsource with some lambdas in decorators does not get the full source

2022-02-27 Thread Alex Waygood


Change by Alex Waygood :


--
type:  -> behavior
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue46873] inspect.getsource with some lambdas in decorators does not get the full source

2022-02-27 Thread Adam Hopkins


Adam Hopkins  added the comment:

Sorry about that. I am doing some more digging to see if I can find the route 
of it and a proposal for a non-breaking patch. The problem seems to be in 
BlockFinder.tokeneater.

--
type: behavior -> 
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue46871] BaseManager.register no longer supports lambda callable 3.8.12+

2022-02-27 Thread Kyle Smith


Kyle Smith  added the comment:

Since you were able to help me scope that this is probably an MacOS specific 
issue, I was able to find this report:
https://github.com/pytest-dev/pytest-flask/issues/104

Setting `multiprocessing.set_start_method("fork")` _BEFORE_ the code is called 
resolves this.

I don't understand enough of MP to understand why this is a problem, and why I 
need to do this, but alas, at least I have a path forward. 


Since this behavior changed, and it _doesn't_ work cleanly anymore with MacOS, 
I would say this is a bug (from my casual understanding of python), because 
it's mentioned in the documentation that using "fork" can be problematic and 
lead to crashes outlined in bpo-33725.
> Changed in version 3.8: On macOS, the spawn start method is now the default.
> The fork start method should be considered unsafe as it can lead to crashes 
> of the subprocess. See bpo-33725.

--

___
Python tracker 

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



[issue46873] inspect.getsource with some lambdas in decorators does not get the full source

2022-02-27 Thread Alex Waygood

Alex Waygood  added the comment:

I'm removing 3.7 and 3.8 from the "versions" field, since they're currently 
only accepting patches for security-related bugs. But thanks for testing on 
those versions as well — that's useful information!

--
components: +Library (Lib)
nosy: +AlexWaygood, yselivanov
type:  -> behavior
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue46871] BaseManager.register no longer supports lambda callable 3.8.12+

2022-02-27 Thread Kyle Smith


Kyle Smith  added the comment:

Interesting. I did try between MacOS (12.2) and Ubuntu since I have servers 
with older python versions. For scoping then, this appears to be related only 
to MacOS since you were able to confirm it working correctly on Linux. 

The code is the same, but here's the entire traceback. All below examples were 
run on MacOS:

bash-3.2$ python3 --version
Python 3.9.6
bash-3.2$ python3 main.py
Traceback (most recent call last):
  File "/Volumes/Workspace/co/router/main.py", line 21, in 
shared_dict, shared_lock = get_shared_state(HOST, PORT, KEY)
  File "/Volumes/Workspace/co/router/main.py", line 12, in get_shared_state
manager.start()
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/managers.py",
 line 553, in start
self._process.start()
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py",
 line 121, in start
self._popen = self._Popen(self)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py",
 line 284, in _Popen
return Popen(process_obj)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py",
 line 32, in __init__
super().__init__(process_obj)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py",
 line 19, in __init__
self._launch(process_obj)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py",
 line 47, in _launch
reduction.dump(process_obj, fp)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/reduction.py",
 line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'get_shared_state..'


Running this with 3.7.9 works:
bash-3.2$ python3.7 --version
Python 3.7.9
bash-3.2$ python3.7 main.py
{'number': 0, 'text': 'Hello World'}


If it's of interest, 3.10.2 is also failing on Mac.

bash-3.2$ /usr/local/opt/python\@3.10/bin/python3 --version
Python 3.10.2
bash-3.2$ /usr/local/opt/python\@3.10/bin/python3 main.py
Traceback (most recent call last):
  File "/Volumes/Workspace/co/router/main.py", line 21, in 
shared_dict, shared_lock = get_shared_state(HOST, PORT, KEY)
  File "/Volumes/Workspace/co/router/main.py", line 12, in get_shared_state
manager.start()
  File 
"/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/managers.py",
 line 562, in start
self._process.start()
  File 
"/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/process.py",
 line 121, in start
self._popen = self._Popen(self)
  File 
"/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/context.py",
 line 284, in _Popen
return Popen(process_obj)
  File 
"/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_spawn_posix.py",
 line 32, in __init__
super().__init__(process_obj)
  File 
"/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_fork.py",
 line 19, in __init__
self._launch(process_obj)
  File 
"/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_spawn_posix.py",
 line 47, in _launch
reduction.dump(process_obj, fp)
  File 
"/usr/local/Cellar/python@3.10/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/reduction.py",
 line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'get_shared_state..'

--

___
Python tracker 

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



[issue46874] [sqlite3] optimise user-defined functions

2022-02-27 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue46852] Remove the float.__setformat__() method

2022-02-27 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue for the second part of my plan:

"Once they will be removed, it will become possible to move the detection of 
the IEEE 754 format in the build step (./configure script) rather than doing 
the detection at runtime (slower). It would remove an "if" in _PyFloat_Pack4() 
and _PyFloat_Pack8(), and allow to specialize these functions for the detected 
format at build time. These functions are used by serialization formats: 
marshal, pickle and struct."

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue46874] [sqlite3] optimise user-defined functions

2022-02-27 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
assignee:  -> erlendaasland

___
Python tracker 

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



[issue46874] [sqlite3] optimise user-defined functions

2022-02-27 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Currently, the `step` method of user-defined functions is looked up using 
`PyObject_GetAttrString`. Using an interned string and `PyObject_GetAttr`, we 
can speed up this a little bit.

--
components: Library (Lib)
messages: 414151
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: [sqlite3] optimise user-defined functions
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



[issue46852] Remove the float.__setformat__() method

2022-02-27 Thread Mark Dickinson


Mark Dickinson  added the comment:

Thanks, Victor. I think this can be closed now.

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



[issue46873] inspect.getsource with some lambdas in decorators does not get the full source

2022-02-27 Thread Adam Hopkins


New submission from Adam Hopkins :

I believe the following produces an unexpected behavior:

from inspect import getsource


def bar(*funcs):
def decorator(func):
return func

return decorator


@bar(lambda x: bool(True), lambda x: False)
async def foo():
...


print(getsource(foo))

The output shows only the decorator declaration and none of the function:

@bar(lambda x: bool(True), lambda x: False)


>From my investigation, it seems like this requires the following conditions to 
>be true:
- lambdas are passed in decorator arguments
- there is more than one lambda
- at least one of the lambdas has a function call

Passing the lambdas as default function arguments seems okay:

async def foo(bar=[lambda x: bool(True), lambda x: False]):
...

A single lambda seems okay:

@bar(lambda x: bool(True))
async def foo():
...

Lambdas with no function calls also seem okay:

@bar(lambda x: not x, lambda: True)
async def foo():
...

Tested this on:
- Python 3.10.2
- Python 3.9.9
- Python 3.8.11
- Python 3.7.12

--
messages: 414149
nosy: ahopkins2
priority: normal
severity: normal
status: open
title: inspect.getsource with some lambdas in decorators does not get the full 
source
versions: Python 3.10, 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



[issue46872] Odd handling of signal raised if an illegal syscall is attempted on Android

2022-02-27 Thread Dan Snider


New submission from Dan Snider :

On Android, the following calls generate a SIGSYS signal that is neither 
blocked by pthread_sigmask(SIG_BLOCK, {SIGSYS}) nor ignored after its handler 
is set to SIG_IGN:

(os.chroot(path))
os.setgid(rgid)
os.setuid(ruid) 
(os.setegid(gid))
os.setregid(rgid, egid)
os.setreuid(ruid, euid)
os.setresgid(rgid, egid, sgid)
time.clock_settime(clock, time)
time.clock_settime_ns(clock, time)
(socket.sethostname(name))


On the other hand, signal(SIGSYS, lambda s, p: None) will catch the signal, but 
based on frame it receives (None), I suspect this is a coincidence. Also, the 
functions with parenthesized names in that list raise the equivalent of 
OSError(0, "Error", "%s"%args[0]).

--
components: C API
messages: 414148
nosy: bup
priority: normal
severity: normal
status: open
title: Odd handling of signal raised if an illegal syscall is attempted on 
Android
type: behavior

___
Python tracker 

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



[issue46849] Memory problems detected using Valgrind

2022-02-27 Thread Christian Heimes


Christian Heimes  added the comment:

Valgrind does not understand Python's custom obmalloc allocator. You have to 
run valgrind with our suppression rules Misc/valgrind-python.supp to ignore 
false errors.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue46806] Overlapping PYTHONPATH may cause import already imported module

2022-02-27 Thread aklajnert


aklajnert  added the comment:

Honestly, it seems to me that the documents that you mentioned are discussing 
different problems, that may be related, but are not the same as the one I've 
described here.

I'm not arguing - you're clearly more experienced and that's not my area of 
expertise, but out of curiosity - can you mention some example use cases where 
the behavior I've described is useful?

--

___
Python tracker 

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



[issue46849] Memory problems detected using Valgrind

2022-02-27 Thread Christian Heimes


Change by Christian Heimes :


--
Removed message: https://bugs.python.org/msg414097

___
Python tracker 

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



[issue46799] ShareableList memory bloat and performance improvement

2022-02-27 Thread Ting-Che Lin


Ting-Che Lin  added the comment:

So I wrote a patch for this issue and published submitted a MR. When I was 
working on the patch, I realized that there is another issue related to how 
string and byte array size alignment is calculated. As seen here: 
https://github.com/python/cpython/blob/3.10/Lib/multiprocessing/shared_memory.py#L303.
 

>>> from multiprocessing.shared_memory import ShareableList
>>> s_list = ShareableList(["12345678"])
>>> s_list.format
'16s'

I changed the calculation of 
self._alignment * (len(item) // self._alignment + 1),
to
self._alignment * max(1, (len(item) - 1) // self._alignment + 1)

With the patch, this will give
>>> from multiprocessing.shared_memory import ShareableList
>>> s_list = ShareableList(["12345678"])
>>> s_list.format
'8s'

--

___
Python tracker 

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



[issue46567] Add Tcl/Tk builds for ARM64

2022-02-27 Thread Niyas Sait


Change by Niyas Sait :


--
nosy: +nsait-linaro
nosy_count: 5.0 -> 6.0
pull_requests: +29726
pull_request: https://github.com/python/cpython/pull/31603

___
Python tracker 

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



[issue46868] Improve performance of math.prod with bignums (and functools.reduce?)

2022-02-27 Thread benrg


benrg  added the comment:

My example used ints, but I was being deliberately vague when I said "bignums". 
Balanced-tree reduction certainly isn't optimal for ints, and may not be 
optimal for anything, but it's pretty good for a lot of things. It's the 
comparison-based sorting of reduction algorithms.

* When the inputs are of similar sizes, it tends to produce intermediate 
operands of similar sizes, which helps with Karatsuba multiplication (as you 
said).

* When the inputs are of different sizes, it limits the "damage" any one of 
them can do, since they only participate in log2(n) operations each.

* It doesn't look at the values, so it works with third-party types that are 
unknown to the stdlib.

There's always a fallback case, and balanced reduction is good for that. If 
there's a faster path for ints that looks at their bit lengths, great.

--

___
Python tracker 

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