[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-23 Thread neonene


neonene  added the comment:

3.10rc2 Python/ceval.c
1306: #define DISPATCH() \
1307: { \
1308: if (trace_info.cframe.use_tracing OR_DTRACE_LINE OR_LLTRACE) { \
1309: goto tracing_dispatch; \

Among the 44 pgo-tests, only test_patma.TestTracing hits the condition above. 
On Windows, it seems that skipping it tightens the profile of PR28475 a bit. 
Additional tests such as test_threading(.ThreadTests.test_frame_tstate_tracing) 
might also cause some amount of variation or vice versa.

3.10rc2 x64 PGO: 1.00
+ PR28475 
  with TestTracing : 1.05x faster (slow  3, fast 46, same  9)
  without  : 1.06x faster (slow  5, fast 52, same  1)

  with TestTracing : 1.00
  without  : 1.01x faster (slow 19, fast 27, same 12)

(Details: PR28475_skip1test_bench.txt)


Does test_patma.TestTracing need training for match-case performance?

--
Added file: https://bugs.python.org/file50296/PR28475_skip1test_bench.txt

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +26918
pull_request: https://github.com/python/cpython/pull/28527

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread STINNER Victor


STINNER Victor  added the comment:

I created PR 28527 to document PyThreadState.use_tracing removal and explain 
how to port existing code to Python 3.10.

--

___
Python tracker 

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



[issue45269] c_make_encoder() has uncovered error: "argument 1 must be dict or None"

2021-09-23 Thread Nikita Sobolev


New submission from Nikita Sobolev :

Looks like we never test error that `markers` are limited to `None` and `dict` 
types. Here: 
https://github.com/python/cpython/blob/main/Modules/_json.c#L1252-L1255

Coverage report: 
https://app.codecov.io/gh/python/cpython/blob/master/Modules/_json.c line: 1252

I will submit a unit test for it today.

Related: https://bugs.python.org/issue6986

--
components: Tests
messages: 402482
nosy: sobolevn
priority: normal
severity: normal
status: open
title: c_make_encoder() has uncovered error: "argument 1 must be dict or None"
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



[issue45267] New install Python 3.9.7 install of Sphinx Document Generator fails

2021-09-23 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

The error in the attached file says that one of the dependencies could not be 
found, in particular the "packaging" library.

This doesn't look like a bug in CPython or pip, but more a general support 
question. I kindly ask you to visit one of the python forums or mail lists (for 
example https://discuss.python.org).

--
nosy: +ronaldoussoren
resolution:  -> not a bug
stage:  -> resolved
status: open -> pending
type:  -> behavior

___
Python tracker 

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



[issue41137] pdb uses the locale encoding for .pdbrc

2021-09-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ec7ffa4b5b262369f726a54e145e9c03eaeb4c1a by Victor Stinner in 
branch 'main':
bpo-41137: Reorganize What's New in Python 3.11 (GH-28518)
https://github.com/python/cpython/commit/ec7ffa4b5b262369f726a54e145e9c03eaeb4c1a


--

___
Python tracker 

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



[issue45256] Remove the usage of the C stack in Python to Python calls

2021-09-23 Thread Christian Tismer


Christian Tismer  added the comment:

Hey guys, you know that you are about to implement the core idea of Stackless 
Python, right? :-D

--
nosy: +Christian.Tismer

___
Python tracker 

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



[issue29921] datetime validation is stricter in 3.6.1 than previous versions

2021-09-23 Thread Patrick Decat


Patrick Decat  added the comment:

pywin32 project has moved from sourceforge to github.

https://sourceforge.net/p/pywin32/bugs/748/ is now at 
https://github.com/mhammond/pywin32/issues/748

pywin32 issue is supposed to be resolved since pywin32 b222

See:

https://github.com/mhammond/pywin32/issues/748#issuecomment-359223029

https://github.com/mhammond/pywin32/commit/07202650d21e8fa7f3053ff1d4665363315cefce

https://github.com/mhammond/pywin32/blob/b222/CHANGES.txt#L24-L26

--
nosy: +Patrick Decat

___
Python tracker 

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



[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-23 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not comfortable with PR 28525 which always hang threads which attempt to 
acquire the GIL after Python exited.

I would prefer to keep the current behavior by default, but give the ability to 
applications embedding Python to decide what to do.

With my Py_SetThreadExitCallback(func) idea, PyThread_exit_thread() would call 
func() and then pthread_exit(0). Applications can hang threads, log a message, 
call abort(), or whatever else.

I'm not comfortable with writing a portable function to "hang a thread". For 
example, I don't understand why PR 28525 processes Windows messages on hang 
threads.

Well, it's a complex problem :-(

--

___
Python tracker 

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



[issue41203] Replace references to OS X in documentation with macOS

2021-09-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 1493e1a40d04a048cce9c5080ec47478a4941054 by Miss Islington (bot) 
in branch '3.10':
bpo-41203: Replace Mac OS X and OS X with macOS (GH-28515) (GH-28523)
https://github.com/python/cpython/commit/1493e1a40d04a048cce9c5080ec47478a4941054


--

___
Python tracker 

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



[issue41203] Replace references to OS X in documentation with macOS

2021-09-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset f1d5cdef57fea961646c52db7a60d1f110e0eaa6 by Miss Islington (bot) 
in branch '3.9':
bpo-41203: Replace Mac OS X and OS X with macOS (GH-28515) (GH-28524)
https://github.com/python/cpython/commit/f1d5cdef57fea961646c52db7a60d1f110e0eaa6


--

___
Python tracker 

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



[issue44958] [sqlite3] only reset statements when needed

2021-09-23 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Explicitly resetting statements when we're done with them removes the 
performance regression; SQLite works more efficient when we keep the number of 
non-reset statements low.

--

___
Python tracker 

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



[issue41203] Replace references to OS X in documentation with macOS

2021-09-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Patrick.

We had several PRs for fixing macOS references here and there, they were closed 
in favor of this larger PR.

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



[issue45256] Remove the usage of the C stack in Python to Python calls

2021-09-23 Thread Mark Shannon


Mark Shannon  added the comment:

I've trying to do this since about 2011 :)

--

___
Python tracker 

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



[issue40116] Regression in memory use of shared key dictionaries for "compact dicts"

2021-09-23 Thread Mark Shannon


Mark Shannon  added the comment:

Raymond,

Only split dicts need the extra field.

Classes where many instances do not have exactly the same set of attributes may 
be more common than you think.
There are many reasons why some attributes may be added conditionally.

PR 28520 actually makes the dictionary code a bit simpler, as we don't need to 
maintain the invariant that value arrays cannot have holes. Maintaining an 
order is simple and cheap:

order = (order<<4) | insertion_index

There are pros and cons to both schemes: PR 28520 and the current 
implementation.

The problem with the current scheme is that it only works well for classes 
where all instances are initialized with exactly the same attributes, and in 
the same order.

The PR 28520 scheme can handle those cases where order and key set differ a 
bit, but has a maximum size of 16 before the dict must be combined.


We need as many instances as possible to have split dictionaries, to get 
https://github.com/faster-cpython/ideas/issues/72 working well as it will make 
the cost of not sharing even greater, relatively.

--

___
Python tracker 

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



[issue41629] __class__ not set defining 'X' as

2021-09-23 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



[issue40116] Regression in memory use of shared key dictionaries for "compact dicts"

2021-09-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are several common idioms which do not work well with shared dictionaries.

1. Class attributes as defaults. If most instances of the class have the 
default value for some attribute, it can be set as the class attribute. It 
saves memory because most instances will have smaller dict. But if the first 
instance has such attribute, it cancels shared dict for all following instances 
without this attribute.

2. cached_property (and analogs). The cached instance attributes can be added 
in arbitrary order, canceling shared dict for this instance and maybe for all 
instances created later.

3. Some classes delete attributes in close() or __exit__() methods to avoid 
reference loops and to release resources earlier. Since shared dicts do not 
support deletion, such closed objects have now larger size than non-closed 
objects.

--

___
Python tracker 

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



[issue40346] Add random.BaseRandom to ease implementation of subclasses

2021-09-23 Thread Matt Bogosian

Matt Bogosian  added the comment:

I landed here after investigating this surprising result:

  # test_case.py
  from random import Random
  from typing import Sequence, Union
  
  _RandSeed = Union[None, int, Sequence[int]]
  
  class MyRandom(Random):
def __init__(
  self,
  seed: _RandSeed = None,
):
  if seed is not None and not isinstance(seed, int):
seed = sum(seed)
  super().__init__(seed)
 
  MyRandom([1, 2])

Output:

  python ./test_case.py
  Traceback (most recent call last):
File "/…/./test_case.py", line 16, in 
  
  MyRandom([1, 2])
  TypeError: unhashable type: 'list'

In my observation, the Random class aspires to be an interface (and default 
implementation), but doesn't really live up to those aspirations. (See also 
https://github.com/python/typeshed/issues/6063.) I suspect nudging Random 
closer to its claims was the point of this proposal. I'm kind of sad it (or 
something like it) was rejected in favor of a process that will probably take 
years. Is there a reason not to do both, meaning heal what lives in the 
standard library now to live up to its own marketing *and* work toward a better 
interface in the future?

--
nosy: +posita

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f4ccb79d52ee726d58bbb038ea98b4deec52001d by Victor Stinner in 
branch 'main':
bpo-43760: Document PyThreadState.use_tracing removal (GH-28527)
https://github.com/python/cpython/commit/f4ccb79d52ee726d58bbb038ea98b4deec52001d


--

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 11.0 -> 12.0
pull_requests: +26919
pull_request: https://github.com/python/cpython/pull/28529

___
Python tracker 

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



[issue45270] Clicking "Add to Custom C

2021-09-23 Thread Pramod


Change by Pramod :


--
nosy: pramodsarathy17
priority: normal
severity: normal
status: open
title: Clicking "Add to Custom C

___
Python tracker 

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



[issue45271] Add a 'find' method (a'la str) to list

2021-09-23 Thread Dávid Nemeskey

New submission from Dávid Nemeskey :

There is an unjustified asymmetry between `str` and `list`, as far as lookup 
goes. Both have an `index()` method that returns the first index of a value, or 
raises a `ValueError` if it doesn't exist. However, only `str` has the `find` 
method, which returns -1 if the value is not in the string.

I think it would make sense to add `find` to `list` as well. For starters, it 
would make the API between the two sequence types more consistent. More 
importantly (though it depends on the use-case), `find` is usually more 
convenient than `index`, as one doesn't have to worry about handling an 
exception. As a bonus, since `list` is mutable, it allows one to write code 
such as

if (idx := lst.find(value)) == -1:
lst.append(value)
call_some_function(lst[idx])

, making the method even more useful as it is in `str`.

--
messages: 402497
nosy: nemeskeyd
priority: normal
severity: normal
status: open
title: Add a 'find' method (a'la str) to list

___
Python tracker 

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



[issue45271] Add a 'find' method (a'la str) to list

2021-09-23 Thread Dávid Nemeskey

Change by Dávid Nemeskey :


--
type:  -> enhancement

___
Python tracker 

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



[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Pramod


New submission from Pramod :

When customising my Python IDLE (in Options>Configure IDLE>Highlights>Choose 
color for:), if I choose a color from the palette and click on the button "Add 
to Custom Colors" multiple times, all my existing colors are replaced by a 
single color one by one, instead I feel it would be better if Python gave a 
popup saying something like "the selected color already exists in Custom 
colors".

--
assignee:  -> terry.reedy
components: +IDLE
nosy: +terry.reedy
title: Clicking "Add to Custom C -> Clicking "Add to Custom Colors" adds same 
colour multiple times
type:  -> behavior
versions: +Python 3.9
Added file: https://bugs.python.org/file50297/python bug 1.png

___
Python tracker 

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



[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Pramod


Change by Pramod :


Added file: https://bugs.python.org/file50298/python bug 1.png

___
Python tracker 

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



[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


Removed file: https://bugs.python.org/file50297/python bug 1.png

___
Python tracker 

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



[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

IDLE has nothing to do with the operation of the color chooser.  IDLE calls a 
tkinter function that calls a tk functions that calls the OS Window Manager 
color chooser.  The choice you make is returned to IDLE as a color string that 
IDLE can later pass to tkinter and tk.  What you see on Windows, in your image 
is the MS Windows 10 color chooser.  The macOS color chooser is *completely* 
different.

The Windows Custom Color bar presumes that you make a small set of 
distinguishable custom colors.  The main use in IDLE would be if you create a 
custom backgound color that you want to use for multiple foreground/background 
pairs.  The use in Windows would be if you have a custom palette that you want 
to use for multiple applications.

--
resolution:  -> third party
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



[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Pramod


Pramod  added the comment:

Sorry for adding my file again. Can you please state the reason for
removing the file Mr. Terry J Reedy , was it because I haven't signed the
Contributor Agreement at that time? But now that I have signed it, can I
add thehttps://bugs.python.org/file50298/python bug 1.png file again?

On Thu, 23 Sept 2021 at 20:58, Terry J. Reedy 
wrote:

>
> Change by Terry J. Reedy :
>
>
> Removed file: https://bugs.python.org/file50297/python bug 1.png
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Pramod


Pramod  added the comment:

I understand that, but is it possible to keep only unique colors in the
Custom Color palette, and when user chooses the exact same color to be in
the Custom Color palette it would return a pop up like "Color already in
Custom Color palette".

It would be better if the color strings which IDLE receives, are checked if
present already in Custom Colors, if not it then passes it to tkinter and
tk.

On Thu, 23 Sept 2021 at 21:08, Terry J. Reedy 
wrote:

>
> Terry J. Reedy  added the comment:
>
> IDLE has nothing to do with the operation of the color chooser.  IDLE
> calls a tkinter function that calls a tk functions that calls the OS Window
> Manager color chooser.  The choice you make is returned to IDLE as a color
> string that IDLE can later pass to tkinter and tk.  What you see on
> Windows, in your image is the MS Windows 10 color chooser.  The macOS color
> chooser is *completely* different.
>
> The Windows Custom Color bar presumes that you make a small set of
> distinguishable custom colors.  The main use in IDLE would be if you create
> a custom backgound color that you want to use for multiple
> foreground/background pairs.  The use in Windows would be if you have a
> custom palette that you want to use for multiple applications.
>
> --
> resolution:  -> third party
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue45271] Add a 'find' method (a'la str) to list

2021-09-23 Thread Steve Dower


Steve Dower  added the comment:

Strings are already special in that str.index() and str.find() both find 
substrings, while list.index() only finds a single element.

If .find() also searched for a substring of the list, I think this could be 
helpful. Even more so if it used an efficient algorithm (bearing in mind that 
the arbitrary comparisons between elements - something else that doesn't exist 
in strings - would make this complicated).

This is probably something to bring up on the python-ideas mailing list first, 
anyway. Symmetry is not a sufficient reason in itself to add new APIs - often 
the asymmetry exists because the "missing" one is only there for 
legacy/compatibility reasons, not because it is a good API.

--
nosy: +steve.dower

___
Python tracker 

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



[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

You added the same file twice.  Once was enough.

To repeat: IDLE has no knowledge of color chooser.  The Custom Colors bar is 
Windows specific.  There is no such thing on macOS.


PS: when responding by email, please delete the quoted message.  It is 
redundant and therefore noise when posted on the web page.

--

___
Python tracker 

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



[issue45256] Remove the usage of the C stack in Python to Python calls

2021-09-23 Thread Steve Dower


Steve Dower  added the comment:

I fully support implementing the core idea of Stackless Python :)

I spent a whole EuroPython a couple of years back discussing the idea with 
(apparently) everyone except Mark.

Though I wouldn't like to lose the ability to extract the Python stack by 
inspecting native memory alone. That is very useful for debugging, particularly 
when you've only got a crash dump. So provided all the code objects are only an 
indirection or two away from a local (or better yet, parameter) value, it 
should be fine.

--
nosy: +steve.dower

___
Python tracker 

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



[issue45213] Frozen modules are looked up using a linear search.

2021-09-23 Thread Steve Dower


Steve Dower  added the comment:

Could we add a compile-time requirement (most likely checked in tests, rather 
than at build) that _PyImport_FrozenModules be sorted? Then we can at least 
bail out of the loop early, and one day someone could make it a binary search.

--
nosy: +steve.dower

___
Python tracker 

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



[issue45272] 'os.path' should not be a frozen module

2021-09-23 Thread Steve Dower


New submission from Steve Dower :

I noticed that Python/frozen.c includes posixpath as 'os.path'.

This is not correct, and shouldn't be necessary anyway, because os.path is just 
an attribute in "os" and not a concrete module (see Lib/os.py#L95 for the bit 
that makes it importable, and Lib/os.py#L61 and Lib/os.py#L81 for the imports).

--
assignee: eric.snow
messages: 402506
nosy: eric.snow, steve.dower
priority: normal
severity: normal
stage: needs patch
status: open
title: 'os.path' should not be a frozen module
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



[issue45244] pip not installed with fresh python3.8.10 installation

2021-09-23 Thread Steve Dower


Steve Dower  added the comment:

Can you attach the log files stored in your %TEMP% as a zip file? They should 
all start with "Python".

Be aware that they may contain personal information, such as usernames or 
machine names. Feel free to scrub those first if necessary.

--
nosy: +steve.dower

___
Python tracker 

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



[issue40346] Add random.BaseRandom to ease implementation of subclasses

2021-09-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Matt, your example works in 3.11. In earlier versions you need to override the 
__new__ method.

--

___
Python tracker 

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



[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

A PR adding a `Py_SetThreadExitCallback(func)` API guaranteeing the callback is 
called before `pthread_exit()` would allow anyone wanting to deal with their 
deadlocks to register `abort()` or `while(1) pause();` as their exit callback.  
I'd be okay with that.  Anyone care to make a PR for that?

What should it do when SetThreadExitCallback has already been called?  Is that 
an error?  Are the callbacks chained?  In which order?  If someone passes 
nullptr does that undo it (please no!).  It is process global state that many 
things could wind up having an opinion on each with their own reason to require 
theirs to be the only one.  I vote for returning an error if a callback has 
already been set.  And not allowing unsetting a callback.

What we'd do internally at work is always guarantee our codebase's early 
application startup code (because we have such a thing) calls that to setup 
whichever exit callback we deem appropriate for everyone instead of today's 
default deadlock potential.

On pausing... agreed, it doesn't feel _comfortable_.  To me when faced with a 
known potential deadlock situation the only comfortable thing is to abort() as 
a process dying is always more useful than process hanging (or worse, partially 
hanging).

Sleeping on the problem, I don't really understand how `while(1) pause();` is 
significantly different than `pthread_exit()` when it comes to deadlocks, as it 
seems like an instantly terminated thread having state that needs cleanup 
should lead to a similar outcome as a thread with stuff needing cleanup that is 
now stuck in an infinite pause loop.  Neither of them is going to cleanup 
whatever (presumably a lock they hold) that leads something else to deadlock?  
I guess the difference is that the thread stack  memory is at least not 
released back for potential reuse while other threads and pointers could still 
be referring to it when pausing as opposed to a pthread_exit?

--

___
Python tracker 

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



[issue40346] Add random.BaseRandom to ease implementation of subclasses

2021-09-23 Thread Matt Bogosian


Matt Bogosian  added the comment:

Thanks! Where's that documented? (Apologies if I missed it.)

--

___
Python tracker 

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



[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Steve Dower


Steve Dower  added the comment:

Passing the metaclass as a slot seems like the right idea for this API, though 
I recall there being some concern about the API (IIRC, mixing function pointers 
and data pointers doesn't work on some platforms?) that mean it'll be 
deprecated in the future.

--
nosy: +steve.dower

___
Python tracker 

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



[issue44687] io.BufferedReader:peek() closes underlying file, breaking peek/read expectations

2021-09-23 Thread Steve Dower


Steve Dower  added the comment:

Seems like it would be better to not check the file open/closed state on 
peek/read when there is still buffered data?

--
nosy: +steve.dower

___
Python tracker 

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



[issue45271] Add a 'find' method (a'la str) to list

2021-09-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This is one bit of symmetry that we shouldn't pursue.  The find() methods have 
been a recurring source of bugs because of failing to check for a -1 result but 
having that be a valid index into the sequence.

Also, the sequence APIs are long established.  If find() were really needed, we 
would have felt the pain and added it long ago.

As Steve says, you can take this to python-ideas, but my recommendation is to 
not do it all.

--
nosy: +rhettinger
resolution:  -> rejected
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



[issue45273] OS-specific frozen modules are built, even on other OSes.

2021-09-23 Thread Eric Snow


New submission from Eric Snow :

The list of frozen modules in Python/frozen.c is generated by 
Tools/scripts/freeze_modules.py.  Currently we freeze both posixpath and 
ntpath, even though for startup we only need one of the two (depending on the 
OS).  In this case both modules are available on all platforms (and only 
os.path differs), so we might be okay to leave both frozen.  The cost isn't 
high.

However, we may need to accommodate freezing a module only on a subset of 
supported OSes:

* if the extra cost (to the size of the executable) is too high
* if there's an OS-specific module that is only available on that OS

In that case, we'd need to generate the appropriate ifdefs in Python/frozen.c.  
We can't just exclude the module during generation since frozen.c is committed 
to the repo.

--
assignee: eric.snow
components: Interpreter Core
messages: 402514
nosy: eric.snow, steve.dower
priority: normal
severity: normal
stage: needs patch
status: open
title: OS-specific frozen modules are built, even on other OSes.
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



[issue45273] OS-specific frozen modules are built, even on other OSes.

2021-09-23 Thread Eric Snow


Eric Snow  added the comment:

FYI, currently os.path is also frozen and *is* OS-specific.  However, that's a 
separate matter.  See bpo-45272.

--

___
Python tracker 

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



[issue45272] 'os.path' should not be a frozen module

2021-09-23 Thread Eric Snow


Eric Snow  added the comment:

The matter here boils down to the design of _imp.is_frozen() [1].  It only 
checks to see if the given module name shows up in the list of frozen modules 
in Python/frozen.c.  This broke things when I froze os and posixpath/ntpath.

The simplest solution was to include os.path in the list of modules in 
frozen.c.  The better solution would be to have _imp.is_frozen() check the 
module in sys.modules.


[1] see find_frozen() in Python/import.c

--
nosy: +barry, brett.cannon, jaraco, ncoghlan

___
Python tracker 

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



[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Sebastian Berg


Sebastian Berg  added the comment:

I can make a PR from the patch (and add the `Py_tp_metaclass` slot if desired) 
with a basic test here, if that is what is blocking things.

Fixing the type and size of the allocation (as the patch does) would allow me 
to give people a way to create a new NumPy DType dynamically.  I only need the 
user to call my initialization function as soon as the type was created (with 
`PyType_FromSpec` or otherwise).
(And I can avoid any internal acrobatics creating the type for the user; this 
stuff tends to be super confusing even if the principles are fairly straight 
forward...)

Happy to pursue other avenues, but I am not clear which...


> IIRC, mixing function pointers and data pointers doesn't work on some 
> platforms?

... I guess it is too late to do some weird thing like (not sure it would be 
reasonable or is valid anyway though):

typedef union {
void *pdata;
void (*pfunc)(void);
} slot_value;

I am a bit interested in it, because I want to use a `FromSpec` API in NumPy 
and it would be nice to be sure I can grow it to include data without too much 
hassle.  But the easier thing may just be to add one or two `void *reserved` 
slot to the spec struct that must be NULL for now...

--

___
Python tracker 

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



[issue45256] Remove the usage of the C stack in Python to Python calls

2021-09-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Though I wouldn't like to lose the ability to extract the Python stack by 
> inspecting native memory alone.

Don't worry about it, I am personally making sure that keeps being possible. it 
will need some changes in the tools, but not any more that any other changes 
between minor versions of the interpreter

--

___
Python tracker 

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



[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-23 Thread Jeremy Maitin-Shepard


Jeremy Maitin-Shepard  added the comment:

In general, I view hanging threads as the least bad thing to do when faced with 
either acquiring the GIL or not returning at all.  There is a lot of existing 
usage of Python that currently poses a risk of random crashes and memory 
corruption while Python is exiting, and I would like to fix that.

However, I would certainly recommend that code using the Python C API attempt 
to avoid threads getting to that state in the first place.  I added a "finalize 
block" mechanism to that PR which is intended to provide a way to attempt to 
acquire the GIL in a way that ensures the GIL won't get hung.  I would welcome 
feedback on that.  A common use case for that API might be a non-Python created 
thread that wants to invoke some sort of asynchronous callback handler via 
Python APIs.

For Python daemon threads that you control, you can avoid them hanging by 
registering an atexit function that signals them to exit and then waits until 
they do.

vsteinner: Regarding processing the Windows messages, I updated the PR to 
include a link to the MSDN documentation that led me to think it was a good 
idea.

vstinner: As for random code outside of Python itself that is using 
`PyThread_exit_thread`: although I suppose there are legitimate use cases for 
`pthread_exit` and `_endthreadex`, these functions are only safe with the 
cooperation of the entire call stack of the thread.  Additionally, while 
`pthread_exit` and `_endthreadex` have similar behavior for C code, they don't 
have the same behavior for C++ code, and that difference seems like a likely 
source of problems.  Finally, I would say Python itself does not guarantee that 
its call stacks safely cooperate with `pthread_exit` (at the very least, there 
are sure to be memory leaks).  Therefore, I think Python should not encourage 
its use by leaving it as a non-deprecated public API.  If a user wishes to 
terminate a thread, they can invoke `pthread_exit` or `_endthreadex` directly, 
ideally without any Python functions in the call stack, and can refer to the 
documentation of those functions to understand the implications.

gps: The reasons I believe hanging the thread is better than `pthread_exit`:
- `pthread_exit` essentially throws an exception.  In theory that means you 
could do proper cleanup via C++ destructors and/or re-throwing catch blocks.  
But in practice existing extension code is not designed to do that, and it 
would be quite a complex task to modify it to do proper cleanup, and on Windows 
the cleanup wouldn't run anyway.
- Additionally, throwing an exception means if there is a `noexcept` function 
in the call stack, the program terminates.  We would need to document that you 
aren't allowed to call Python APIs if there is a `noexcept` function in the 
call stack.  If you have a `catch(...)` in the call stack, then you may 
inadvertently catch the exception and return control back to Python at a point 
that assumes it owns the GIL, which will cause all sorts of havoc.  We would 
likewise need to document that you can't have a non-rethrowing `catch(...)` 
block in the call stack (I believe pybind11 has some of those).
- Throwing an exception also means C++ destructors run.  pybind11 has a smart 
pointer type that holds a `PyObject` and whose destructor calls `Py_DECREF`.  
That causes a crash when `pthread_exit` unwinds the stack, since the thread 
doesn't own the GIL.

Those are the additional problems specific to `pthread_exit`.  As gps noted, 
there is the additional problem of memory corruption common to both 
`pthread_exit` and `_endthreadex`:
- Data structures that are accessible from other threads may contain pointers 
to data on the thread's stack.  For example, with certain types of 
locks/signalling mechanisms it is common to store a linked list node on the 
stack that as then added to a list of waiting threads.  If we destroy the 
thread stack without proper cleanup (and that proper cleanup definitely won't 
happen with `_endthreadex`, and probably in most cases still won't happen with 
`pthread_exit`), the data structure has now become corrupted.

I don't think hanging the thread really increases the risk of deadlock over the 
status quo.  In theory someone could have a C++ destructor that does some 
cleanup that safely pevents deadlock, but that is not portable to Windows, and 
I expect that properly implemented `pthread_exit`-safe code is extremely rare.

I think we would want to ensure that Python itself is implemented in such a way 
as to not deadlock if Python-created threads with only Python functions in the 
call stack hang.  Mostly that would amount to not holding mutexes while calling 
functions that may transitively attempt to acquire the GIL (or release and then 
re-acquire the GIL).  That is probably a good practice for avoiding deadlock 
even when not finalizing.

We would also want to document that external code using the Python API should 
be safe from deadlock if a threa

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Josh Haberman


Josh Haberman  added the comment:

> Passing the metaclass as a slot seems like the right idea for this API, 
> though I recall there being some concern about the API (IIRC, mixing function 
> pointers and data pointers doesn't work on some platforms?)

PyType_Slot is defined as a void* (not a function pointer): 
https://github.com/python/cpython/blob/8492b729ae97737d22544f2102559b2b8dd03a03/Include/object.h#L223-L226

So putting a PyTypeObject* into a slot would appear to be more kosher than 
function pointers.

Overall, a slot seems like a great first approach.  It doesn't require any new 
functions, which seems like a plus.  If the any linking issues a la tp_base are 
seen, a new function could be added later.

--

___
Python tracker 

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



[issue44309] Add support for yescrypt in crypt.

2021-09-23 Thread David Mandelberg


Change by David Mandelberg :


--
nosy: +dseomn

___
Python tracker 

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



[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

- specs/slots are (usually) constant & static; pointers to types are not always 
C constant expressions (on Windows, if they come from a different DLL)
- specs/slots are (usually) shared across all subinterpreters; types are 
specific to a single interpreter

It's better to pass the metaclass as a function argument, as with bases. I'd 
prefer adding a new function that using a slot.

--

___
Python tracker 

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



[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Steve Dower


Steve Dower  added the comment:

But at least if it's available as a slot then a module is *able* to use it with 
limited ABI going backwards. A new function doesn't allow that.

And yeah, it means they have to write more complex code than just a static 
array definition, but people are willing and able to do it.

I don't think there's anything about the current FromSpec that suggests all the 
parameters have to be interpreter-agnostic. And the design does suggest that 
we'll add more later without having to break the ABI (otherwise it would be a 
regular struct).

--

___
Python tracker 

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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor

New submission from STINNER Victor :

Bernát Gábor found an interesting bug on Windows. Sometimes, when a process is 
interrupted on Windows with CTRL+C, its parent process hangs in thread.join():
https://twitter.com/gjbernat/status/1440949682759426050

Reproducer:

* Install https://github.com/gaborbernat/tox/tree/2159
* Make an empty folder and put the above tox.ini in it
* Invoke python -m tox and once that command is sleeping press CTRL+C (the app 
should lock there indefinitely).

tox.ini:
---

[testenv]
skip_install = true
commands = python -c 'import os; print(f"start {os.getpid()}"); import time; 
time.sleep(100); print("end");'
---

Source: https://gist.github.com/gaborbernat/f1e1aff0f2ee514b50a92a4d019d4d13

I tried to attach the Python process in Python: there is a single thread, the 
main thread which is blocked in thread.join(). You can also see it in the 
faulthandler traceback.

I did a long analysis of the _tstate_lock and I checked that thread really 
completed. Raw debug traces:

== thread 6200 exit ==
 
thread_run[pid=3984, thread_id=6200]: clear
PyThreadState_Clear[pid=3984, thread_id=6200]: on_delete()
release_sentinel[pid=3984, thread_id=6200]: enter
release_sentinel[pid=3984, thread_id=6200]: release(obj=01C1122669C0, 
lock=01C110BBDA00)
release_sentinel[pid=3984, thread_id=6200]: exit
PyThreadState_Clear[pid=3984, thread_id=6200]: on_delete()--
 
== main thread is calling join() but gets a KeyboardInterrupt ==
 
[pid=3984, thread_id=8000] Lock.acquire() -> ACQUIRED
Current thread 0x1f40 (most recent call first):
  File "C:\vstinner\python\3.10\lib\threading.py", line 1118 in 
_wait_for_tstate_lock
  File "C:\vstinner\python\3.10\lib\threading.py", line 1092 in join
  File "C:\vstinner\env\lib\site-packages\tox\session\cmthread_run[pid=3984, 
thread_id=6200]: exit
d\run\common.py", line 203 in execute
  File "C:\vstinner\env\lib\site-packages\tox\session\cmd\run\sequential.py", 
line 20 in run_sequential
  File "C:\vstinner\env\lib\site-packages\tox\session\cmd\legacy.py", line 104 
in legacy
  File "C:\vstinner\env\lib\site-packages\tox\run.py", line 49 in main
  File "C:\vstinner\env\lib\site-packages\tox\run.py", line 23 in run
  File "C:\vstinner\env\lib\site-packages\tox\__main__.py", line 4 in 
  File "C:\vstinner\python\3.10\lib\runpy.py", line 86 in _run_code
  File "C:\vstinner\python\3.10\lib\runpy.py", line 196 in _run_module_as_main
_wait_for_tstate_lock[pid=3984, current thread_id=8000, self thread_id=6200]: 
EXC: KeyboardInterrupt(); acquired? None
 
== main thread calls repr(thread) ==
 
ROOT: [3984] KeyboardInterrupt - teardown started
_wait_for_tstate_lock[pid=3984, current thread_id=8000, self thread_id=6200]: 
acquire(block=False, timeout=-1): lock obj= 0x1c1122669c0
  File "C:\vstinner\python\3.10\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
  File "C:\vstinner\python\3.10\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
  File "C:\vstinner\env\lib\site-packages\tox\__main__.py", line 4, in 
run()
  File "C:\vstinner\env\lib\site-packages\tox\run.py", line 23, in run
result = main(sys.argv[1:] if args is None else args)
  File "C:\vstinner\env\lib\site-packages\tox\run.py", line 49, in main
result = handler(state)
  File "C:\vstinner\env\lib\site-packages\tox\session\cmd\legacy.py", line 104, 
in legacy
return run_sequential(state)
  File "C:\vstinner\env\lib\site-packages\tox\session\cmd\run\sequential.py", 
line 20, in run_sequential
return execute(state, max_workers=1, has_spinner=False, live=True)
  File "C:\vstinner\env\lib\site-packages\tox\session\cmd\run\common.py", line 
217, in execute
print(f'join {thread}')
  File "C:\vstinner\python\3.10\lib\threading.py", line 901, in __repr__
self.is_alive() # easy way to get ._is_stopped set when appropriate
  File "C:\vstinner\python\3.10\lib\threading.py", line 1181, in is_alive
self._wait_for_tstate_lock(False)
  File "C:\vstinner\python\3.10\lib\threading.py", line 1113, in 
_wait_for_tstate_lock
traceback.print_stack()
_wait_for_tstate_lock[pid=3984, current thread_id=8000, self thread_id=6200]: 
failed to acquire 0x1c1122669c0
_wait_for_tstate_lock[pid=3984, current thread_id=8000, self thread_id=6200]: 
exit 0x1c1122669c0
join 
 
== main thread calls thread.join()... which hangs ==
 
_wait_for_tstate_lock[pid=3984, current thread_id=8000, self thread_id=6200]: 
acquire(block=True, timeout=-1): lock obj= 0x1c1122669c0
  File "C:\vstinner\python\3.10\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
  File "C:\vstinner\python\3.10\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
  File "C:\vstinner\env\lib\site-packages\tox\__main__.py", line 4, in 
run()
  File "C:\vstinner\env\lib\site-packages\tox\run.py", line 23, in run
result = main(sys.argv[1:] if args is None else args)
  File "C:\vstinner\env\lib\site-packages\tox\run.py

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file50300/threading_bug.py

___
Python tracker 

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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor


STINNER Victor  added the comment:

For curious people, see also bpo-44422 "Fix threading.enumerate() reentrant 
call": another example of race condition recently fixed in the threading 
module. But it's unrelated to this bug ;-)

--

___
Python tracker 

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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +pablogsal
stage: patch review -> 

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 55576893b31452ba739e01189424cd62cf11ed20 by Miss Islington (bot) 
in branch '3.10':
bpo-43760: Document PyThreadState.use_tracing removal (GH-28527) (GH-28529)
https://github.com/python/cpython/commit/55576893b31452ba739e01189424cd62cf11ed20


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45101] Small inconsistency in usage message between the python and shell script versions of python-config

2021-09-23 Thread Kien Dang


Kien Dang  added the comment:

Thanks. I didn't know about the `pkg-config` thing. I just checked with 
pkg-config on macOS

`pkg-config --help` prints usage instructions to stdout

pkg-config followed by invalid options prints output to stderr, for example 
`pkg-config --asdf` prints `Unknown option --asdf` to stderr.

The PR I submitted does something similar, making both python and shell script 
versions of `python-config` to print out the usage instruction message to 
stdout when --help is provided and stderr when given invalid arguments.

--

___
Python tracker 

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



[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Josh Haberman


Josh Haberman  added the comment:

> It's better to pass the metaclass as a function argument, as with bases. I'd 
> prefer adding a new function that using a slot.

Bases are available both as a slot (Py_tp_bases) and as an argument 
(PyType_FromSpecWithBases).  I don't see why this has to be an either/or 
proposition.  Both can be useful.

Either would satisfy my use case.  I'm constructing N such classes, so the spec 
won't be statically initialized anyway and the initialization issues on Windows 
don't apply.

--

___
Python tracker 

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



[issue38415] @asynccontextmanager decorated functions are not callable like @contextmanager

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 86b833badd3d6864868404ead2f8c7994d24f85c by Jason Fried in branch 
'main':
bpo-38415: Allow using @asynccontextmanager-made ctx managers as decorators 
(GH-16667)
https://github.com/python/cpython/commit/86b833badd3d6864868404ead2f8c7994d24f85c


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue38415] @asynccontextmanager decorated functions are not callable like @contextmanager

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:

Look, not even 23 months to land this thing!

Thanks, Jason! ✨ 🍰 ✨

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue39359] zipfile: add missing "pwd: expected bytes, got str" exception message

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 91099e25446b214725f8e2bec6f90553260c by Daniel Hillier in 
branch 'main':
bpo-39359: [zipfile] add missing "pwd: expected bytes, got str" exception 
(GH-18031)
https://github.com/python/cpython/commit/91099e25446b214725f8e2bec6f90553260c


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue39359] zipfile: add missing "pwd: expected bytes, got str" exception message

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Daniel! ✨ 🍰 ✨

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not sure that it can be solved at Python level.

Possible solutions:

* Add a Lock method (or just a builtin function) which acquires and immediately 
releases the lock, without possibility to interrupt.

if lock._blink(block, timeout):
self._stop()

* Add a context manager which suppresses keyboard interruption.

with suppress_interrupt():
if not lock._blink(block, timeout):
return
self._stop()

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26922
pull_request: https://github.com/python/cpython/pull/28537

___
Python tracker 

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



[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 55b45bf707c6c8084db259fe2f8aa08e84ea0d99 by Peter Bittner in 
branch 'main':
bpo-38623: Add note about site module (site-packages) (GH-16974)
https://github.com/python/cpython/commit/55b45bf707c6c8084db259fe2f8aa08e84ea0d99


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26921
pull_request: https://github.com/python/cpython/pull/28536

___
Python tracker 

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



[issue45026] More compact range iterator

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:

Good point benchmarking small iterations too, Dennis. I missed that. 

Agreed then, GH-27986 looks like a winner.

--

___
Python tracker 

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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Add a context manager which suppresses keyboard interruption.

That's not enough technically. This can be any signal handler that raises an 
exception, no?

--

___
Python tracker 

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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread gaborjbernat


Change by gaborjbernat :


--
nosy: +gaborjbernat

___
Python tracker 

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



[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 87f97fe5e6434da51246d70af9e2cd7d63c29fba by Miss Islington (bot) 
in branch '3.10':
bpo-38623: Add note about site module (site-packages) (GH-16974) (GH-28536)
https://github.com/python/cpython/commit/87f97fe5e6434da51246d70af9e2cd7d63c29fba


--

___
Python tracker 

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



[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Peter! ✨ 🍰 ✨

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, 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



[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset d672dd34f0bc3addeaf1789d4183e3a37ab110d5 by Miss Islington (bot) 
in branch '3.9':
bpo-38623: Add note about site module (site-packages) (GH-16974) (GH-28537)
https://github.com/python/cpython/commit/d672dd34f0bc3addeaf1789d4183e3a37ab110d5


--

___
Python tracker 

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



[issue39359] zipfile: add missing "pwd: expected bytes, got str" exception message

2021-09-23 Thread Daniel Hillier

Daniel Hillier  added the comment:

Thanks Łukasz!

--

___
Python tracker 

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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread Eryk Sun


Eryk Sun  added the comment:

See bpo-21822 from 2014, which I think was the first report of this issue.

--
nosy: +eryksun

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-09-23 Thread Eric Snow


Change by Eric Snow :


--
pull_requests: +26923
pull_request: https://github.com/python/cpython/pull/28538

___
Python tracker 

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



[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-09-23 Thread Chuanlong Du


New submission from Chuanlong Du :

I have command-line script `blog` written using argparse. It supports 
subcommands. When I check the help doc of a subcommand, e.g., using `blog 
convert -h`, it prints the help doc of the subcommand `blog convert` but 
doesn't print the description of the subcommand `blog convert`. A screenshot is 
attached. It is quite often that I know a command-line application have certain 
subcommands but I forget exactly what they do. It would be very helpful if 
`blog subcmd -h` prints the description of the subcmd so that users do not have 
to call `blog -h` again to check exactly what the subcommand does.

--
components: Library (Lib)
files: Selection_011.png
messages: 402541
nosy: longendu
priority: normal
severity: normal
status: open
title: Make argparse print description of subcommand when invoke help doc on 
subcommand
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9
Added file: https://bugs.python.org/file50301/Selection_011.png

___
Python tracker 

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



[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread gaborjbernat


gaborjbernat  added the comment:

I just want to note that my maximal reproducer moved to 
https://github.com/tox-dev/tox/commit/e5d1a439be0790c8104d4caf943b3d82f23a0039 
(that has been merged on the branch, so should be now stable).

--
nosy:  -eryksun

___
Python tracker 

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