[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



[issue44136] Remove pathlib flavours

2021-12-31 Thread Barney Gale


Change by Barney Gale :


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

___
Python tracker 

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



[issue44136] Remove pathlib flavours

2021-12-31 Thread Barney Gale


Change by Barney Gale :


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

___
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



[issue46218] Change long_pow() to sliding window algorithm

2021-12-31 Thread Tim Peters


Change by Tim Peters :


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

___
Python tracker 

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



[issue40236] datetime.datetime.strptime get day error

2021-12-31 Thread Andrei Kulakov


Change by Andrei Kulakov :


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

___
Python tracker 

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



[issue40236] datetime.datetime.strptime get day error

2021-12-31 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

> I am open to discussion about trying to rationalize this behavior - it would 
> be a bit tricky but if we moved to our own implementation of the algorithm to 
> calculate %W we could detect this situation and throw an exception.

Paul: 

I'm guessing here but I think the design makes sense from a certain angle: 
consider that 0-th week is the first partial week of the year. For some date 
calculations you might want to go forward, and for others you may go back. If 
you're going back, it's easier to keep the year and the week the same and 
reference other days within that week, rather than decrementing the year and 
changing to 12th month.

This leaves the odd case of there being no partial week. Logically 0th week 
could refer to the last week of previous year, but that feels wrong because 
you're referring to it as a week of e.g. 2024 when all of its days are in 2023, 
so it's entirely a 2023 week.

So a precise definition would be to say that 0-th week is always the first week 
of the year, whether partial or full; while 1-th week is always the first full 
week. It follows from this definition that sometimes 0-th and 1-th are the same 
week.

I'll make a test PR to check if that's how time.strptime behaves on all 
platforms.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue46095] Improve SeqIter documentation

2021-12-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue46213] webbrowser.open doesn't work in Termux

2021-12-31 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I think the existence of sys.getandroidapilevel is evidence that Android is 
somewhat supported, even if it is not supported to the same degree that Linux 
and Windows are.

https://docs.python.org/3/library/sys.html#sys.getandroidapilevel

See also:

https://mail.python.org/pipermail/python-dev/2017-December/151171.html

for a longer discussion. There's an Android build factory

https://github.com/python/buildmaster-config/pull/26

but I cannot see an official Android buildbot running.

https://buildbot.python.org/all/#/

The PR seems straightforward and simple to me, but I'm not an expert on the 
webbrowser module nor do I have an Android where I can test it to see if it 
works.

DonaldDuck1313, your NEWS entry needs to be re-written to use ReST 
(Restructured Text) rather than Markdown:

Change: [Termux](https://termux.com/)

to `Termux `_

--
nosy: +steven.daprano, xdegaye
type:  -> enhancement

___
Python tracker 

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



[issue46218] Change long_pow() to sliding window algorithm

2021-12-31 Thread Tim Peters


New submission from Tim Peters :

As discussed on python-dev, it would be nice to break long_pow()'s reliance on 
that the number of bits in a CPython long "digit" is a multiple of 5.

Moving to the sliding-window algorithm would do that (it has to be able to 
cross digit boundaries to fill the current window), and would be better on some 
other counts too: the precomputed table can be half the size (or we can add an 
extra bit to the window for the same table size), and it can - depending on 
exponent bit patterns - sometimes reduce the number of multiplies needed too.

So I intend to do that, and bump the window size from 5 to 6 (which would yield 
a significant, although modest, speed improvement for giant-exponent cases).

--
assignee: tim.peters
components: Interpreter Core
messages: 409446
nosy: tim.peters
priority: normal
severity: normal
stage: needs patch
status: open
title: Change long_pow() to sliding window algorithm
type: performance
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



[issue24132] Direct sub-classing of pathlib.Path

2021-12-31 Thread Éric Araujo

Change by Éric Araujo :


--
versions: +Python 3.11 -Python 3.10

___
Python tracker 

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



[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2021-12-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue46217] 3.11 build failure on Win10: new _freeze_module changes?

2021-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue46217] 3.11 build failure on Win10: new _freeze_module changes?

2021-12-31 Thread Terry J. Reedy


New submission from Terry J. Reedy :

Installed 3.11.0a3 was built Dec  8 2021, 22:56:33.  My corresponding 
repository build is a bit older than that.  Rebuilding now I get
  fileutils.c
..\Python\fileutils.c(2132): error C2065: 'PATHCCH_FORCE_ENABLE_LONG_NAME_PROCE
SS': undeclared identifier [f:\dev\3x\PCbuild\_freeze_module.vcxproj]

I have likely seen this before today but mistook the error message for a 
warning and did not check the respository build date.  3.9 and 3.10 just update 
normally, so unique to 3.11 and apparently new freeze changes.

--
components: Build
messages: 409445
nosy: terry.reedy
priority: normal
severity: normal
status: open
title: 3.11 build failure on Win10: new _freeze_module changes?
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



[issue46197] ensurepip bootstrap breaks out of isolated environment

2021-12-31 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



[issue46198] Duplicated test name `test_get_unstructured_invalid_ew` in `test__header_value_parser.py`

2021-12-31 Thread Éric Araujo

Éric Araujo  added the comment:

Sometimes people fix small things in multiple modules, sometimes they create 
separate tickets to have one patch per module with reviews from different 
maintainers and so on.  For this case, I check pyflakes and found a handful of 
true positives, so I would retitle the ticket to be about duplicate methods in 
tests.

--
Added file: https://bugs.python.org/file50534/duplicate-test-methods.diff

___
Python tracker 

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



[issue45670] New .mapping attribute is broken for some existing uses of dict views

2021-12-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

To the list of four options I suggested for bidict, you can add one more.  
Create a feature request for a C implementation of collections.abc.KeyView. 
ISTM that your core issue is that bidict won't use the intended and guaranteed 
solution because the KeysView ABC is thought to be too slow (you should test 
this -- the `yield from self._mapping` code is very fast).


> .mapping attribute in Python 3.10+ now leaking internal state.

We do not agree on this essential point.  The "leak", as in "all abstractions 
are leaky", is in the bidict code, not in the dict_keys code.  The .mapping 
attribute itself is accurately refers to its underlying mapping.

This is consistent with how other wrappers provide a __wrapped__ attribute (or 
__fget__, __func__, func, maps, etc).  If some class ever uses an lru_cache, 
cache, property, boundmethod, partial object, or chainmap, then it is possible 
for the user to unwrap one level of abstraction.


> Now suppose a new .mapping attribute were added to dict_keyiterator objects 
> in a future version of Python

We don't do that for iterator objects.  If we did, then ChainMap would have the 
same options as bidict has.  Most likely, we would leave it as an undocumented, 
non-guaranteed implementation detail (much like random.randrange is a bound 
method with a __func__ attribute rather than an actual function).

If we thought users really cared about the exact object returned and its full 
API, then we would have several options:
1) Document that that aspect of the API is non-guaranteed,
2) Document that that aspect is guaranteed.  This would lock in our design 
choice forever, but all allow users the opportunity to exploit the new 
capability.
3) Wrap the iterator to hide parts of the API we don't want to expose.  For 
example, return `chain(d)` instead of `iter(d)`.


> I even have the passing property-based tests to prove it

That tests an invented property that isn't true and wasn't ever intended to be 
true: "The API of the concrete dict_keys type is the same as the API of 
KeysView ABC".  The correct property is: "The API of the concrete dict_keys 
type implements the KeysView ABC but may do other things as well". This is the 
common and normal relationship between ABCs and concrete classes.  It is no 
more surprising that Mapping not supporting __or__ while dict does.


> I also have counterpoints for your other feedback,

I fear that we have an asymmetry of time available to explore every possible 
nuance including the counterfactual you gave in the last post.  Doing so eats 
heavily into my limited time available for development.

I don't think there is more that can be done here.  We already have an official 
and supported API for your purpose. The dict_keys concrete API is unlikely to 
ever be built-out as a general purpose optimization of the KeysView ABC (that 
violates a number of design principles regarding separation of concerns, tight 
coupling, premature optimization, and the proper relationship between concrete 
and abstract classes).

Please consider using one of the four options (now up to five) that I suggested 
previously.

--

___
Python tracker 

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



[issue46216] spurious link to os.system() from os.times() documentation entry

2021-12-31 Thread Emery Berger


New submission from Emery Berger :

This is a minor documentation nit.

Under the entry for `os.times()`, there is a description of the various fields 
it returns (e.g., `user`, `system`).

```os.times()
Returns the current global process times. The return value is an object with 
five attributes:

user - user time

system - system time
```

For the latter, the word `system` is hyperlinked to the `os.system()` entry. 
This probably goes without saying, but there's no logical relationship of 
system time (time spent in the kernel on behalf of the process) to the system 
command (which invokes a command via a shell), so the link should be removed.

--
assignee: docs@python
components: Documentation
messages: 409442
nosy: docs@python, emery.berger
priority: normal
severity: normal
status: open
title: spurious link to os.system() from os.times() documentation entry
versions: Python 3.10, Python 3.11, Python 3.6, 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



[issue46206] Crash when editing emoji containing strings

2021-12-31 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Example:

>>> ___
  File "", line 1
___
   ^
SyntaxError: invalid character '' (U+1F600)
>>> __
  File "", line 1
__
  ^
SyntaxError: invalid character '' (U+1F600)

--

___
Python tracker 

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



[issue46206] Crash when editing emoji containing strings

2021-12-31 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue46206] Crash when editing emoji containing strings

2021-12-31 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This seems to be fixed on the main branch (at least I cannot reproduce it in 
the main branch). If so, this means that will be fixed in Python 3.10.2.

10maurycy10, could you please confirm that this is indeed the case?

--

___
Python tracker 

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



[issue46198] Duplicated test name `test_get_unstructured_invalid_ew` in `test__header_value_parser.py`

2021-12-31 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Eric, should I patch this as well in this issue? 
Or should I open a new one? Would be happy to fix it :)

--

___
Python tracker 

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



[issue46213] webbrowser.open doesn't work in Termux

2021-12-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

https://termux.com/ "Termux is an Android terminal emulator [on Android] and 
Linux environment app"

I don't believe that core devs (and b.p.o.) support running Python on Android.  
If so, this should be closed here and your question redirected to whoever 
supplied your Android python installer.  They might just say that Termux is not 
a supported terminal.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue46206] Crash when editing emoji containing strings

2021-12-31 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

On Win10 command prompt,  is initially displayed as 2 boxes, subsequently as 
box-space.  Besides this, editing works fine and when Entered, the string is 
echoed.

--
nosy: +pablogsal, terry.reedy

___
Python tracker 

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



[issue46181] Destroying an expaned Combobox prevents Entry focus until Alt+Tab

2021-12-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Win10, Py 3.11: run combobug.py, click down arrow, click entry.  'changed' is 
printed to stdout (console or IDLE Shell).
Cursor not visible and clicking on remaining entry box does nothing.
Click on another window and back to entry box.
Cursor is present in box and clicking keys enters characters.

I am not sure is this is tkinter bug or tk 8.6.12 bug or program bug.
On Windows, .focus_force is often needed to get focus properly.
I may be seeing same thing with IDLE entry boxes, but have not investigated 
thoroughly yet.

--
nosy: +epaine, serhiy.storchaka, terry.reedy

___
Python tracker 

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



[issue46180] Button clicked failed when mouse hover tooltip and tooltip destroyed

2021-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +serhiy.storchaka
stage:  -> test needed
type: crash -> behavior
versions: +Python 3.11 -Python 3.8

___
Python tracker 

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



[issue46177] can't install launcher for all users

2021-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue46177] can't install launcher for all users

2021-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


Removed file: https://bugs.python.org/file50521/Annotation 2021-12-25 165843.png

___
Python tracker 

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



[issue25478] Consider adding a normalize() method to collections.Counter()

2021-12-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Withdrawing the suggestions for scaled_to() and scaled_by().  Am thinking that 
people are mostly better off with a dict comprehension where they can control 
the details of rounding and type conversions.

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue46215] Wrong error line after using pdb

2021-12-31 Thread beda pišl

New submission from beda pišl :

Consider simple script:
```
for i in range(1):
import pdb
pdb.set_trace()

x = y + z
```
After running it and pressing 'c' to continue:

```
test$ python test.py
> /Users/bedrich.pisl/test/test.py(1)()
-> for i in range(1):
(Pdb) c
```
I get error, but with wrong error line
```
Traceback (most recent call last):
  File "/Users/bedrich.pisl/test/test.py", line 1, in 
for i in range(1):
NameError: name 'y' is not defined
```
The error is actually on line 5 not 1.

--
components: Library (Lib)
messages: 409434
nosy: bedapisl
priority: normal
severity: normal
status: open
title: Wrong error line after using pdb
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue46199] Calculation influenced by print

2021-12-31 Thread Mark Dickinson


Mark Dickinson  added the comment:

When you do:

FINUB = np.empty(len(close))
FINLB = np.empty(len(close))

you're creating two *uninitialised* arrays of values. (See the NumPy 
documentation at 
https://numpy.org/doc/stable/reference/generated/numpy.empty.html.)

When you then do 

FINUB[i] = UB[i] if UB[i] < FINUB[i-1] \
and close[i-1] > FINUB[i] else FINUB[i-1]

on the first iteration of the loop (i = 1), you make use of the (undefined) 
value in FINUB[0] to compute FINUB[1].

In other words, this is a bug in your code, rather than in Python or NumPy.

--
nosy: +mark.dickinson
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue46197] ensurepip bootstrap breaks out of isolated environment

2021-12-31 Thread Ned Deily


Change by Ned Deily :


--
nosy: +dstufft, ncoghlan, pradyunsg

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2021-12-31 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset 0b58bac3e7877d722bdbd3c38913dba2cb212f13 by Mark Dickinson in 
branch 'main':
bpo-37295: More direct computation of power-of-two factor in math.comb 
(GH-30313)
https://github.com/python/cpython/commit/0b58bac3e7877d722bdbd3c38913dba2cb212f13


--

___
Python tracker 

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



[issue45670] New .mapping attribute is broken for some existing uses of dict views

2021-12-31 Thread Joshua Bronson

Joshua Bronson  added the comment:

Dear Raymond,

Thanks so much for the detailed response!

I wonder if you could explain how this case is different from the following:

>>> c = collections.ChainMap({1: 1}, {1: 2})
>>> iter(c)

>>> isinstance(c, dict)  # it's fine, we <3 duck typing!
False


Now suppose a new .mapping attribute were added to dict_keyiterator objects in 
a future version of Python, like the one that was added to dict view objects in 
Python 3.10. Then, wouldn't ChainMap find itself in a similar predicament as 
this issue is raising?

>>> iter(c).mapping
mappingproxy({1: None})


As in my example above, the {1: None} mapping here is an implementation detail 
of ChainMap.__iter__() that was never intended to be leaked to users. (Ref: 
)

Note also that ChainMap.__iter__() returns a dict_keyiterator object even 
though issubclass(ChainMap, dict) is False. We consider this just fine though, 
because the dict_keyiterator object currently behaves exactly like the 
generator object we would get if the code had done a `yield from d` rather than 
a `return iter(d)`. Except for being faster.

This parallels the implementations of bidict.keys()/values()/items(), which 
currently return dict_keys/dict_values/dict_items objects generated from 
internal data, that behave exactly like KeysViews(b)/ValuesView(b)/ItemsView(b) 
would*, except for being faster. And, as this issue is raising, except for this 
new .mapping attribute in Python 3.10+ now leaking internal state.

* I even have the passing property-based tests to prove it: 

 :)


(I also have counterpoints for your other feedback, but wanted to post this 
part first. And sorry for my delay in responding – hope it's not too late! And 
finally thanks so much again for considering this and for the time you took to 
give feedback on bidict – there's literally no better-qualified person in the 
world. I so appreciate it!)

--

___
Python tracker 

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



[issue46198] Duplicated test name `test_get_unstructured_invalid_ew` in `test__header_value_parser.py`

2021-12-31 Thread Éric Araujo

Éric Araujo  added the comment:

Also fund a duplicate TestHelpers class in test_enum.

A warning for duplicate method is a false positive, because the two methods are 
used on different python versions.  But the first method uses `self.Grades.B` 
wrongly (should be `Grades.B`) so it will break when python 3.12 is started!

--
nosy: +eric.araujo

___
Python tracker 

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



[issue46196] documentation for cmd library should include columnize() function

2021-12-31 Thread Éric Araujo

Éric Araujo  added the comment:

The method is called from one place only, but the fact that it is its own 
method and has dedicated tests seems to indicate that it was meant as 
standalone piece of functionality.  We can’t be sure of original intent given 
that no method in the class uses the `_` prefix naming convention, but I think 
it’s fine to document the function and so make it officially public now.

--
nosy: +eric.araujo
type:  -> enhancement

___
Python tracker 

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



[issue46204] Graphlib documentation (general cleanup)

2021-12-31 Thread Éric Araujo

Éric Araujo  added the comment:

Could you say a little more about this?  Precisely: what are the problems you 
identified?

--
nosy: +eric.araujo

___
Python tracker 

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



[issue46187] Optionally support rounding for math.isqrt()

2021-12-31 Thread Tim Peters


Tim Peters  added the comment:

The name "isqrtrem" works fine for me too, and, indeed, is even more 
reminiscent of mpz's workalike function.

> the number of times I've needed rounded integer square root
> is small compared with the number of times I've needed rounded
> integer division

Speaking of which, the analogy to divmod extends just beyond the lack of an 
underscore in the name ;-) divmod() allows easy emulation of any division 
rounding mode, and an instant answer to "was the division exact?". isqrtrem() 
would support the same for square roots.

--

___
Python tracker 

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



[issue46187] Optionally support rounding for math.isqrt()

2021-12-31 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Mark didn't mention his use case for rounded isqrt

Mainly for emulation of floating-point sqrt. But the number of times I've 
needed rounded integer square root is small compared with the number of times 
I've needed rounded integer division.

--

___
Python tracker 

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



[issue46187] Optionally support rounding for math.isqrt()

2021-12-31 Thread Mark Dickinson


Mark Dickinson  added the comment:

A new function isqrt_rem seems like a reasonably natural addition. (Though I'd 
call it "isqrtrem", partly by analogy with "divmod", and partly because the 
math module isn't very good at doing underscores.)

--

___
Python tracker 

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



[issue46214] Remove unused opcode ROT_FOUR

2021-12-31 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46214] Remove unused opcode ROT_FOUR

2021-12-31 Thread Irit Katriel


Change by Irit Katriel :


--
assignee: iritkatriel
components: Interpreter Core
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Remove unused opcode ROT_FOUR
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



[issue46171] venv module produces spurious warning that location has moved

2021-12-31 Thread Eryk Sun


Eryk Sun  added the comment:

> My VHDX mounted in a directory is affected by this

I created a VHDX and mounted it in a directory. It's just a regular volume 
mount point with a junction (IO_REPARSE_TAG_MOUNT_POINT). That won't cause any 
problems, so I guess your setup must be different in some way.

> I suspect (but haven't tested) that some file sharing handlers or 
> attached devices could also hit it - thinking here of IoT devices
> that provide a filesystem-like interface.

My takeaway is that because filesystem filter drivers on some systems may 
arbitrarily redirect some paths in some cases, and redirect differently or not 
at all in some other context, then we need to always log a warning showing the 
real path and always embed the real path in pip.exe. The only clear example we 
have is bpo-45337, but we're erring on the side of caution instead of targeting 
the warning at the one known case. The generic approach happens to also include 
any common use of directory symbolic links or junctions, but it's not practical 
to handle them differently. You're open to special casing short DOS names, 
however, e.g. by comparing the real path to the long path name from 
GetLongPathNameW().

Note that if the user continues to use the path with a reparse point or 
redirection to access the virtual environment (if possible; it's not for 
bpo-45337), then running `python -m pip` will install scripts or executable 
script wrappers that refer to the accessed path, not the real path. pip uses 
distlib for entrypoint scripts. Apparently distlib doesn't resolve the real 
path of sys.executable when creating the script shebang.

For POSIX, including macOS, I don't know the range of possibilities for 
dependent filesystem redirection. Bind mounts (i.e. mounting an arbitrary path 
on a directory) can be an issue since they're temporary unless configured in 
/etc/fstab. However, we can't do anything to warn about them because POSIX 
realpath() doesn't resolve them.

> warning that can be explained in exactly the same way on every platform

I guess you mean every edition of Windows.

--

___
Python tracker 

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



[issue46187] Optionally support rounding for math.isqrt()

2021-12-31 Thread Tim Peters


Tim Peters  added the comment:

Suppose we added isqrt_rem(n), returning the integer pair (i, rem) such that

n == i**2 + rem
0 <= rem <= 2*i

Then:

- Want the floor of sqrt(n)? i.
- The ceiling? i + (rem != 0).
- Rounded? i + (rem > i).
- Is n a perfect square? not rem.

That's how mpz addresses these, although it has a different function to compute 
the floor without returning the remainder too.

I wouldn't object to that - just +0, though. Depending on implementation 
details, which I haven't investigated, it may or may not be materially faster 
than doing:

def isqrt_rem(n):
return (i := isqrt(n)), n - i*i

myself.

--

___
Python tracker 

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



[issue46213] webbrowser.open doesn't work in Termux

2021-12-31 Thread DonaldDuck313


New submission from DonaldDuck313 :

In Termux, if I type the following code, I would expect it to open the URL in a 
browser, but it does nothing:

import webbrowser
webbrowser.open("http://example.com;)

--
components: Library (Lib)
messages: 409422
nosy: DonaldDuck1313
priority: normal
pull_requests: 28530
severity: normal
status: open
title: webbrowser.open doesn't work in Termux
versions: Python 3.10

___
Python tracker 

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



[issue46192] Optimize builtin functions min() and max()

2021-12-31 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Kind of like what's mentioned at 
https://github.com/faster-cpython/ideas/discussions/131 , it may be interesting 
to explore implementing min()/max() in Pure python, considering recent 
specializations to COMPARE_OP, and potential future specializations of FOR_ITER.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue46171] venv module produces spurious warning that location has moved

2021-12-31 Thread Steve Dower


Steve Dower  added the comment:

My VHDX mounted in a directory is affected by this, and actually broke a couple 
of tools until I also mounted it as a drive. (Using a VHDX helps bypass a lot 
of filesystem related perf impacts on Windows, so it's worth the occasional 
broken tool.)

I suspect (but haven't tested) that some file sharing handlers or attached 
devices could also hit it - thinking here of IoT devices that provide a 
filesystem-like interface.

Either way, I don't think the warning is spurious, and while it's not 
particularly helpful for people who pass in 8.3 names that are then expanded 
(it shouldn't ever happen the other way), that's easily fixed on the user's 
side. (And tempfile, which clearly needs fixing.)

I'm also *strongly against* warnings/errors that only occur based on a decision 
you made ages ago (or that someone else made for you), such as how you 
installed Python. Right now we have a warning that can be explained in exactly 
the same way on every platform and every circumstance, but Eryk's 
proposal/preference would suddenly make the case for the warning way too 
complex. Tutorials and teachers don't get to ignore it just because it only 
happens to some of their readers/students, and so we only make things worse for 
them by making it harder to understand. Better to have a simple, consistent 
message in this case.

--

___
Python tracker 

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



[issue46109] Separate resources docs from other importlib docs

2021-12-31 Thread Jason R. Coombs


Change by Jason R. Coombs :


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



[issue46208] os.path.normpath change between 3.11.0a2 and 3.11.0a3+

2021-12-31 Thread Steve Dower


Steve Dower  added the comment:

Yep, it's a bug and should be fixed.

I'm still not back coding yet, but I'll get to it once I am if nobody else gets 
there first. This is going to affect getpath.py in the native implementation, 
so it ought to be fixed there (and we need tests for this case, since it's 
apparently a gap).

--
priority: normal -> release blocker

___
Python tracker 

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



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

2021-12-31 Thread Arie Bovenberg


Arie Bovenberg  added the comment:

Absolutely agree! In practice I find some people are not swayed by this 
argument -- and prefer the readability of f-strings. 

My expectation is that a clear recommendation in the official docs will 
convince more people. Especially if there are security concerns.

Do you have an opinion on the 3 questions I highlighted?

--

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2021-12-31 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I'd be happy to change the implementation to use the trailing zero counts as 
> suggested.

Done in GH-30313 (though this will conflict with Serhiy's PR).

--

___
Python tracker 

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



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

2021-12-31 Thread Vinay Sajip


Vinay Sajip  added the comment:

Another (minor) point against using f-strings or .format is that formatting 
prematurely might be doing unnecessary work - by default, logging formats 
messages lazily, waiting until a message actually needs to be output. This 
could perhaps be more prominently emphasized in the docs where formatting is 
first introduced.

--

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2021-12-31 Thread Mark Dickinson


Change by Mark Dickinson :


--
pull_requests: +28529
pull_request: https://github.com/python/cpython/pull/30313

___
Python tracker 

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



[issue45569] Drop support for 15-bit PyLong digits?

2021-12-31 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I've created PR GH-30306 to find out.

Results: we have two Gentoo/x86 buildbots, and a 32-bit Windows build in GitHub 
Actions: those machines use 15-bit digits, as a result of the logic in pyport.h 
that chooses 15-bit digits if SIZEOF_VOID_P < 8. Everything else seems to be 
using 30-bit digits.

GPS pointed out in the python-dev discussion that the other platform we should 
be thinking about is 32-bit ARM.

--

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2021-12-31 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Note that _PyArg_UnpackKeywordsWithVararg is defined with PyAPI_FUNC. Changing 
its argument spec is strictly a backwards incompatible change, IIUC.

--
nosy: +BTaskaya

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2021-12-31 Thread colorfulappl


colorfulappl  added the comment:

I wrote some microbenchs.

Patch: 
https://github.com/python/cpython/pull/30312/commits/b68176d081e19a3cedbaf2cdb31ecd7690421ec8

Environment:
macOS 12.1
clang 13.0.0
configure with --enable-optimizations

Result on microbench:

```
++-++
| Benchmark  | ./opt_baseline/res.json | 
./opt_patched/res.json |
++=++
| print(a, b, c) | 917 ns  | 820 
ns: 1.12x faster   |
++-++
| print(a, b, c, *v) | 1.56 us | 1.62 
us: 1.04x slower  |
++-++
| print(a, sep='', file=stdout)  | 376 ns  | 295 
ns: 1.27x faster   |
++-++
| print(*v, sep='', flush=True, file=stdout) | 2.02 us | 1.94 
us: 1.04x faster  |
++-++
| Geometric mean | (ref)   | 1.05x 
faster   |
++-++

Benchmark hidden because not significant (3): print(a), print(a, sep='', 
flush=True, file=stdout), print(a, b, c, *v, sep='', flush=True, file=stdout)
```

--
Added file: https://bugs.python.org/file50533/bench-print.py

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2021-12-31 Thread colorfulappl


Change by colorfulappl :


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

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2021-12-31 Thread colorfulappl


New submission from colorfulappl :

When "Augument Clinic generated code" are parsing arguments, the args are 
packed to a tuple before passing to callee. This may be unnecessary.

Pass a raw pointer which points to on-stack varargs, and a varargssize integer 
to indicate how many varargs are passed, can save the time of tuple 
creation/destruction and value copy.

--
components: Argument Clinic
messages: 409412
nosy: colorfulappl, erlendaasland, larry
priority: normal
severity: normal
status: open
title: Avoid temporary `varargs` tuple creation in argument passing
type: performance
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



[issue45321] Module xml.parsers.expat.errors misses error code constants of libexpat >=2.0

2021-12-31 Thread Stefan Behnel


Change by Stefan Behnel :


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



[issue45321] Module xml.parsers.expat.errors misses error code constants of libexpat >=2.0

2021-12-31 Thread Stefan Behnel


Stefan Behnel  added the comment:


New changeset e18d81569fa0564f3bc7bcfd2fce26ec91ba0a6e by Sebastian Pipping in 
branch 'main':
bpo-45321: Add missing error codes to module `xml.parsers.expat.errors` 
(GH-30188)
https://github.com/python/cpython/commit/e18d81569fa0564f3bc7bcfd2fce26ec91ba0a6e


--

___
Python tracker 

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



[issue24301] gzip module failing to decompress valid compressed file

2021-12-31 Thread Ruben Vorderman


Ruben Vorderman  added the comment:

ping

--

___
Python tracker 

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



[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2021-12-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This is a little closer to the current code.  Also it has a simpler and more 
universal url.


from urllib.request import urlopen
url = 'http://worldtimeapi.org/api/timezone/etc/UTC.txt'
with urlopen(url) as request:
for line in request:
line = line.decode('utf-8')
if line.startswith('datetime'):
print(line)

datetime: 2021-12-31T08:23:15.083004+00:00

--

___
Python tracker 

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