[issue46142] python --help output is too long

2022-01-01 Thread Éric Araujo

Change by Éric Araujo :


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

___
Python tracker 

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2022-01-01 Thread paul j3


paul j3  added the comment:

Don't add an argument_group to another argument_group.  While input allows this 
nesting, the formatting is not designed to handle it.  Nor does the 
documentation illustrate such nesting.

Nesting a mutually_exclusive_group in an argument_group works because the 
exclusive_group is not used in formatting the help lines.  The two class of 
groups have very different purposes.

Note that the add_argument_group() method is defined for the parent 
_ActionsContainer class.  ArgumentParser inherits from this, as do both of the 
group classes.  While one could make a case for changing the group's 
inheritance of this method to Not-implemented, it's only a problem when users, 
like you, try to push for undocumented usage.

In general argparse has a clean and powerful class structure.  But it doesn't 
do a lot of checking and pruning, so there loose ends like this.  The Action 
class and its subclasses is similarly powerful, with enough loose ends to allow 
adventurous users to hang themselves :).

--
nosy: +paul.j3

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



[issue46142] python --help output is too long

2022-01-01 Thread Éric Araujo

Éric Araujo  added the comment:

It seems that preconfig is only for some options that change fundamental 
behaviour (isolated mode, default encoding), so I should be able to detect and 
handle '-X help' in initconfig.

--

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



[issue46142] python --help output is too long

2022-01-01 Thread Éric Araujo

Éric Araujo  added the comment:

Question about the implementation:
I’ve found the parsing of command-line params in Python/initconfig.c and 
Python/preconfig.c.
Help is handled in initconfig, X options in preconfig.

A) could add a value to the right struct for "-X help", set it in preconfig, 
handle it in initconfig (by printing X options help and exiting, maybe reusing 
the existing print help function or writing a very similar one next to it)
B) or detect the option in preconfig, print and exit right there

Which option is best?

--
nosy: +vstinner

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



[issue46142] python --help output is too long

2021-12-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think that the man page should contain all details related to the CLI (and 
may be even some examples).

--

___
Python tracker 

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



[issue46142] python --help output is too long

2021-12-31 Thread Éric Araujo

Éric Araujo  added the comment:

Do people think the man page should be shortened too?

--

___
Python tracker 

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



[issue40296] help(list[int]) fails

2021-12-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue46142] python --help output is too long

2021-12-20 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue46142] python --help output is too long

2021-12-20 Thread Éric Araujo

Éric Araujo  added the comment:

Forgot to quote  -X help  to print help about X options.

--
components: +Interpreter Core

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



[issue46142] python --help output is too long

2021-12-20 Thread Éric Araujo

New submission from Éric Araujo :

>From Serhiy in 
>https://mail.python.org/archives/list/python-...@python.org/thread/QUUBM7DGSXYWBOLZNWOSCQUDALWJIYZF/
> :

The output of "python -h" is 104 lines long now. It was only 51 lines in
3.6. 35% of it is about the -X option, and 30% about environment
variables. Also some lines in the -X option description are too long
(102 columns). Both topics are "advanced" and mostly interested for
debugging. I suggest to move them out of the main help output.  […]

Guido:

-X opt : implementation-specific option; use -X help to list options.

We could also see if we can put the help text for each of the supported -X
flags in the table defining these flags […]

GvR again:

--help-env […] prints info about env vars (new flag)


I would enjoy trying to make a patch around next week!

--
messages: 408981
nosy: eric.araujo, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: python --help output is too long
type: enhancement
versions: Python 3.11

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



[issue35228] Index search in CHM help crashes viewer

2021-12-17 Thread Charles G.


Charles G.  added the comment:

My previous Windows version (Win 10 1803) does not have this crashing problem. 
It only crashed after upgrading to 21H1. So I replaced hhctrl.ocx in system32 
(Win 10 21H1) with hhctrl.ocx from Windows.old.

2019/03/19  11:45   696.320 hhctrl.ocx
2021/09/23  03:29   729.600 hhctrl.ocx.old

--
nosy: +Charles G.

___
Python tracker 

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



[issue38584] argparse: Specifying a whitespace-only help message to a positional arg triggers an IndexError when displaying --help

2021-12-16 Thread Lucas Cimon


Lucas Cimon  added the comment:

This was resolved by https://github.com/python/cpython/pull/28050

--
message_count: 4.0 -> 5.0
pull_requests: +28366
status: open -> closed
pull_request: https://github.com/python/cpython/pull/28050

___
Python tracker 

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-16 Thread Irit Katriel


Irit Katriel  added the comment:

Nesting argument groups and mutually exclusive groups is now deprecated (see 
issue22047). Thank you for the bug report.

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified raises exception

2021-12-15 Thread Irit Katriel


Change by Irit Katriel :


--
title: argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help 
specified crashes -> argparse.BooleanOptionalAction with 
default=argparse.SUPPRESS and help specified raises exception

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



[issue26952] argparse help formatter raises IndexError

2021-12-15 Thread Irit Katriel


Change by Irit Katriel :


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



[issue26952] argparse help formatter raises IndexError

2021-12-15 Thread Irit Katriel

Irit Katriel  added the comment:


New changeset f0b274d2e21e6c7c1c0f56464070108f9bd00d20 by Miss Islington (bot) 
in branch '3.9':
bpo-26952: [argparse] clearer error when formatting an empty mutually… 
(GH-30099) (GH-30115)
https://github.com/python/cpython/commit/f0b274d2e21e6c7c1c0f56464070108f9bd00d20


--

___
Python tracker 

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



[issue26952] argparse help formatter raises IndexError

2021-12-15 Thread Irit Katriel

Irit Katriel  added the comment:


New changeset 8e4c96295bd78ae5f70b908e5dbac0da7c4c21bd by Miss Islington (bot) 
in branch '3.10':
bpo-26952: [argparse] clearer error when formatting an empty mutually… 
(GH-30099) (GH-30114)
https://github.com/python/cpython/commit/8e4c96295bd78ae5f70b908e5dbac0da7c4c21bd


--

___
Python tracker 

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



[issue26952] argparse help formatter raises IndexError

2021-12-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28337
pull_request: https://github.com/python/cpython/pull/30115

___
Python tracker 

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



[issue26952] argparse help formatter raises IndexError

2021-12-15 Thread Irit Katriel

Irit Katriel  added the comment:


New changeset 86de99588db3beff964137f4fe27dd1077a09b35 by Irit Katriel in 
branch 'main':
bpo-26952: [argparse] clearer error when formatting an empty mutually… 
(GH-30099)
https://github.com/python/cpython/commit/86de99588db3beff964137f4fe27dd1077a09b35


--

___
Python tracker 

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



[issue26952] argparse help formatter raises IndexError

2021-12-15 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +28336
pull_request: https://github.com/python/cpython/pull/30114

___
Python tracker 

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified crashes

2021-12-15 Thread Irit Katriel


Irit Katriel  added the comment:

Changing type. Crash is typically segfault or hang in c code rather than an 
exception.

--
nosy: +iritkatriel
type: crash -> behavior

___
Python tracker 

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified crashes

2021-12-14 Thread Felix Fontein


Change by Felix Fontein :


--
type:  -> crash

___
Python tracker 

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified crashes

2021-12-14 Thread Felix Fontein


Change by Felix Fontein :


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

___
Python tracker 

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified crashes

2021-12-14 Thread Felix Fontein


New submission from Felix Fontein :

When argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS and 
help is specified, trying to display --help results in a crash.

Reproducer:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--test', action=argparse.BooleanOptionalAction, 
default=argparse.SUPPRESS, help='Foo')
parser.parse_args()

Result when running 'python t.py --help':

Traceback (most recent call last):
  File "/path/to/t.py", line 4, in 
parser.parse_args()
  File "/usr/lib/python3.10/argparse.py", line 1821, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.10/argparse.py", line 1854, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.10/argparse.py", line 2063, in _parse_known_args
start_index = consume_optional(start_index)
  File "/usr/lib/python3.10/argparse.py", line 2003, in consume_optional
take_action(action, args, option_string)
  File "/usr/lib/python3.10/argparse.py", line 1931, in take_action
action(self, namespace, argument_values, option_string)
  File "/usr/lib/python3.10/argparse.py", line 1095, in __call__
parser.print_help()
  File "/usr/lib/python3.10/argparse.py", line 2551, in print_help
self._print_message(self.format_help(), file)
  File "/usr/lib/python3.10/argparse.py", line 2535, in format_help
return formatter.format_help()
  File "/usr/lib/python3.10/argparse.py", line 283, in format_help
help = self._root_section.format_help()
  File "/usr/lib/python3.10/argparse.py", line 214, in format_help
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.10/argparse.py", line 214, in 
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.10/argparse.py", line 214, in format_help
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.10/argparse.py", line 214, in 
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.10/argparse.py", line 530, in _format_action
help_text = self._expand_help(action)
  File "/usr/lib/python3.10/argparse.py", line 627, in _expand_help
return self._get_help_string(action) % params
KeyError: 'default'

The problem is that in 
https://github.com/python/cpython/blob/f54fee7f37563fbd569596cf94aad023ac6c3179/Lib/argparse.py#L879,
 default isn't tested for SUPPRESS as well. I've prepared a patch to fix that 
and will push it to GitHub soon.

(I've experienced the crash with Python 3.9 and 3.10; the test I've created 
also crashes for the current main branch, so I guess that means that Python 
3.11 is also affected. I haven't tested older Python versions before 3.9.)

--
components: Library (Lib)
messages: 408586
nosy: felixfontein
priority: normal
severity: normal
status: open
title: argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help 
specified crashes
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue26952] argparse help formatter raises IndexError

2021-12-14 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 6.0 -> 7.0
pull_requests: +28321
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30099

___
Python tracker 

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-13 Thread Irit Katriel

Irit Katriel  added the comment:

You’re right that the api should not be there. See issue22047.

I don’t think it should be patches to call super/return self. That would just 
be confusing.

--
resolution:  -> duplicate
superseder:  -> argparse improperly prints mutually exclusive options when they 
are in a group

___
Python tracker 

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-13 Thread László Attila Tóth

László Attila Tóth  added the comment:

my idea regarding _ArgumentGroup,add_argument_group is in the attached file. 
This doesn't solve the complete help output issue, but addresses the 
incorrectly called _ArgumentGroup.add_argument_group - a warn() call and return 
self.
As a result the help output for embedded groups (not mutually exclusive groups) 
work as expected. If the title parameter is specified, this
scenario is not checked, and so on.

--
keywords: +patch
Added file: 
https://bugs.python.org/file50489/argparse-add-arg_grp-deprecation.diff

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



[issue27718] help('signal') incomplete (e.g: signal.signal not visible)

2021-12-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue27718] help('signal') incomplete (e.g: signal.signal not visible)

2021-12-13 Thread miss-islington


miss-islington  added the comment:


New changeset 80f98b1614cc8e58d8a5ec72c94d27f663e23035 by Miss Islington (bot) 
in branch '3.9':
[3.10] bpo-27718: Fix help for the signal module (GH-30063) (GH-30080)
https://github.com/python/cpython/commit/80f98b1614cc8e58d8a5ec72c94d27f663e23035


--

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



[issue27718] help('signal') incomplete (e.g: signal.signal not visible)

2021-12-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e55deaabd8de338138cf29aea6890996e794c997 by Serhiy Storchaka in 
branch '3.10':
[3.10] bpo-27718: Fix help for the signal module (GH-30063) (GH-30080)
https://github.com/python/cpython/commit/e55deaabd8de338138cf29aea6890996e794c997


--

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



[issue27718] help('signal') incomplete (e.g: signal.signal not visible)

2021-12-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +28305
pull_request: https://github.com/python/cpython/pull/30084

___
Python tracker 

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



[issue27718] help('signal') incomplete (e.g: signal.signal not visible)

2021-12-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +28301
pull_request: https://github.com/python/cpython/pull/30080

___
Python tracker 

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



[issue27718] help('signal') incomplete (e.g: signal.signal not visible)

2021-12-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e08c0d8eec528f1d7a282ee19bcadb9aae9ec123 by Serhiy Storchaka in 
branch 'main':
bpo-27718: Fix help for the signal module (GH-30063)
https://github.com/python/cpython/commit/e08c0d8eec528f1d7a282ee19bcadb9aae9ec123


--

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth

László Attila Tóth  added the comment:

According to the documentation only the ArgumentParser has add_argument_group 
option, which is not true, the code allows me to add a subgroup to any group. 
The complete example is in issue 4608: https://bugs.python.org/issue46058

If add_argument_group shouldn't be used for a regular argument group,
I suggest the following change: _ActionsContainer.add_argument_group should 
return self if title is not specified and raise error if 
add_argument_group("...") is called on a group with title.

This is close to the originally intended, documented behaviour.

I'd still allow groups without title in mutually exclusive groups and vice 
versa.

--

___
Python tracker 

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread Irit Katriel


Irit Katriel  added the comment:

According to the docs it should be

>>> xgrp = parser.add_argument_group()

rather than

>>> xgrp = grp.add_argument_group()


This seems to work:



>>> parser = argparse.ArgumentParser()
>>> grp = parser.add_argument_group('Database settings')
>>> grp.add_argument('--db-config')
_StoreAction(option_strings=['--db-config'], dest='db_config', nargs=None, 
const=None, default=None, type=None, choices=None, help=None, metavar=None)
>>> xgrp = parser.add_argument_group()
>>> xgrp.add_argument('--db-password')
_StoreAction(option_strings=['--db-password'], dest='db_password', nargs=None, 
const=None, default=None, type=None, choices=None, help=None, metavar=None)
>>> parser.parse_args(['-h'])
usage: [-h] [--db-config DB_CONFIG] [--db-password DB_PASSWORD]

options:
  -h, --helpshow this help message and exit

Database settings:
  --db-config DB_CONFIG

  --db-password DB_PASSWORD

--

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth

László Attila Tóth  added the comment:

The fix is something like this for _ArgumentGroup, but as the container may not 
be an _ArgumentGroup, it breaks the tests.

--- Lib/argparse.py
+++ Lib/argparse.py
@@ -1635,9 +1640,13 @@ def __init__(self, container, title=None, 
description=None, **kwargs):
 self._has_negative_number_optionals = \
 container._has_negative_number_optionals
 self._mutually_exclusive_groups = container._mutually_exclusive_groups
+self._container = container

 def _add_action(self, action):
-action = super(_ArgumentGroup, self)._add_action(action)
+if self.title:
+action = super(_ArgumentGroup, self)._add_action(action)
+else:
+action = self._container._add_action(action)
 self._group_actions.append(action)

--

___
Python tracker 

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth

László Attila Tóth  added the comment:

And the leading part is the same for both the mutually exclusive and the 
argument groups:

usage: test1.py [-h] [--db-config DB_CONFIG] [--db-password DB_PASSWORD]

optional arguments:
  -h, --helpshow this help message and exit

Database settings:


--

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth

László Attila Tóth  added the comment:

Sorry, these are two bugs in fact. The current one, the help with minmal code:

import argparse

parser = argparse.ArgumentParser()
grp = parser.add_argument_group('Database settings')
grp.add_argument('--db-config')
xgrp = grp.add_argument_group()
xgrp.add_argument('--db-password')
parser.parse_args(['-h'])


The group's help output shows only --db-config option:

Database settings:
  --db-config DB_CONFIG

If I change the xgrp to be mutually exclusive group as:
xgrp = grp.add_mutually_exclusive_group()

then the output is the same as I expect for the previous code, too:

Database settings:
  --db-config DB_CONFIG
  --db-password DB_PASSWORD

--

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread Irit Katriel


Irit Katriel  added the comment:

Please complete the bug report: How did you run this function, what output did 
you get and what output did you expect?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth

New submission from László Attila Tóth :

I tried to use the following code where the --db-password is not shown in the 
--help output (Originally I wanted to use mutually exclusive groups but that 
feature also works strangely, so I changed them to regular groups).

def register_db_args(parser: argparse.ArgumentParser):
grp = parser.add_argument_group('Database settings')
grp.add_argument('--db-config', dest='db_config_file',
 help='Config file containg all details including password')

grp.add_argument('--db-host')
grp.add_argument('--db-port')
grp.add_argument('--db-user')

xgrp = grp.add_argument_group()
xgrp.add_argument('--db-password')
xgrp.add_argument('--db-password-env')
xgrp.add_argument('--db-password-file')

--
components: Library (Lib)
messages: 408388
nosy: Laszlo.Attila.Toth
priority: normal
severity: normal
status: open
title: argparse: embedded groups may prevent options from being in help output
type: behavior
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

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



[issue27718] help('signal') incomplete (e.g: signal.signal not visible)

2021-12-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is due to use functools.wraps(). If __all__ is not defined all non-builtin 
functions should have correct __module__ to be displayed by pydoc. 
functools.wraps() assigns __module__, __name__, __qualname__, __doc__ and 
__annotations__. __module__ should be preserved ('signal', not '_signal'), 
__name__ and __qualname__ are already correct, __annotations__ does not exist. 
So only __doc__ should be copied.

--

___
Python tracker 

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



[issue27718] help('signal') incomplete (e.g: signal.signal not visible)

2021-12-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
nosy: +serhiy.storchaka
nosy_count: 6.0 -> 7.0
pull_requests: +28283
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30063

___
Python tracker 

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



[issue27718] help('signal') incomplete (e.g: signal.signal not visible)

2021-12-11 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue17890] argparse: mutually exclusive groups full of help-suppressed args can cause AssertionErrors

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

I'm unable to reproduce this problem on 3.11:

>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> group = parser.add_mutually_exclusive_group()
>>> group.add_argument('--spam', help=argparse.SUPPRESS)
_StoreAction(option_strings=['--spam'], dest='spam', nargs=None, const=None, 
default=None, type=None, choices=None, help='==SUPPRESS==', metavar=None)
>>> parser.add_argument('--' + 'eggs' * 20, dest='eggs')
_StoreAction(option_strings=['--eggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggs'],
 dest='eggs', nargs=None, const=None, default=None, type=None, choices=None, 
help=None, metavar=None)
>>> parser.print_usage()
usage: [-h]  
[--eggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggs
 EGGS]
>>>

--
nosy: +iritkatriel
resolution:  -> fixed
status: open -> pending

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



Re: help

2021-12-09 Thread Igor Korot
Hi,

On Thu, Dec 9, 2021 at 10:31 AM smita  wrote:
>
>
>
>I am not able to open python on my laptop plzz help

What do you mean by saying "open python"?

Thank you.

>
>
>
>Sent from [1]Mail for Windows
>
>
>
> References
>
>Visible links
>1. https://go.microsoft.com/fwlink/?LinkId=550986
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help

2021-12-09 Thread Mats Wichmann

On 12/9/21 03:39, smita wrote:
 


I am not able to open python on my laptop plzz help


You're going to have to provide some details.


--
https://mail.python.org/mailman/listinfo/python-list


help

2021-12-09 Thread smita
    

   I am not able to open python on my laptop plzz help

    

   Sent from [1]Mail for Windows

    

References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-12-01 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

In Python 3.10, classmethod() added a __wrapped__ attribute.  Presumably, any 
use case for implicit chaining can now be accomplished in an explicit and 
controlled manner.

--

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Irit Katriel


Irit Katriel  added the comment:

Christian - that's what it was. I uninstalled cffi and now it works.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-12-01 Thread Stephen Rosen


Stephen Rosen  added the comment:

Probably >90% of the use-cases for chaining classmethod are a read-only class 
property.
It's important enough that some tools (e.g. sphinx) even have special-cased 
support for classmethod(property(...)).

Perhaps the general case of classmethod(descriptor(...)) should be treated 
separately from the common case?

> I propose deprecating classmethod chaining.  It has become clear that it 
> doesn't really do what people wanted and can't easily be made to work.

If classmethod(property(f)) is going to be removed, can an implementation of 
classproperty be considered as a replacement?

Or perhaps support via the other ordering, property(classmethod(f))?

--
nosy: +sirosen2

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Christian Heimes


Christian Heimes  added the comment:

The easiest way is to remove and rebuild 3rd party software.

--

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Irit Katriel


Irit Katriel  added the comment:

How do I check that?

--

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Christian Heimes


Christian Heimes  added the comment:

This looks like an issue with 3rd party software cffi. Are you using a fresh 
build of cffi? The internal ABI of an alpha build changes very often.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Irit Katriel


Irit Katriel  added the comment:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
(code=1, address=0x0)
frame #0: 0x00010015fd26 
python.exe`_PyObject_GenericGetAttrWithDict(obj=0x00013feb7a50, 
name=0x000100fe9350, dict=0x, suppress=0) at 
object.c:1305:17
   1302 PyDictValues **values_ptr = _PyObject_ValuesPointer(obj);
   1303 if (values_ptr && *values_ptr) {
   1304 if (PyUnicode_CheckExact(name)) {
-> 1305 assert(*_PyObject_DictPointer(obj) == NULL);
   1306 res = _PyObject_GetInstanceAttribute(obj, *values_ptr, 
name);
   1307 if (res != NULL) {
   1308 goto done;
Target 0: (python.exe) stopped.
(lldb) p obj
(PyObject *) $0 = 0x00013feb7a50
(lldb) p _PyObject_Dump((PyObject*)obj->ob_type)
object address  : 0x13ff25590
object refcount : 32
object type : 0x100518680
object type name: type
object repr : 
(lldb) p (PyObject*)obj->ob_type
(PyObject *) $1 = 0x00013ff25590
(lldb) p (PyObject*)obj->ob_type->tp_dict
(PyObject *) $2 = 0x00013fedd910
(lldb) p _PyObject_Dump((PyObject*)obj->ob_type->tp_dict)
object address  : 0x13fedd910
object refcount : 1
object type : 0x100511d50
object type name: dict
object repr : {'__new__': , '__getattribute__': , '__init__': , 'addressof': , 'alignof': , 'def_extern': , 'callback': , 'cast': , 'dlclose': , 
'dlopen': , 'from_buffer': 
, 'from_handle': , 'gc': , 'getctype': , 'init_once': , 'integer_const': , 
'list_types': , 'memmove': 
, 'new': , 'new_allocator': , 'new_handle': , 'offsetof': , 'release': , 'sizeof': , 'string': , 'typeof': 
, 'unpack': , 'errno': , '__doc__': None, 'NULL': , 
'error': , 'CType': , 'CData': 
, 'b
 uffer': , 'RTLD_LAZY': 1, 'RTLD_NOW': 2, 
'RTLD_GLOBAL': 8, 'RTLD_LOCAL': 4, 'RTLD_NODELETE': 128, 'RTLD_NOLOAD': 16}
(lldb) p (PyObject*)obj->ob_type->tp_dictoffset
(PyObject *) $3 = NULL



Because the tp_dictoffset is 0, _PyObject_DictPointer(obj) returns NULL and in 
the assertion, where the return value is dereferenced, it crashes.

(Note: it's not that the assertion is failing, we don't get that far).

--

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

I'm unable to reproduce on macOS 11.6 as well (head at 
49444fb807ecb396462c8e5f547eeb5c6bc5d4de).

--

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Also unable to reproduce with HEAD at 8a45ca542a65ea27e7acaa44a4c833a27830e796. 
Perhaps it is related to your build/dev environment?

--

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Irit Katriel


Irit Katriel  added the comment:

I'm using MacOS 11.6.

--

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Also unable to reproduce with HEAD at 49444fb807ecb396462c8e5f547eeb5c6bc5d4de.

--

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Unable to reproduce on macOS 12 with latest 3.11 official build, and my most 
recent dev build (HEAD at b394af13f69c1a2ac0e7d32dabf6d86443606ab2).

--
nosy: +erlendaasland

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Mark Shannon


Mark Shannon  added the comment:

When I say "cffi bug", I should say "is cffi not ported to 3.11 yet?"

--

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-12-01 Thread Mark Shannon


Mark Shannon  added the comment:

Works for me on Ubuntu.

Python 3.11.0a2+ (heads/main:0aa0bd0563, Dec  1 2021, 11:39:40) [GCC 9.3.0] on 
linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help("modules")

[lots of output, but no assertion failure or segfault]

>>> 


I note that your debug output includes `_cffi_backend.FFI object`
Is this a cffi bug?

--

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-11-30 Thread Irit Katriel


Irit Katriel  added the comment:

It's failing in this assertion which was added in 
https://github.com/python/cpython/pull/28802 :

https://github.com/python/cpython/blob/8a45ca542a65ea27e7acaa44a4c833a27830e796/Objects/object.c#L1305

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-11-30 Thread Irit Katriel


Irit Katriel  added the comment:

It works for me on 3.10.

--
keywords: +3.11regression

___
Python tracker 

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



[issue45941] help("modules") segfaults on 3.11, MacOS

2021-11-30 Thread Irit Katriel


Change by Irit Katriel :


--
title: help("modules") segfaults on 3.11 -> help("modules") segfaults on 3.11, 
MacOS

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



[issue45941] help("modules") segfaults on 3.11

2021-11-30 Thread Irit Katriel


Irit Katriel  added the comment:

On the debugger: 

>>> help("modules")

Please wait a moment while I gather a list of all available modules...

/Users/iritkatriel/src/cpython/Lib/pkgutil.py:92: DeprecationWarning: The 
distutils package is deprecated and slated for removal in Python 3.12. Use 
setuptools or check PEP 632 for potential alternatives
  __import__(info.name)
/Users/iritkatriel/src/cpython/Lib/pkgutil.py:92: DeprecationWarning: lib2to3 
package is deprecated and may not be able to parse Python 3.10+
  __import__(info.name)
test_sqlite3: testing with version '2.6.0', sqlite_version '3.32.3'
/Users/iritkatriel/src/cpython/Lib/distutils/command/build_ext.py:13: 
DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig 
instead
  from distutils.sysconfig import customize_compiler, get_python_version
Process 88596 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
(code=1, address=0x0)
frame #0: 0x000100160046 
python.exe`_PyObject_GenericGetAttrWithDict(obj=0x000106acfa50, 
name=0x000100fe91c0, dict=0x, suppress=0) at 
object.c:1305:17
   1302 PyDictValues **values_ptr = _PyObject_ValuesPointer(obj);
   1303 if (values_ptr && *values_ptr) {
   1304 if (PyUnicode_CheckExact(name)) {
-> 1305 assert(*_PyObject_DictPointer(obj) == NULL);
   1306 res = _PyObject_GetInstanceAttribute(obj, *values_ptr, 
name);
   1307 if (res != NULL) {
   1308 goto done;
Target 0: (python.exe) stopped.
(lldb) p _PyObject_Dump(name)
object address  : 0x100fe91c0
object refcount : 165
object type : 0x10051aec0
object type name: str
object repr : 'string'
(lldb) p _PyObject_Dump(*_PyObject_DictPointer(obj))
error: Execution was interrupted, reason: Attempted to dereference an invalid 
pointer..
The process has been returned to the state before expression evaluation.
(lldb) p _PyObject_Dump(obj)
object address  : 0x106acfa50
object refcount : 7
object type : 0x105add590
object type name: _cffi_backend.FFI
object repr : <_cffi_backend.FFI object at 0x106acfa50>

--

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



[issue45941] help("modules") segfaults on 3.11

2021-11-30 Thread Irit Katriel


New submission from Irit Katriel :

Python 3.11.0a2+ (heads/main:8a45ca542a, Nov 30 2021, 22:40:56) [Clang 13.0.0 
(clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> help("modules")

Please wait a moment while I gather a list of all available modules...

/Users/iritkatriel/src/cpython/Lib/pkgutil.py:92: DeprecationWarning: The 
distutils package is deprecated and slated for removal in Python 3.12. Use 
setuptools or check PEP 632 for potential alternatives
  __import__(info.name)
/Users/iritkatriel/src/cpython/Lib/pkgutil.py:92: DeprecationWarning: lib2to3 
package is deprecated and may not be able to parse Python 3.10+
  __import__(info.name)
test_sqlite3: testing with version '2.6.0', sqlite_version '3.32.3'
/Users/iritkatriel/src/cpython/Lib/distutils/command/build_ext.py:13: 
DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig 
instead
  from distutils.sysconfig import customize_compiler, get_python_version
zsh: segmentation fault  ./python.exe

--
components: Interpreter Core
messages: 407403
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: help("modules") segfaults on 3.11
type: crash
versions: Python 3.11

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



[issue22656] `help` ignores `__doc__` of descriptors

2021-11-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This was fixed long ago in commit ac4bdcc80e986bdd5b9d10ab0bce35aabb790a3e

The code is in inspect.py::_finddoc().  See issue 25503.

--
nosy: +rhettinger
resolution:  -> out of date
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



[issue22656] `help` ignores `__doc__` of descriptors

2021-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

I am unable to reproduce the problem on 3.11 (on a Mac). I get both help 
messages from Ram's code.

--
nosy: +iritkatriel

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



[issue23217] help() function incorrectly captures comment preceding a nested function

2021-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.2, Python 3.3, Python 
3.5

___
Python tracker 

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-11-19 Thread Alex Waygood


Alex Waygood  added the comment:

It makes me sad that the stdlib will no longer provide a way to compose 
classmethods with other descriptors. However, I agree that deprecating 
classmethod  chaining is probably the correct course of action, given the 
complications this feature has caused, and the backwards-compatibility issues 
it raises.

This is probably a conversation for another BPO issue or the python-ideas 
mailing list, but I hope some consideration can be given in the future as to 
whether a new classmethod-like feature could possibly be added to functools 
that would enable this kind of decorator chaining without the same 
code-breakage concerns that this feature has had.

--

___
Python tracker 

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-11-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I propose deprecating classmethod chaining.  It has become clear that it 
doesn't really do what people wanted and can't easily be made to work.

By even suggesting that some stateful decorators are composable, we've ventured 
onto thin ice.  Wrapping property in a classmethod doesn't produce something 
that behaves like a real property.  Mixing staticmethod and property doesn't 
work at all.  Putting abstractmethod in the mix doesn't work well either.  The 
ecosystem of code inspection tools, like help() in this issue, is wholly 
unprepared for recognizing and working around these combinations.  The latest 
"fix" for classmethod chaining looks weird and worriesome as well:  
self.f.__get__(cls, cls).

Classmethod chaining is relatively new, so we will affect very little code by 
deprecating it.  Any of the possible use cases can be served in other ways like 
the wrapt package or by explicit code in __getattribute__.

--
nosy: +lukasz.langa, pablogsal

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-11-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Also see:  https://bugs.python.org/issue42073

The classmethod pass through broke some existing code and the "fix" for it 
looks dubious:

if hasattr(type(self.f), '__get__'):
return self.f.__get__(cls, cls)

--

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-12 Thread STINNER Victor


Change by STINNER Victor :


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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-12 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9d3271438431c37c29c359f5b73e8094b5f82912 by Victor Stinner in 
branch 'main':
bpo-45745: Remove regrtest --findleaks options (GH-29514)
https://github.com/python/cpython/commit/9d3271438431c37c29c359f5b73e8094b5f82912


--

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-10 Thread STINNER Victor


STINNER Victor  added the comment:

To check for reference leaks, memory leaks and file descriptor leaks: 
--huntrleaks/-R should be used.

--

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-10 Thread STINNER Victor


STINNER Victor  added the comment:

In Python 3.6, regrtest failed if --findleaks was used and gc.garbage was not 
empty after a test completed.

I modified regrtest to always run this check: --findleaks is now ignored.

But I also modified --findleaks to make it an alias to the --fail-env-changed 
option: non-zero exit code if a test fails with "ENV CHANGED" status.

I wrote PR 29514 to clarify the situation: remove --findleaks :-)

--

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-10 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-09 Thread Irit Katriel


Irit Katriel  added the comment:

That's probably why --findleaks was deprecated (in 3.8, PR12951).  We could 
remove it now. 

+ vstinner

--
nosy: +iritkatriel, vstinner

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-08 Thread Skip Montanaro


Skip Montanaro  added the comment:

Thanks, I get that. My issue is with the apparent mismatch between the English 
meaning of "find leaks" and "fail env changed." It seems to me that the help 
message(s) for one or both of those options is probably incorrect and needs to 
be changed.

--

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-07 Thread Éric Araujo

Éric Araujo  added the comment:

I think that second PR was linked using the GitHub PR link field present in the 
bug comment form.

--

___
Python tracker 

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

PR-29419 solves the issue in #45717 of not giving a link for _* modules with no 
doc.  It does not solve this issue of giving the proper link for module that 
need non-standard links, which typically need a '#' suffix, as in 
'.../library/2to3.html#module-lib2to3'.  I suggest to continue calculating 
standard links as done now as the precalculation needs much space for a trivial 
time saving.  Restrict the new dict to non-standard links.  They can be 
calculated, with the needed suffixes, as they are now for the index.  The link 
logic would be to try the lookup first and if module name does not start with 
'_', calculate the link.

I will add an idlelib section to idle.rst so that 'idlelib' appears in the 
module index and get entered into the exceptions dict.

I don't see how PR-29459 get linked here as it has no reference to this issue.  
So I will ignore it at least for know.

--
stage: patch review -> test needed

___
Python tracker 

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-07 Thread Zachary Ware


Change by Zachary Ware :


--
pull_requests: +27713
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/29459

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-07 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

IIUC you're looking for --huntrleaks/-R, not the unrelated --findleaks/-l:

In that -m test -h menu:

  -l, --findleaks   deprecated alias to --fail-env-changed

  -R RUNCOUNTS, --huntrleaks RUNCOUNTS
search for reference leaks (needs debug build, very 
slow). See the section at bottom
for more details.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-07 Thread Skip Montanaro


New submission from Skip Montanaro :

Just preparing to make a refleaks test run, so I ran:

./python -m test --help

The output related to refleaks seemed suspicious:

...
Special runs:
  -l, --findleaks   deprecated alias to --fail-env-changed
...
  --fail-env-changedif a test file alters the environment, mark the test as 
failed

It's not obvious that "--fail-env-changed" has anything to do with 
"--findleaks". Does the -l/--findleaks message need to be corrected?

--
components: Build
messages: 405916
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: ./python -m test --help output for refleaks seems wrong
versions: Python 3.11

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-05 Thread Zachary Ware


Zachary Ware  added the comment:

This actually turned out to be less effort than I expected (though I still 
should have been asleep 2 hours ago), so I've gone ahead and opened GH-29419 to 
implement what I suggested.

--
stage: patch review -> test needed

___
Python tracker 

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-05 Thread Zachary Ware


Change by Zachary Ware :


--
keywords: +patch
pull_requests: +27672
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/29419

___
Python tracker 

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-04 Thread Joshua


Joshua  added the comment:

I think that option 4 would work best but instead of putting any logic in 
(Lib/pydoc_data/topics.py)[https://github.com/python/cpython/blob/main/Lib/pydoc_data/topics.py]
 we could put the logic for working with private modules as well and other edge 
cases in 
(Lib/pydoc.py)[https://github.com/python/cpython/blob/main/Lib/pydoc.py]. It 
might make future changes easier.

--
nosy: +Joshuah143

___
Python tracker 

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



[issue45717] Bad link to python docs in help(_hashlib)

2021-11-04 Thread Zachary Ware


Zachary Ware  added the comment:

I'm closing this as a duplicate of bpo-40051, as it's basically another 
manifestation of that issue.

However, any module named with a leading underscore is a private module, and 
won't have documentation.

The source for _hashlib can be found in Modules/_hashopenssl.c.

--
nosy: +zach.ware
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Give proper link in 
help(idlelib/turtledemo/tkinter.sub/test_*/?)

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-04 Thread Zachary Ware


Zachary Ware  added the comment:

Option 4: generate a list of modules (or a mapping of module names to 
documentation files) that have documentation when generating 
Lib/pydoc_data/topics.py, and teach pydoc.help to not include the link when it 
knows the module doesn't have documentation.

This is a much more complete solution that also avoids creating links for 
private modules (see bpo-45717), but is significantly more effort to implement.

--
nosy: +zach.ware

___
Python tracker 

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



[issue45717] Bad link to python docs in help(_hashlib)

2021-11-04 Thread Joshua


New submission from Joshua :

I was attempting to look through hashlib to try and understand more about 
python's built-in hash functions. As part of this, I ran 'help(_hashlib)' which 
returns this text: 'MODULE REFERENCE
https://docs.python.org/3.11/library/_hashlib.html'

This is an invalid link which has been an issue in all versions of the 
documentation I looked up.

As an aside, where would I find the source for _hashlib?

--
components: Library (Lib)
messages: 405744
nosy: Joshuah143
priority: normal
severity: normal
status: open
title: Bad link to python docs in help(_hashlib)
type: enhancement
versions: Python 3.11

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Graham Dumpleton


Graham Dumpleton  added the comment:

Too much to grok right now.

There is already a convention for what a decorator wraps. It is __wrapped__.

https://github.com/python/cpython/blob/3405792b024e9c6b70c0d2355c55a23ac84e1e67/Lib/functools.py#L70

Don't use __func__ as that has other defined meaning in Python related to bound 
methods and possibly other things as well and overloading on that will break 
other stuff.

In part I suspect a lot of the problems here are because things like 
classmethod and functools style decorators are not proper transparent object 
proxies, which is the point of what the wrapt package was trying to solve so 
that accessing stuff on the wrapper behaves as much as possible as if it was 
done on what was wrapped, including things like isinstance checks.

--

___
Python tracker 

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread wim glenn


wim glenn  added the comment:

added Graham Dumpleton to nosy list in case he has some useful insight here, I 
think the PR from issue19072 may have been adapted from grahamd's patch 
originally?

--
nosy: +grahamd

___
Python tracker 

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I've looked more into it, the issue is that even before an object can be tested 
with `isinstance()`, both inspect.classify_class_attrs and in pydoc, classdoc 
local function `spill()` use a `getattr()` call, which triggers the property.

So I think my PR is going in the right direction, adding guards in the inspect 
function and in two `spill()` functions. If `isinstance()` can be fixed to 
detect class properties correctly, these guards can be simplified but they 
still need to be there, I think.

--

___
Python tracker 

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I missed that this is assigned to Raymond, hope we didn't duplicate any effort 
(it only took me a short while to do the PR). Apologies..

--

___
Python tracker 

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I've put up a PR; I'm not sure it's the best way to fix it. I will look more 
into it and will try to post some details about the PR later today.

--

___
Python tracker 

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-27 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
nosy: +andrei.avk
nosy_count: 8.0 -> 9.0
pull_requests: +27502
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/29239

___
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-10-25 Thread paul j3


paul j3  added the comment:

Are you expecting the subcommand help to show the 'help' line that the main 
help shows?

subparsers.add_parser('a', help='a help')

add_parser takes all of the parameters that `ArgumentParser` takes, including 
description and epilog.  

I don't think we need to add anything to add_parser.

--
nosy: +paul.j3

___
Python tracker 
<https://bugs.python.org/issue45275>
___
___
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-10-24 Thread Hai Shi


Hai Shi  added the comment:

Hi, Chuanlong. Would you mind to upload a demo for this question?

--
nosy: +shihai1991

___
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-10-23 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

For me it works as well, tested on 3.7, 3.9 and 3.11 .

--
nosy: +andrei.avk

___
Python tracker 

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-10-22 Thread Éric Araujo

Éric Araujo  added the comment:

Option 3 seems simple and ok to me.

--
nosy: +eric.araujo

___
Python tracker 

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



<    1   2   3   4   5   6   7   8   9   10   >