[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Sardorbek Imomaliev


New submission from Sardorbek Imomaliev :

Currently, in `bisect` examples `grade` function is declared with mutable 
default for `breakpoints` arugment. I suggest updating.

https://github.com/sweeneyde commented
> I would say that even though using mutable defaults is often undesirable, 
> there is no problem with it in this case: the body of the function does not 
> mutate the default. It's also probably faster than re-constructing a new list 
> at each function call. I would suggest opening an issue on 
> https://bugs.python.org/ if you want to discuss more.

I agree that in this case it wouldn't matter because `breakpoints` are not 
mutated, but most of the time people copy from examples and adapt the code to 
their needs without giving it a second thought. In my opinion, it is a good 
practice to provide examples as foolproof as possible.

--
assignee: docs@python
components: Documentation
messages: 409490
nosy: docs@python, imomaliev
priority: normal
pull_requests: 28548
severity: normal
status: open
title: doc: Fix bisect example using mutable function default
type: enhancement
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



[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Alex Waygood


Change by Alex Waygood :


--
keywords: +patch
stage:  -> patch review
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue45615] Missing test for type of error when printing traceback for non-exception

2022-01-02 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset a82baed0e9e61c0d8dc5c12fc08de7fc172c1a38 by Irit Katriel in 
branch 'main':
bpo-45615: Add missing test for printing traceback for non-exception. Fix 
traceback.py (GH-30091)
https://github.com/python/cpython/commit/a82baed0e9e61c0d8dc5c12fc08de7fc172c1a38


--

___
Python tracker 

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



[issue45615] Missing test for type of error when printing traceback for non-exception

2022-01-02 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



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

2022-01-02 Thread László Attila Tóth

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

I don't think I'm adventurous as I try to use its public API. If something is 
public in the pythonic terms (no underscore before it), but undocumented, that 
can obviously mean two things: either the documentation is outdated or the API 
published something it shouldn't.

As I wrote in issue 46058 - which is the same issue as this because of the 
implementation in argparse.py - I tried to create a group hierarchy in a way 
that I can pass the responsibility of argument validation to the argument 
parser. I don't think the good practice is to reimplement the same behavior 
again and again in dozens of Python programs if it is something that could be 
handled in an argument parser. My original intent was to provide patch or 
patches fixing the issue but with the deprecation in issue 22047 this became 
pointless.

There were a few other opened issues indicating I'm not alone with this 
expectation.

--

___
Python tracker 

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



[issue45925] Upgrade macOS and Windows installers to use SQLite 3.37.1

2022-01-02 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

SQLite 3.37.1 appeared the day before New Years Eve. So let us wait until the 
end of January before upgrading the installers.

https://www.sqlite.org/releaselog/3_37_1.html

--
title: Upgrade macOS and Windows installers to use SQLite 3.37.0 -> Upgrade 
macOS and Windows installers to use SQLite 3.37.1

___
Python tracker 

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



[issue24905] Allow incremental I/O to blobs in sqlite3

2022-01-02 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FYI, I'm maintaining a rebased version on my fork:

https://github.com/erlend-aasland/cpython/tree/sqlite-blob

Here's the changes I've applied upon PR 271:

- Use Argument Clinic
- Convert to heap types
- Adopt new CPython C APIs (Py_NewRef, Py_Is*, new slice API, etc.)
- Lint code (PEP 7, use CPython idioms, normalise variable and helper namings)
- Lint docs
- Normalise error messages
- Refactor very large functions, apply simplifications, and remove unneeded code
- Expand test suite to increase code coverage

I don't think it is ready for inclusion yet; the test suite needs to be 
restructured, or maybe rewritten from scratch. Pr. now most of the tests 
maintain a single connection with a prepared database. IMO, it's a fragile 
design and it is hard to read, debug, and verify the test code. I'll see if I 
can get to it in a couple of weeks.

--

___
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

2022-01-02 Thread Arie Bovenberg


Arie Bovenberg  added the comment:

I've done some more digging, and have read the related issue bpo-30995.

There are IMHO two challenges that are worth tackling:
1. A great number[1] of developers do their own string formatting.
   This is sub-optimal for performance and - in rare cases - 
   leaves them potentially vulnerable to attack 
   (DoS through a string formatting attack).
   We cannot prohibit this without breaking backwards compatibility:
   
https://docs.python.org/3/howto/logging.html#using-arbitrary-objects-as-messages.
 
2. The logging cookbook has several mechanisms for new-style formatting, 
   but because these do not ship with the stdlib, 
   the vast majority[2] of programmers don't use them.

We can solve both issues with a new family of `Logger` methods.
The debug one shown below:

def debugf(self, msg: Literal[str], *args, exc_info=False, **kwargs):
"""
Log 'msg.format(*args, **kwargs)' with severity 'DEBUG'.

To pass exception information, use the keyword argument exc_info with
a true value, e.g.

logger.debugf("Houston, we have a {}", "thorny problem", exc_info=1)
"""
if self.isEnabledFor(DEBUG):
# `BraceMessage` from the logging cookbook.
self._log(DEBUG, BraceMessage(msg, args, kwargs), exc_info=exc_info)

Advantages of this approach:
- It's mostly the existing work of @vinay.sajip. It's Idiomatic and proven to 
work.
- No change to existing methods or loggers. Fully backwards compatible.
- Protection against string formatting attack at the type level (thanks to 
PEP675).
  Everyone with an IDE will get warned about unsafe use.
- Embed correct use of log formatting at type level.
- People will stop complaining about the `%`-style,
  now that there is an easy way to use new-style formatting in the stdlib. 

The disadvantage of course is an extra set of logging methods. However:
- An `f` suffix for string formatting operations is common (e.g. `printf`)
- It's visually similar to f-strings, thus straightforward to comprehend.
  Compare `debug(f"hello ...` and `debugf("hello ...`.
- It's explicit. The method logs _and_ formats.

Sources:
[1] On GitHub code search, `logger` gets 8M results. 
`logger` `format` gets almost 4M results, of which about half
are actually instances of logging `.format()` strings. 
f-strings are not even included in this search, and probably used
very frequently as well.
(https://github.com/search?l=Python&p=2&q=logger+format&type=Code)

[2] There are <1000 instances of `StyleAdapter`, `BraceMessage` in GitHub code 
search,
while `getLogger` gets almost 5M results.
(https://github.com/search?l=Python&q=bracemessage&type=Code)
(https://github.com/search?l=Python&q=styleadapter&type=Code)
(https://github.com/search?l=Python&q=getlogger&type=Code)

--
components: +Library (Lib)

___
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

2022-01-02 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue46225] f_lasti behaves differently for lambdas returned from loops

2022-01-02 Thread Ned Batchelder


New submission from Ned Batchelder :

Python 3.11.0a3 changed how f_lasti behaves when calling a function in some
situations.

This example shows returning a lambda from a function.  If the lambda is
returned in a loop, then frame.f_lasti is 0 when it is called.  If the lambda
is not in a loop, then f_lasti is -1, as is usual when calling a function.

This behavior first appeared in 3.11.0a3.

---< showit.py >--

import linecache, sys

def trace(frame, event, arg):
# The weird globals here is to avoid a NameError on shutdown...
if frame.f_code.co_filename == globals().get("__file__"):
if event != "line":
lineno = frame.f_lineno
lasti = f"lasti {frame.f_lasti}" if event == "call" else ""
line = linecache.getline(__file__, lineno).rstrip()
print("{} {} {:10}: {}".format(event[:4], lineno, lasti, line))
return trace

print(sys.version)
sys.settrace(trace)

def run1():
for i in range(1):
return lambda: i

def run2():
return lambda: 99

f = run1()
print(f())

f = run2()
print(f())
--

Here are 3.10, 3.11.0a2, 3.11.0a3, and the tip of 3.11.  The changing line is
marked with <:

$ python3.10 showit.py
3.10.1 (main, Dec 14 2021, 08:30:13) [Clang 12.0.0 (clang-1200.0.32.29)]
call 16 lasti -1  : def run1():
retu 18   : return lambda: i
call 18 lasti -1  : return lambda: i<
retu 18   : return lambda: i
0
call 20 lasti -1  : def run2():
retu 21   : return lambda: 99
call 21 lasti -1  : return lambda: 99
retu 21   : return lambda: 99
99

$ /usr/local/pyenv/pyenv/versions/3.11.0a2/bin/python3.11 showit.py
3.11.0a2 (main, Nov  6 2021, 07:16:30) [Clang 12.0.0 (clang-1200.0.32.29)]
call 16 lasti -1  : def run1():
retu 18   : return lambda: i
call 18 lasti -1  : return lambda: i<
retu 18   : return lambda: i
0
call 20 lasti -1  : def run2():
retu 21   : return lambda: 99
call 21 lasti -1  : return lambda: 99
retu 21   : return lambda: 99
99

$ /usr/local/pyenv/pyenv/versions/3.11.0a3/bin/python3.11 showit.py
3.11.0a3 (main, Dec  9 2021, 12:22:18) [Clang 12.0.0 (clang-1200.0.32.29)]
call 16 lasti -1  : def run1():
retu 18   : return lambda: i
call 18 lasti 0   : return lambda: i<
retu 18   : return lambda: i
0
call 20 lasti -1  : def run2():
retu 21   : return lambda: 99
call 21 lasti -1  : return lambda: 99
retu 21   : return lambda: 99
99

$ /usr/local/cpython/bin/python3 showit.py
3.11.0a3+ (heads/main:a82baed0e9, Jan  2 2022, 08:12:01) [Clang 12.0.0 
(clang-1200.0.32.29)]
call 16 lasti -1  : def run1():
retu 18   : return lambda: i
call 18 lasti 0   : return lambda: i<
retu 18   : return lambda: i
0
call 20 lasti -1  : def run2():
retu 21   : return lambda: 99
call 21 lasti -1  : return lambda: 99
retu 21   : return lambda: 99
99

--
keywords: 3.11regression
messages: 409496
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: f_lasti behaves differently for lambdas returned from loops
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



[issue46225] f_lasti behaves differently for lambdas returned from loops

2022-01-02 Thread Ned Batchelder


Ned Batchelder  added the comment:

Also, this only happens with a Python trace function.  With a C trace function, 
pPyFrameObject->f_frame->f_lasti is -1.

--

___
Python tracker 

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



[issue46219] except* assumes that an exception group is truthy

2022-01-02 Thread Vedran Čačić

Vedran Čačić  added the comment:

A long time ago, Python documentation used true and false as adjectives (as 
opposed to True and False, which are proper names for canonical true/false 
objects). I think it was BDFL's preference back then.

In the meantime, I suppose through JS's influence, Python documentation started 
to adopt ancient Perl terminology, where truhy and falsy were used as 
adjectives standing for what was previously known as true and false. I really 
don't like it, and I think English language is clear enough here (given the 
help of code font and capital letter) that we don't need to invent new words. 
Of course, it is up to the community to decide (and maybe the steering council 
might issue an opinion), but I'm telling you the history and my preference.

--
nosy: +veky

___
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

2022-01-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think there's definitely room for improvement here, and at face value I like 
the debugf() functions. __format__ style formatting solves a big problem for 
me: being able to provide format strings for timestamps.

One thing: I'd be careful about saying that delayed formatting is always a 
performance win. f-strings are so much faster, that if I'm reasonable sure a 
message is always going to get logged, I'll use an f-string. In my case, I 
never log any user-supplied data, although it's obviously a risk that should be 
warned against.

--

___
Python tracker 

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



[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Another option would be to use globals:

>>> BREAKPOINTS = [60, 70, 80, 90]
>>> GRADES = "FDCBA"
>>> def grade(score):
... i = bisect(BREAKPOINTS, score)
... return GRADES[i]
... 
>>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]
['F', 'A', 'C', 'C', 'B', 'A', 'A']

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Nikita Kniazev


Nikita Kniazev  added the comment:

> I made a draft PR here:
> 
> https://github.com/python/cpython/pull/30177
> 
> to fix the issue. But we should benchmark and evaluate it before deciding 
> anything.

It seems that the PR was merged without discussion about 85% regression in 
python_startup benchmark. https://speed.python.org/timeline/?ben=python_startup 
https://speed.python.org/changes/?rev=e9898bf153

--
nosy: +Kojoley

___
Python tracker 

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



[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Sardorbek Imomaliev


Sardorbek Imomaliev  added the comment:

It was changed from that in 2010

https://github.com/python/cpython/commit/20933e08b12b4e66c6e1baf662a679b4008d9dce

--

___
Python tracker 

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



[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
nosy: +rhettinger

___
Python tracker 

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



[issue46020] Optimize long_pow for the common case

2022-01-02 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +tim.peters

___
Python tracker 

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



[issue45903] What’s New In Python 3.11: wrong reference to Signature.from_callable

2022-01-02 Thread Mariatta


Mariatta  added the comment:


New changeset 7a8796dc67d691e43eed69969e7706fefe0f16e9 by Hugo van Kemenade in 
branch 'main':
bpo-45903: Fix typo in What's New: Signature.from_builtin is removed (GH-29813)
https://github.com/python/cpython/commit/7a8796dc67d691e43eed69969e7706fefe0f16e9


--
nosy: +Mariatta

___
Python tracker 

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



[issue45903] What’s New In Python 3.11: wrong reference to Signature.from_callable

2022-01-02 Thread Mariatta


Mariatta  added the comment:

Thanks Jakub for reporting the issue, and thanks Hugo for the PR.

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

___
Python tracker 

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



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

2022-01-02 Thread Arie Bovenberg


Arie Bovenberg  added the comment:

Indeed the `__format__` style offers a lot more options (see 
https://pyformat.info/).

Regarding performance you make an interesting point.

One possible solution is to allow f-strings _only_ if there are no args/kwargs.
In that one case formatting would explicitly be skipped. 
This could be represented at type-level with an overload:

# case: Logger does formatting. Only literal string template allowed.
@overload
def debugf(msg: Literal[str], *args, exc_info: bool = False, **kwargs):
# wrap

# case: User does formatting. No args/kwargs allowed.
@overload
def debugf(msg: str, *, exc_info: bool = False):
# wrap `msg` in something that will not allow further formatting.

--

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

2022-01-02 Thread Hugo van Kemenade


Hugo van Kemenade  added the comment:

Here's a branch with a passing ntpath.normpath test and a failing 
posixpath.normpath test:

https://github.com/hugovk/cpython/tree/issue-46208-tests

https://github.com/hugovk/cpython/commit/d7e8da179adce51a8f63d2dbd062a272dda826bc

--

___
Python tracker 

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



[issue46226] User specific paths added to System PATH environment variable

2022-01-02 Thread Aleksandr Krymskiy


New submission from Aleksandr Krymskiy :

Installed Python 3.10.1 using Windows 64-bit installer from python.org. Upon 
examining the PATH environment variables I noticed that my local user paths 
(C:\Users\avk\AppData\...) have been added to the System-level PATH variable 
instead of User level, which can cause problems on multi-user systems, since 
users other than mine will now have these paths in their environment causing 
them to potentially try to execute code from unexpected location that they 
should not even have access too. User paths should be added to User specific 
PATH environment variable and only global (C:\Program Files\Python310\...) kept 
in the System scope by the installer. Please see my screenshot - the 
highlighted should be moved to User scoped PATH var.

--
components: Installation
files: py_paths.png
messages: 409507
nosy: akrymskiy
priority: normal
severity: normal
status: open
title: User specific paths added to System PATH environment variable
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50535/py_paths.png

___
Python tracker 

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



[issue46184] Remove `netlify.toml`?

2022-01-02 Thread Nikita Sobolev


Change by Nikita Sobolev :


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



[issue46178] Remove `.travis.yml`?

2022-01-02 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Thanks everyone!

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



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

2022-01-02 Thread Éric Araujo

Éric Araujo  added the comment:


New changeset ce4d25f3cd0a1c6e65b64015140fb5e1397c8ac5 by Nikita Sobolev in 
branch 'main':
bpo-46196: document method cmd.Cmd.columnize (#30303)
https://github.com/python/cpython/commit/ce4d25f3cd0a1c6e65b64015140fb5e1397c8ac5


--

___
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

2022-01-02 Thread Éric Araujo

Éric Araujo  added the comment:

Done, cheers!

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



[issue46227] add pathlib.Path.walk method

2022-01-02 Thread Stanislav Zmiev


New submission from Stanislav Zmiev :

Pathlib is great, yet every time I have to parse a bunch of files, I have to 
use os.walk and join paths by hand. That's not a lot of code but I feel like 
pathlib should have higher-level abstractions for all path-related 
functionality of os. I propose we add a Path.walk method that could look like 
this:

def walk(self, topdown=True, onerror=None, followlinks=False):
for root, dirs, files in self._accessor.walk(
self,
topdown=topdown,
onerror=onerror,
followlinks=followlinks
):
root_path = Path(root)
yield (
root_path,
[root_path._make_child_relpath(dir_) for dir_ in dirs],
[root_path._make_child_relpath(file) for file in files],
)


Note: this version does not handle a situation when top does not exist (similar 
to os.walk that also doesn't handle it and just returns an empty generator)

--
components: Library (Lib)
messages: 409511
nosy: Ovsyanka
priority: normal
severity: normal
status: open
title: add pathlib.Path.walk method
type: enhancement
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



[issue46005] [doc] replace 'distutils' examples with 'setuptools'

2022-01-02 Thread Éric Araujo

Éric Araujo  added the comment:

Distutils is deprecated, and core Python docs are not the place to show how to 
use a specific build system (thanks to a lot of work, we now have multiple 
viable build systems!).

--
nosy: +eric.araujo

___
Python tracker 

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



[issue46227] add pathlib.Path.walk method

2022-01-02 Thread Barney Gale


Change by Barney Gale :


--
nosy: +barneygale

___
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

2022-01-02 Thread Tim Peters


Tim Peters  added the comment:


New changeset 863729e9c6f599286f98ec37c8716e982c4ca9dd by Tim Peters in branch 
'main':
bpo-46218: Change long_pow() to sliding window algorithm (GH-30319)
https://github.com/python/cpython/commit/863729e9c6f599286f98ec37c8716e982c4ca9dd


--

___
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

2022-01-02 Thread Tim Peters


Change by Tim Peters :


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



[issue46227] add pathlib.Path.walk method

2022-01-02 Thread Stanislav Zmiev


Stanislav Zmiev  added the comment:

Some people could suggest using Path.glob instead but I found it to be less 
convenient for some use cases and generally slower (~2.7 times slower).

>>> timeit("list(Path('Lib').walk())", number=100, globals=globals())
1.9074640140170231
>>> timeit("list(Path('Lib').glob('**/*'))", number=100, globals=globals())
5.14890358998673

--

___
Python tracker 

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



[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue46228] argparse docs: default for prog= in ArgumentParser() should be basename of argv[0], not argv[0], to match behaviour

2022-01-02 Thread Jade Lovelace

New submission from Jade Lovelace :

Currently the documentation for argparse.ArgumentParser states that the default 
value of the prog[ram] argument is argv[0], however, this does not match the 
actual behaviour of the constructor. In reality, the constructor uses the 
basename of argv[0], as can be seen in the code here: 
https://github.com/python/cpython/blob/e800dd1793dafbc4114da744f605731ff6630623/Lib/argparse.py#L1733-L1735

Here is a demo:

/tmp » cat test.py
import argparse

ap = argparse.ArgumentParser()
print(ap.prog)
ap.print_usage()
/tmp » python test.py
test.py
usage: test.py [-h]
/tmp » python ./test.py
test.py
usage: test.py [-h]
/tmp » mkdir test
/tmp » cd test
/tmp/test » python ../test.py
test.py
usage: test.py [-h]

--
components: Library (Lib)
files: test.py
messages: 409515
nosy: lf-
priority: normal
pull_requests: 28549
severity: normal
status: open
title: argparse docs: default for prog= in ArgumentParser() should be basename 
of argv[0], not argv[0], to match behaviour
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9
Added file: https://bugs.python.org/file50536/test.py

___
Python tracker 

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



[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm going to decline this one.  It seems that you're applying a stylistic 
guideline to a case where it isn't needed and where it doesn't improve the 
example.

In this case, the example doesn't mutate the input, so the code is correct.  It 
has some benefit in that it communicates to the user of the function that lists 
are allowable as an input (which is the norm for bisect).  And the tooltips 
will show the relationship between the grades can the cutpoints.

Also, this isn't library code.  A bisect example needs to focus on bisect 
rather than other concerns.  This isn't the place to talk about the pattern of 
setting a default to None and then filling it in in the body of the code.  
Likewise, we wouldn't use this example to communicate / and * for 
positional-only and keyword-only args.  Nor do we have a docstring or type 
signature.  Instead, it shows how to write a lookup function using bisect() and 
that is all we want.

Lastly, I'll note this example has been present for a long time and has proven 
itself effective in teaching people how bisect works.  In particular, we want 
to make it obvious the relationship between the 5 grades and the 4 cut points.

--
resolution:  -> not a bug
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



[issue46227] add pathlib.Path.walk method

2022-01-02 Thread Jacob Nilsson


Change by Jacob Nilsson :


--
nosy: +ajoino

___
Python tracker 

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



[issue46228] argparse docs: default for prog= in ArgumentParser() should be basename of argv[0], not argv[0], to match behaviour

2022-01-02 Thread Éric Araujo

Change by Éric Araujo :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage:  -> patch review
type: enhancement -> behavior
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue23952] cgi: Document the 'maxlen' member of the cgi module

2022-01-02 Thread Hugo van Kemenade


Change by Hugo van Kemenade :


--
keywords: +patch
nosy: +hugovk
nosy_count: 4.0 -> 5.0
pull_requests: +28550
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30338

___
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

2022-01-02 Thread sharewell

sharewell  added the comment:

Thank you!

Jawed

> On Jan 2, 2022, at 10:34 AM, Éric Araujo  wrote:
> 
> 
> Éric Araujo  added the comment:
> 
> Done, cheers!
> 
> --
> resolution:  -> fixed
> stage: patch review -> resolved
> status: open -> closed
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue46228] argparse docs: default for prog= in ArgumentParser() should be basename of argv[0], not argv[0], to match behaviour

2022-01-02 Thread miss-islington


Change by miss-islington :


--
keywords: +patch
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +28551
pull_request: https://github.com/python/cpython/pull/30339

___
Python tracker 

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



[issue46228] argparse docs: default for prog= in ArgumentParser() should be basename of argv[0], not argv[0], to match behaviour

2022-01-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thank you for the PR.

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



[issue46229] CODE_OF_CONDUCT shadowing org default

2022-01-02 Thread Nikita Sobolev

New submission from Nikita Sobolev :

Problem: we have two CODE_OF_CONDUCT files.
1. In CPython: https://github.com/python/cpython/blob/main/CODE_OF_CONDUCT.md 
(last updated 3 years ago)
2. In Python org, default for all repos: 
https://github.com/python/.github/blob/master/CODE_OF_CONDUCT.md

But, since CODE_OF_CONDUCT is an important document, I want to raise a 
discussion first. Should it be deleted from CPython repo?

Pros: GitHub offers org-default and CODE_OF_CONDUCT will still be rendered in 
several places:
- 
https://user-images.githubusercontent.com/4660275/147888475-f1bc5e79-078b-4ec7-9484-53b90373c3c9.png
- 
https://user-images.githubusercontent.com/4660275/147888477-35c98df8-2730-4d9b-a568-76b6b46da015.png

It will be also easier to edit a single-source-of-truth. For example, this 
commit was not back-ported to CPython: 
https://github.com/python/.github/commit/237d2151f18380c8146557febfe5858fe3f23232
 

Also, other repos like mypy / typeshed / typing use org-default CoC.

Cons: some people might still miss that CPython has a CoC. 

This is a follow-up to: https://github.com/python/cpython/pull/30294

If others agree, I can send a PR to remove CPython's local copy of CoC.

--
files: Снимок экрана 2022-01-02 в 23.19.15.png
messages: 409519
nosy: Mariatta, sobolevn
priority: normal
severity: normal
status: open
title: CODE_OF_CONDUCT shadowing org default
type: behavior
versions: Python 3.11
Added file: https://bugs.python.org/file50537/Снимок экрана 2022-01-02 в 
23.19.15.png

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

>It seems that the PR was merged without discussion about 85% regression in 
>python_startup benchmark

Ugh, that's quite bad. We measured performance impact in general and that was 
quite acceptable  but seems that for startup this is quite sensitive :(

There isn't many other ways we can do this that I can think of unfortunately, 
so we need to make a decision on what we care most here, unless someone has a 
better idea on how we can overcome the recursion problem.

Adding Guido and Eric as they gave been working on startup quite a lot.

--
nosy: +eric.snow, gvanrossum
priority: normal -> release blocker
status: closed -> open

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +lukasz.langa
versions: +Python 3.11, Python 3.9

___
Python tracker 

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



[issue4849] instantiating and populating xml.dom.minidom.Element is cumbersome

2022-01-02 Thread Hugo van Kemenade


Hugo van Kemenade  added the comment:

Hi Mike, "patch review" means:

"A patch or pull request exists, but it needs review. Any triager or core 
developer may do the review."

https://devguide.python.org/triaging/#stage

So we were waiting for someone to review patches listed above under the "Files" 
section (eg. issue4849_2.patch).

But seeing as they're from 2012/2014, and development has now moved to GitHub, 
a pull request needs to be opened on GitHub instead.

So I reckon you're good to go ahead and create a PR.

--
nosy: +hugovk

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Guido, Eric, what are your thoughts here?

The fix that I merged works by limiting the maximum recursion but seems that 
incrementing the recursion counter on every parser call makes quite a lot of 
impact on startup.

Unfortunately if we revert the fix, we still have the problem that Python can 
segfault for certain inputs that overload the stack.

--

___
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()

2022-01-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> divmod() allows easy emulation of any division rounding mode

It could be used that way, but generally isn't.

Please consider my original request.  Adding a keyword argument is easy, clear, 
and has almost no mental overhead.   

It reads very well in code, `y = isqrt(x, 'ceil')` or `y = isqrt(x, 'round')`.  
The equivalents with isqrt_rem are awkward and don't read well (reminding me of 
my Fortran days).

--

___
Python tracker 

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



[issue23952] cgi: Document the 'maxlen' member of the cgi module

2022-01-02 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue46226] User specific paths added to System PATH environment variable

2022-01-02 Thread Ned Deily


Change by Ned Deily :


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



[issue46229] CODE_OF_CONDUCT shadowing org default

2022-01-02 Thread Ned Deily


Change by Ned Deily :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue46230] NEWLINE* is missing in 'file' rule in PEG grammar

2022-01-02 Thread Robert Einhorn


New submission from Robert Einhorn :

https://docs.python.org/3.10/reference/grammar.html

# original grammar rule:
file: [statements] ENDMARKER 


# suggested grammar rule:
file: NEWLINE* [statements] ENDMARKER

--
components: Parser
messages: 409524
nosy: RobEin, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: NEWLINE* is missing in 'file' rule in PEG grammar
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



[issue46231] grammar rule definition is missing: invalid_double_starred_kvpairs

2022-01-02 Thread Robert Einhorn


New submission from Robert Einhorn :

Definition of invalid_double_starred_kvpairs PEG grammar rule is not found:

https://docs.python.org/3.10/reference/grammar.html

# PEG grammar rule:
dict:
| '{' [double_starred_kvpairs] '}' 
| '{' invalid_double_starred_kvpairs '}'

--
components: Parser
messages: 409525
nosy: RobEin, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: grammar rule definition is missing: invalid_double_starred_kvpairs
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



[issue46227] add pathlib.Path.walk method

2022-01-02 Thread Stanislav Zmiev


Change by Stanislav Zmiev :


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

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Let me have a look. May take a day, okay?--
--Guido (mobile)

--

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Let me have a look. May take a day, okay?--

Absolutely! There is no rush as the only close release IIRC is another alpha of 
3.11.

--

___
Python tracker 

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



[issue46230] NEWLINE* is missing in 'file' rule in PEG grammar

2022-01-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I don't know what you mean with "it's missing". That is the actual rule used in 
the grammar:

https://github.com/python/cpython/blob/8e75c6b49b7cb8515b917f01b32ece8c8ea2c0a0/Grammar/python.gram#L88

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



[issue46231] grammar rule definition is missing: invalid_double_starred_kvpairs

2022-01-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

invalid_* rules are not part of the official grammar as they are only used for 
error reporting. We need to update the peg grammar highlighter to exclude it

--

___
Python tracker 

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



[issue46229] CODE_OF_CONDUCT shadowing org default

2022-01-02 Thread Mariatta


Mariatta  added the comment:

Sounds good to me to use the org-level CoC file and removing the local CPython 
copy. Having a single source of truth will be valuable and reduce our 
maintenance burden.

--

___
Python tracker 

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



[issue46231] grammar rule definition is missing: invalid_double_starred_kvpairs

2022-01-02 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue37836] Support .as_integer_ratio() in fractions.Fraction

2022-01-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I don't think this is a door we should open:

   >>> Fraction(3.5, 2.5)
   Fraction(7, 5)

This currently raises a useful exception:

   TypeError: both arguments should be Rational instances

That is especially helpful in avoiding cases like this:

>>> Fraction(1.1, 3.3)
Fraction(2476979795053773, 7430939385161318)

If that output is desired, the two conversions should be explicit.

>>> Fraction(1.1) / Fraction(3.3)
Fraction(2476979795053773, 7430939385161318

I recommend rejecting this feature request as being more likely to be hazardous 
than helpful.

--

___
Python tracker 

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



[issue46232] Client certificates with UniqueIdentifier in the subject break ssl.peer_certificate()

2022-01-02 Thread Kacper


New submission from Kacper :

Currently all subject sets of a client certificate are treated as UTF8 strings 
using the ASN1_STRING_to_UTF8 function 
(https://github.com/python/cpython/blob/8d999cbf4adea053be6dbb612b9844635c4dfb8e/Modules/_ssl.c#L912),
 however RFC 5280 states that the UniqueIdentifier is of type BIT STRING. 
Passing a BIT STRING into the ASN1_STRING_to_UTF8 function seems to return -1 
and subsequently fail a SSL handshake.

Traceback (most recent call last):
  File "/usr/lib64/python3.6/asyncio/events.py", line 145, in _run
self._callback(*self._args)
  File "/usr/lib64/python3.6/site-packages/tornado/platform/asyncio.py", line 
138, in _handle_events
handler_func(fileobj, events)
  File "/usr/lib64/python3.6/site-packages/tornado/iostream.py", line 702, in 
_handle_events
self._handle_read()
  File "/usr/lib64/python3.6/site-packages/tornado/iostream.py", line 1471, in 
_handle_read
self._do_ssl_handshake()
  File "/usr/lib64/python3.6/site-packages/tornado/iostream.py", line 1431, in 
_do_ssl_handshake
if not self._verify_cert(self.socket.getpeercert()):
  File "/usr/lib64/python3.6/ssl.py", line 860, in getpeercert
return self._sslobj.getpeercert(binary_form)
  File "/usr/lib64/python3.6/ssl.py", line 610, in getpeercert
return self._sslobj.peer_certificate(binary_form)
ssl.SSLError: unknown error (_ssl.c:959)

(line 959 of _ssl.c corresponds to 
https://github.com/python/cpython/blob/8d999cbf4adea053be6dbb612b9844635c4dfb8e/Modules/_ssl.c#L914)

https://github.com/pyca/cryptography/issues/3542 might be of interest for 
further discussion.

--
assignee: christian.heimes
components: SSL
messages: 409532
nosy: christian.heimes, kacper
priority: normal
severity: normal
status: open
title: Client certificates with UniqueIdentifier in the subject break 
ssl.peer_certificate()
type: behavior
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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

So if I understand the speed.python.org results correctly, the time to run 
`python -c pass` went way up, but the time for `python -S -c pass` did not go 
up significantly.

Unfortunately the only machine I have access to is a Mac, and I cannot repro 
this result, using PGO/LTO. Could it be a Linux thing? Or due to something in 
the venv for pyperformance?

Note that I am using a much simpler test script: Tools/scripts/startuptime.py. 
I have not yet succeeded in building and running pyperformance, mostly since 
the Python I build doesn't have SSL configured (I always forget the flag to use 
on my machine) and pyperformance insists on installing a bunch of stuff 
(including new versions of pip and setuptools, it seels).

Can anyone repro the perf regression on their box?

--

___
Python tracker 

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



[issue46229] CODE_OF_CONDUCT shadowing org default

2022-01-02 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue41028] Move docs.python.org language and version switcher out of cpython

2022-01-02 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +28555
pull_request: https://github.com/python/cpython/pull/30343

___
Python tracker 

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



[issue41028] Move docs.python.org language and version switcher out of cpython

2022-01-02 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28556
pull_request: https://github.com/python/cpython/pull/30344

___
Python tracker 

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



[issue46233] Minor speedup for bigint squaring

2022-01-02 Thread Tim Peters


New submission from Tim Peters :

longobject.c's x_mul()'s special code for squaring gets kind of sloppy at the 
end of a digit pass, doing a useless add of 0 and an "extra" test for carry. 
Easily cleaned up.

I think the underlying cause is that the HAC algorithm description it was 
modeled on was quite "hand wavy" about how badly, and exactly when, the carry 
can exceed a single digit. Things are better-behaved at the end of a digit pass.

--
assignee: tim.peters
components: Interpreter Core
messages: 409534
nosy: tim.peters
priority: normal
severity: normal
stage: needs patch
status: open
title: Minor speedup for bigint squaring
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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Maybe it's Linux specific? I managed to run pyperformance and got this:

### python_startup ###
Mean +- std dev: 23.2 ms +- 0.8 ms -> 23.4 ms +- 1.2 ms: 1.01x slower
Not significant

Note, I am not dismissing the report -- in fact it looks quite bad. But I am 
failing to reproduce it, which makes it harder to understand the root cause. :-(

Maybe we can create a microbenchmark for this that just parses a large amount 
of code?

Anyway, here's a random thought about why this might have such a big impact. 
Look at this snippet (found all over the parser.c file):

if (p->level++ == MAXSTACK) {
p->error_indicator = 1;
PyErr_NoMemory();
}
if (p->error_indicator) {
p->level--;
return NULL;
}

This is two "unlikely" branches in a row, and the first sets the variable 
tested by the second. Maybe this causes the processor to stall?

Also, maybe it would be wiser to use ++X instead of X++? (Though a good 
compiler would just change X++ == Y into ++X == Y+1.)

Anyway, without a way to reproduce, there's not much that can be done.

--

___
Python tracker 

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



[issue46233] Minor speedup for bigint squaring

2022-01-02 Thread Tim Peters


Change by Tim Peters :


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

___
Python tracker 

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



[issue41028] Move docs.python.org language and version switcher out of cpython

2022-01-02 Thread Ned Deily


Ned Deily  added the comment:


New changeset 811f65ba263140b6ba28151246b52efe149a6382 by Ned Deily in branch 
'3.7':
bpo-41028: use generic version links in Docs index.
https://github.com/python/cpython/commit/811f65ba263140b6ba28151246b52efe149a6382


--

___
Python tracker 

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



[issue41028] Move docs.python.org language and version switcher out of cpython

2022-01-02 Thread Ned Deily


Ned Deily  added the comment:


New changeset b28b0222e360669463ffe31d27c1fd374361cb23 by Miss Islington (bot) 
in branch '3.9':
bpo-41028: Doc: Move switchers to docsbuild-scripts. (GH-20969) (GH-30343)
https://github.com/python/cpython/commit/b28b0222e360669463ffe31d27c1fd374361cb23


--

___
Python tracker 

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



[issue41028] Move docs.python.org language and version switcher out of cpython

2022-01-02 Thread Ned Deily


Ned Deily  added the comment:

I went ahead and auto-backported the full PR to 3.9 and 3.8 since it applies 
cleanly there and did a manual backport of just the sidebar changes to 3.7 and 
3.6 (added in the final merge before EOL).  Now just awaiting @ambv approval 
for 3.8.

For reference, compare old vs new "Docs by version" sidebar on the index pages:
https://docs.python.org/release/3.9.9/
https://docs.python.org/release/3.10.1/

--
nosy: +lukasz.langa
resolution:  -> fixed
stage: patch review -> commit review
status: open -> pending
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



[issue46234] 3.11: Tracing of decorators now visits the decorator line before the decorator function

2022-01-02 Thread Ned Batchelder


New submission from Ned Batchelder :

Sometime after 3.11.0a3, tracing of decorators changed so that each decorator
line is revisited as the decorator is invoked.  Is this intentional?

---< dectrace.py >---
import linecache, sys

def trace(frame, event, arg):
# The weird globals here is to avoid a NameError on shutdown...
if frame.f_code.co_filename == globals().get("__file__"):
lineno = frame.f_lineno
print("{} {}: {}".format(event[:4], lineno, linecache.getline(__file__, 
lineno).rstrip()))
return trace

print(sys.version)
sys.settrace(trace)

def decorator(func):
return func

def doit():
@decorator
@decorator
@decorator
def func(x):
return x + 1

print(func(1))

doit()
-

Running it on 3.10, 3.11.0a3, and latest 3.11.  The last run has the new line
hightlighted with <:

$ python3.10 dectrace.py
3.10.1 (main, Dec 14 2021, 08:30:13) [Clang 12.0.0 (clang-1200.0.32.29)]
call 16: def doit():
line 17: @decorator
line 18: @decorator
line 19: @decorator
line 20: def func(x):
call 13: def decorator(func):
line 14: return func
retu 14: return func
call 13: def decorator(func):
line 14: return func
retu 14: return func
call 13: def decorator(func):
line 14: return func
retu 14: return func
line 23: print(func(1))
call 17: @decorator
line 21: return x + 1
retu 21: return x + 1
2
retu 23: print(func(1))

$ python3.11 dectrace.py
3.11.0a3 (main, Dec  9 2021, 12:22:18) [Clang 12.0.0 (clang-1200.0.32.29)]
call 16: def doit():
line 17: @decorator
line 18: @decorator
line 19: @decorator
line 20: def func(x):
call 13: def decorator(func):
line 14: return func
retu 14: return func
call 13: def decorator(func):
line 14: return func
retu 14: return func
call 13: def decorator(func):
line 14: return func
retu 14: return func
line 23: print(func(1))
call 17: @decorator
line 21: return x + 1
retu 21: return x + 1
2
retu 23: print(func(1))

$ /usr/local/cpython/bin/python3.11 dectrace.py
3.11.0a3+ (heads/main:a82baed0e9, Jan  2 2022, 08:12:01) [Clang 12.0.0 
(clang-1200.0.32.29)]
call 16: def doit():
line 17: @decorator
line 18: @decorator
line 19: @decorator
line 20: def func(x):
line 19: @decorator <
call 13: def decorator(func):
line 14: return func
retu 14: return func
line 18: @decorator <
call 13: def decorator(func):
line 14: return func
retu 14: return func
line 17: @decorator <
call 13: def decorator(func):
line 14: return func
retu 14: return func
line 20: def func(x):
line 23: print(func(1))
call 17: @decorator
line 21: return x + 1
retu 21: return x + 1
2
retu 23: print(func(1))


(this might or might not be related to https://bugs.python.org/issue37971)

--
components: Interpreter Core
keywords: 3.11regression
messages: 409539
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: 3.11: Tracing of decorators now visits the decorator line before the 
decorator function
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue46219] except* assumes that an exception group is truthy

2022-01-02 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 65e7c1f90e9136fc61f4af029b065d9f6c5664c3 by Irit Katriel in 
branch 'main':
bpo-46219, 46221: simplify except* implementation following exc_info changes. 
Move helpers to exceptions.c. Do not assume that exception groups are truthy. 
(GH-30289)
https://github.com/python/cpython/commit/65e7c1f90e9136fc61f4af029b065d9f6c5664c3


--

___
Python tracker 

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



[issue46219] except* assumes that an exception group is truthy

2022-01-02 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue46221] Simplify except* implementation and move helpers to exceptions.c

2022-01-02 Thread Irit Katriel


Irit Katriel  added the comment:

Fixed in https://github.com/python/cpython/pull/30289.

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



[issue46229] CODE_OF_CONDUCT shadowing org default

2022-01-02 Thread miss-islington


miss-islington  added the comment:


New changeset fedefa67350c72dde121f68cbe7aa70face6805e by Nikita Sobolev in 
branch 'main':
bpo-46229: remove `CODE_OF_CONDUCT.md` to use org default (GH-30342)
https://github.com/python/cpython/commit/fedefa67350c72dde121f68cbe7aa70face6805e


--
nosy: +miss-islington

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This are my results running directly the pyperformance run script 
(https://github.com/python/pyperformance/blob/main/pyperformance/data-files/benchmarks/bm_python_startup/run_benchmark.py)
 with and without the fix (both PGO/LTO):

pablogsal@Obsidian-W:~$ ./cpython/python startup_benchmark.py --compare-to 
./cpython_base/python
python_with_fix: . 8.14 ms +- 0.17 ms
python_with_reverted_fix: . 8.05 ms +- 0.16 ms

Mean +- std dev: [python_with_fix] 8.14 ms +- 0.16 ms -> 
[python_with_reverted_fix] 8.05 ms +- 0.17 ms: 1.01x faster

--

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am not able to reproduce on Linux either, with pyperformance or manual 
testing in the CLI. 

Interestingle, this shows up in both machines:

https://speed.python.org/timeline/#/?exe=12&ben=python_startup&env=1&revs=50&equid=off&quarts=on&extr=on

https://speed.python.org/timeline/#/?exe=12&ben=python_startup&env=4&revs=50&equid=off&quarts=on&extr=on

--

___
Python tracker 

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



[issue46229] CODE_OF_CONDUCT shadowing org default

2022-01-02 Thread Mariatta


Mariatta  added the comment:

Thanks!

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



[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-02 Thread Dennis Sweeney


New submission from Dennis Sweeney :

Some benchmarks for this change are below. The case with the largest speedup, 
`[None] * 1`, is the case that I would consider the most important: 
initializing counters of the form `[0] * N` is very common in my experience.

The following were taken from a PGO build on Windows without CPU isolation, so 
take them with a grain of salt:

Slower (16):
- [None] * 2: 61.6 ns +- 3.3 ns -> 71.0 ns +- 1.5 ns: 1.15x slower
- list(range(10)) * 1: 205 us +- 49 us -> 232 us +- 93 us: 1.13x slower
- ["Python", "Perl"] * 1: 31.4 us +- 4.3 us -> 34.4 us +- 0.2 us: 1.10x 
slower
- list(range(100)) * 2: 370 ns +- 12 ns -> 395 ns +- 14 ns: 1.07x slower
- list(range(10)) * 2: 81.5 ns +- 2.8 ns -> 86.9 ns +- 2.4 ns: 1.07x slower
- [None] * 10: 72.3 ns +- 2.2 ns -> 75.8 ns +- 2.1 ns: 1.05x slower
- ["Python", "Perl"] * 100: 442 ns +- 67 ns -> 463 ns +- 4 ns: 1.05x slower
- tuple(range(10)) * 2: 88.2 ns +- 2.9 ns -> 91.9 ns +- 2.7 ns: 1.04x slower
- ("Python", "Perl") * 10: 92.6 ns +- 7.8 ns -> 96.0 ns +- 4.5 ns: 1.04x slower
- ["Python", "Perl"] * 10: 86.1 ns +- 4.2 ns -> 89.1 ns +- 2.7 ns: 1.04x slower
- (None,) * 10: 69.4 ns +- 1.9 ns -> 71.2 ns +- 3.1 ns: 1.03x slower
- ["Python", "Perl"] * 2: 63.9 ns +- 2.6 ns -> 65.3 ns +- 1.4 ns: 1.02x slower
- (None,) * 2: 54.0 ns +- 0.7 ns -> 55.1 ns +- 2.1 ns: 1.02x slower
- ("Python", "Perl") * 2: 57.5 ns +- 3.0 ns -> 58.6 ns +- 2.4 ns: 1.02x slower
- list(range(10)) * 10: 238 ns +- 8 ns -> 242 ns +- 7 ns: 1.02x slower
- tuple(range(100)) * 2: 414 ns +- 19 ns -> 420 ns +- 6 ns: 1.02x slower

Faster (22):
- [None] * 1: 25.1 us +- 0.2 us -> 12.8 us +- 0.2 us: 1.97x faster
- tuple(range(10)) * 1: 255 us +- 91 us -> 176 us +- 77 us: 1.45x faster
- tuple(range(1000)) * 10: 17.8 us +- 0.3 us -> 12.4 us +- 0.1 us: 1.44x faster
- [None] * 100: 355 ns +- 11 ns -> 251 ns +- 7 ns: 1.41x faster
- list(range(1000)) * 10: 16.8 us +- 0.2 us -> 12.5 us +- 0.1 us: 1.34x faster
- tuple(range(100)) * 100: 15.9 us +- 0.2 us -> 12.7 us +- 0.2 us: 1.26x faster
- tuple(range(10)) * 100: 1.63 us +- 0.02 us -> 1.33 us +- 0.01 us: 1.23x faster
- tuple(range(1000)) * 2: 3.61 us +- 0.06 us -> 2.93 us +- 0.03 us: 1.23x faster
- list(range(100)) * 100: 13.8 us +- 0.3 us -> 11.2 us +- 0.1 us: 1.23x faster
- tuple(range(100)) * 10: 1.68 us +- 0.02 us -> 1.40 us +- 0.01 us: 1.20x faster
- tuple(range(1000)) * 100: 240 us +- 87 us -> 200 us +- 102 us: 1.20x faster
- tuple(range(1000)) * 1: 33.8 ms +- 0.8 ms -> 28.3 ms +- 1.5 ms: 1.19x 
faster
- list(range(1000)) * 1: 33.9 ms +- 0.9 ms -> 28.6 ms +- 1.4 ms: 1.19x 
faster
- list(range(100)) * 10: 1.47 us +- 0.10 us -> 1.25 us +- 0.01 us: 1.18x faster
- list(range(10)) * 100: 1.41 us +- 0.02 us -> 1.22 us +- 0.02 us: 1.16x faster
- list(range(100)) * 1: 3.15 ms +- 0.13 ms -> 2.79 ms +- 0.13 ms: 1.13x 
faster
- list(range(1000)) * 2: 3.32 us +- 0.07 us -> 2.94 us +- 0.04 us: 1.13x faster
- tuple(range(100)) * 1: 3.24 ms +- 0.13 ms -> 2.88 ms +- 0.14 ms: 1.13x 
faster
- (None,) * 1: 26.7 us +- 0.2 us -> 24.1 us +- 0.2 us: 1.11x faster
- tuple(range(10)) * 10: 258 ns +- 7 ns -> 249 ns +- 6 ns: 1.04x faster
- ("Python", "Perl") * 100: 438 ns +- 7 ns -> 436 ns +- 7 ns: 1.01x faster
- ("Python", "Perl") * 1: 31.1 us +- 0.3 us -> 30.9 us +- 0.2 us: 1.01x 
faster

Benchmark hidden because not significant (2): list(range(1000)) * 100, (None,) 
* 100

Geometric mean: 1.10x faster

--
components: Interpreter Core
messages: 409546
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Do all ref-counting at once for sequence multiplication
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



[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


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

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Does python_startup benchmark start with all modules parsed and __pycache__d, 
or with no cache, so it includes the normally one-time parse time?

--

___
Python tracker 

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



[issue46235] Do all ref-counting at once for sequence multiplication

2022-01-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

# benchmarking script

from pyperf import Runner
runner = Runner()

for n in [2, 10, 100, 10_000]:
for A in [
'[None]',
'["Python", "Perl"]',
'list(range(10))',
'list(range(100))',
'list(range(1000))',
'(None,)',
'("Python", "Perl")',
'tuple(range(10))',
'tuple(range(100))',
'tuple(range(1000))',
]:
runner.timeit(
name=f"{A} * {n}",
setup=f"x = {A}",
stmt=f"x * {n}",
)

--

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Does python_startup benchmark start with all modules parsed and __pycache__d, 
> or with no cache, so it includes the normally one-time parse time?

I don't know what pyperf does with the cache (adding Victor as maybe he knowns).

--
nosy: +vstinner

___
Python tracker 

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



[issue34931] os.path.splitext with more dots

2022-01-02 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 5.0 -> 6.0
pull_requests: +28559
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30347

___
Python tracker 

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



[issue46182] `super` and descriptor clarification

2022-01-02 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger
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



[issue39181] Add `os.makedirs()` as `Path.mkdir()` equivalent in correspondence table

2022-01-02 Thread jack1142


jack1142  added the comment:

Looks like this has been reported again in https://bugs.python.org/issue39470 
and a fix for it has already been merged.

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



[issue44669] TypeError: 'type' object is not subscriptable

2022-01-02 Thread Irit Katriel


Irit Katriel  added the comment:

I'm closing this because there is not enough information here to understand the 
issue and there was no reply to follow-up questions. 

Please reopen or create a new issue if you are still having a problem with this.

--
nosy: +iritkatriel
resolution:  -> works for me
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



[issue40059] Provide a toml module in the standard library

2022-01-02 Thread Shantanu


Shantanu  added the comment:

We've started a PEP draft.

https://github.com/hauntsaninja/peps/blob/toml-pep/pep-.rst shows a 
rendered version.
https://github.com/hauntsaninja/peps/pull/1 is a PR from the toml-pep branch to 
main, to help ease of review / discussion.

If you're following along and need to get your bearings straight, here are the 
recently active locations of discussion:
- this issue
- https://github.com/hukkin/tomli/issues/141
- https://discuss.python.org/t/adopting-recommending-a-toml-parser/4068/84
- https://github.com/hauntsaninja/peps/pull/1

--

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Ran pyperformance with PGO/LTO CPU-isol on my Linux box and I cannot reproduce 
either:

❯ pyperf compare_to json/* --table --table-format=md -G
| Benchmark  | 2021-12-20_10-23-master-6ca78affc802 | 
2021-12-20_15-43-master-e9898bf153d2 |
||::|::|
| python_startup | 19.7 ms  | 19.0 ms: 1.03x faster 
   |

--

___
Python tracker 

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



[issue46148] Optimize pathlib

2022-01-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
pull_requests: +28560
pull_request: https://github.com/python/cpython/pull/27828

___
Python tracker 

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Maybe something unrelated changed on the benchmark machines? (Like installing a 
new version of pyperformance???) Though it happened across both benchmark 
machines. What configuration and flags are being used to run the benchmark 
suite on that machine?

--

___
Python tracker 

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



[issue46236] PyFunction_GetAnnotations returning Tuple vs Dict

2022-01-02 Thread Daniel McCarney


New submission from Daniel McCarney :

Hi there,

This is my first Python bug, hope I haven't missed anything important.

I noticed that the PyFunction_GetAnnotations function from the C API is 
returning a PyTuple when I link Python 3.10 where historically it returned a 
PyDict.

The documentation for PyFunction_GetAnnotations for 3.10 (here[0]) says its 
return can be:
> a mutable dictionary or NULL

I'm not sure if:
* This is user error and I should adapt to this case in my dependent code when 
using Python 3.10+.
* This is a documentation error, and it should say "a mutable dictionary, set, 
or NULL"
* This is a regression in the C API that should be fixed.

I've made a small reproduction program (here[1]) that can be used to quickly 
demonstrate the difference in return type between the two Python versions for 
the same C program and .py inputs.

I also noticed that issue42202 (here[2]) landed an optimization in 3.10.x that 
changed the internal representation of annotations to a set - could that 
possibly be related? I'm not 100% sure!

Thanks!

[0]: https://docs.python.org/3/c-api/function.html#c.PyFunction_GetAnnotations
[1]: https://github.com/cpu/pyfunction_getannotations_test
[2]: https://bugs.python.org/issue42202

--
components: C API
messages: 409555
nosy: cpu
priority: normal
severity: normal
status: open
title: PyFunction_GetAnnotations returning Tuple vs Dict
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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Maybe something unrelated changed on the benchmark machines?

Very unlikely, it happened on two separate machines with different 
distributions and nothing was updated in the machines that I can see.

Both use a configuration file for pyperformance that looks like this:

-

$ cat bench.conf

[config]
json_dir = ~/json_cron

[scm]
repo_dir = ~/cpython_cron
update = True
remote = origin

[compile]
lto = True
pgo = True
bench_dir = ~/bench_tmpdir_cron

[run_benchmark]
system_tune = True
upload = False

[upload]
url = https://speed.python.org/
environment = speed-python
executable = lto-pgo
project = CPython

[compile_all]

[compile_all_revisions]
COMMIT_SHA=master

--

___
Python tracker 

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



[issue42202] Optimize function annotation

2022-01-02 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I believe this change accidentally affected the API of 
PyFunction_GetAnnotations: previously it would only return dict or NULL, now it 
can also return a tuple. See bpo-46236

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue46236] PyFunction_GetAnnotations returning Tuple vs Dict

2022-01-02 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
nosy: +methane

___
Python tracker 

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



[issue42202] Optimize function annotation

2022-01-02 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy:  -pablogsal

___
Python tracker 

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



[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Sardorbek Imomaliev


Sardorbek Imomaliev  added the comment:

Understood, thanks for clarification.

--

___
Python tracker 

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



[issue40477] Python Launcher app on macOS 10.15+ fails to run scripts

2022-01-02 Thread Ned Deily


Change by Ned Deily :


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

___
Python tracker 

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



  1   2   >