[issue45603] [Windows] account privileges and updating Python packages

2021-10-24 Thread Dean


Change by Dean :


--
title: [Windows] -> [Windows] account privileges and updating Python packages

___
Python tracker 

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



[issue45603] [Windows]

2021-10-24 Thread Dean


New submission from Dean :

Running on Windows 10 Home PC, I'm running into an issue with Windows user 
account privileges and updating Python packages.

Upgrading a package (e.g. pip) with a lower-level user on Windows can result in 
a broken pip package (message of "no 'pip' package can be found").

It can be fixed by running (as admin):
python -m ensurepip

Then running an upgrade command as Admin.

Please consider enforcing Admin privileges for this action (upgrading packages).

--
components: Library (Lib)
messages: 404949
nosy: hl2guide
priority: normal
severity: normal
status: open
title: [Windows]
type: behavior
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



[issue45530] Improve listobject.c's unsafe_tuple_compare()

2021-10-24 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



[issue45530] Improve listobject.c's unsafe_tuple_compare()

2021-10-24 Thread Tim Peters


Tim Peters  added the comment:


New changeset 51ed2c56a1852cd6b09c85ba81312dc9782772ce by Tim Peters in branch 
'main':
bpo-45530: speed listobject.c's unsafe_tuple_compare() (GH-29076)
https://github.com/python/cpython/commit/51ed2c56a1852cd6b09c85ba81312dc9782772ce


--

___
Python tracker 

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



[issue45530] Improve listobject.c's unsafe_tuple_compare()

2021-10-24 Thread Tim Peters

Tim Peters  added the comment:

To be concrete, here's an implementation of a full-blown, stable lexicographic 
sort based on "bucket refinement". `xs` is a list of sequences to be sorted in 
lexicographic order. The types of the sequences don't matter (lists, tuples, 
strings, ...). Indeed, since list elements are never compared against each 
other directly, they don't even have to be the same sequence type.

This is already faster in pure Python than list.sort() for cases like:

xs = [random.choices(range(10), k=random.randrange(5, 30))
  for i in range(100)]

However, for cases like strings of the form

'x' * 10_000 + str(i)

it's very much slower than list.sort(), despite that it "should be" very much 
faster. That appears mostly due to the:

t.sort(key=lambda x: x[k])
xs[lo : hi] = t

lines. list.sort() doesn't accept `lo` and `hi` arguments, so sorting _just_ a 
slice requires copying that slice into a temp list, sorting the temp, then 
copying the sorted temp back in. So dealing with a single `x` position in the 
string prefixes effectively requires physically copying the entire list twice 
over - mad overhead to copy the list 20 thousand times.

While the need doesn't come up all that often, I'd support adding optional `lo` 
and `hi` arguments to `list.sort()`. This isn't the first time the lack has 
turned a slick approach into a timing disaster for me ;-)

About list.sort()'s merge strategy, I'm glad to be rid of the original. It's 
not just correctness, it's the effort of _reasoning_ about its consequences. It 
was about a full decade before the first proof was published of that it really 
is a worst-case O(N log N) sort. listsort.txt didn't contain a proof because 
the only proof attempts I had were so complicated not even _I_ found them 
compelling ;-)

Vincent Jugé in particular started at the other end, looking for a merge 
strategy that made proof straightforward instead of Byzantine. It's 
straightforward under the "powersort" strategy too, although it relies on "well 
known" results about approximations to optimal binary search trees.

def lexisort(xs):
buckets = [(0, len(xs), 0)]
while buckets:
lo, hi, k = buckets.pop()
t = []
for i in range(lo, hi):
x = xs[i]
if k >= len(x):
xs[lo] = x
lo += 1
else:
t.append(x)
t.sort(key=lambda x: x[k])
xs[lo : hi] = t
while lo < hi:
pivotk = xs[lo][k]
i = lo + 1
while i < hi and xs[i][k] == pivotk:
i += 1
if i - lo > 1:
buckets.append((lo, i, k + 1))
lo = i
assert lo == hi

--

___
Python tracker 

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



[issue45602] The grammar misses links that are present everywhere else

2021-10-24 Thread Arthur Milchior


New submission from Arthur Milchior :

The grammar, in https://docs.python.org/3/reference/grammar.html , lacks some 
utilities that the remaining of the documentation have.
While it remains usable, it is hard to navigate. As an example 
https://www.python.org/dev/peps/pep-0634/ 's "star_named_exrpsession" and 
"block" links to the general grammar page, and indeed can't link to the 
specific rules as there are no anchor on them.
This would also allow a related improvement: being able to click on a rule R in 
the right side of a declaration and go to the definition of R. Given the 
recursive nature of grammar, that would transform a sequence of search into a 
sequence of click (and even allow to use the browser's "back" to go back to the 
previous definition, or to open the new definition in a new tab)

As far as I can tell, the first action would be to add a new kind of token on 
Doc/tools/extensions/peg_highlight.py , so that we distinguish the left and the 
right part of the rule. The left part (the name of the declared rule) would be 
easy to recognize as it always start on the beginning of the line and end with 
:.
The second action would be that, for each declaration D, the html would contain 
an anchor "#D". And each time D would appear on the right hand side of a rule, 
it would be in a link to #D

I suspect that adding those links and anchor could be done by overriding the 
default formatter or highlighter, but I don't understand pygment well enough to 
know what should be done here

--
assignee: docs@python
components: Documentation
messages: 404946
nosy: Arthur-Milchior, docs@python
priority: normal
severity: normal
status: open
title: The grammar misses links that are present everywhere else
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



[issue37569] Complete your registration to Python tracker

2021-10-24 Thread Richard Hinerfeld


Richard Hinerfeld  added the comment:

I just get an error when  I visit the URL

On Sun, Oct 24, 2021 at 4:57 PM Python tracker 
wrote:

> To complete your registration of the user "rhinerfeld1" with
> Python tracker, please visit the following URL:
>
>
> https://bugs.python.org/?@action=confrego=MxJ6fZghVQdh3dhyE1fj8I7bFrmjfve9
>
>

--
nosy: +rhinerfeld1

___
Python tracker 

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



[issue45601] test_tk and test_ttk_guionly fail with resource not availiable

2021-10-24 Thread Richard Hinerfeld


Richard Hinerfeld  added the comment:

running build_scripts
copying and adjusting /home/richard/Python-3.8.9/Tools/scripts/pydoc3 -> 
build/scripts-3.8
copying and adjusting /home/richard/Python-3.8.9/Tools/scripts/idle3 -> 
build/scripts-3.8
copying and adjusting /home/richard/Python-3.8.9/Tools/scripts/2to3 -> 
build/scripts-3.8
changing mode of build/scripts-3.8/pydoc3 from 644 to 755
changing mode of build/scripts-3.8/idle3 from 644 to 755
changing mode of build/scripts-3.8/2to3 from 644 to 755
renaming build/scripts-3.8/pydoc3 to build/scripts-3.8/pydoc3.8
renaming build/scripts-3.8/idle3 to build/scripts-3.8/idle3.8
renaming build/scripts-3.8/2to3 to build/scripts-3.8/2to3-3.8
./python  ./Tools/scripts/run_tests.py -v test_ttk_guionly
/home/richard/Python-3.8.9/python -u -W default -bb -E -m test -r -w -j 0 -u 
all,-largefile,-audio,-gui -v test_ttk_guionly
== CPython 3.8.9 (default, Oct 24 2021, 15:58:53) [GCC 10.2.1 20210110]
== Linux-5.10.0-9-amd64-x86_64-with-glibc2.29 little-endian
== cwd: /home/richard/Python-3.8.9/build/test_python_34348
== CPU count: 2
== encodings: locale=UTF-8, FS=utf-8
Using random seed 6980064
0:00:00 load avg: 0.32 Run tests in parallel using 4 child processes
0:00:00 load avg: 0.32 [1/1] test_ttk_guionly skipped (resource denied)
test_ttk_guionly skipped -- Use of the 'gui' resource not enabled

== Tests result: SUCCESS ==

1 test skipped:
test_ttk_guionly

Total duration: 957 ms
Tests result: SUCCESS

--

___
Python tracker 

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



[issue45596] Python opens the ./ file on exception while using -c

2021-10-24 Thread Irit Katriel


Change by Irit Katriel :


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



[issue45596] Python opens the ./ file on exception while using -c

2021-10-24 Thread Irit Katriel


Irit Katriel  added the comment:

Actually I can check too :)

And it was fixed:

iritkatriel@Irits-MBP cpython % echo Coucou > ''
iritkatriel@Irits-MBP cpython % ./python.exe -c 'raise ValueError'
Traceback (most recent call last):
  File "", line 1, in 
ValueError
iritkatriel@Irits-MBP cpython %

--

___
Python tracker 

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



[issue45601] test_tk and test_ttk_guionly fail with resource not availiable

2021-10-24 Thread Richard Hinerfeld


New submission from Richard Hinerfeld :

Please note that test_tk and test_ttk_guionly fail when running testall
when compiling 3.8.9 python from source code.
Compiling on Linux Debian 64-bit bullseye 11.1.0 on a 2008 Mac Book.

--
components: Build
files: TestTK.txt
messages: 404942
nosy: rhinerfeld1
priority: normal
severity: normal
status: open
title: test_tk and test_ttk_guionly fail with resource not availiable
type: compile error
versions: Python 3.8
Added file: https://bugs.python.org/file50393/TestTK.txt

___
Python tracker 

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



[issue45596] Python opens the ./ file on exception while using -c

2021-10-24 Thread Irit Katriel


Irit Katriel  added the comment:

Can you check on 3.11? I believe it was fixed under issue1514420.

--
nosy: +iritkatriel
resolution:  -> duplicate
superseder:  -> Traceback display code can attempt to open a file named 
""

___
Python tracker 

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



[issue45599] Please official support %G, %V and %u directives in time library

2021-10-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> In my use case, the objects hold references to large blocks 
> of GPU memory that should be freed as soon as possible. 

That makes sense.  I can see why you reached for weak references.

Would it be a workable alternative to have an explicit close() method to free 
the underlying resources?  We do this with StringIO instances because relying 
on reference counting or GC is a bit fragile.


> Additionally, I use cached_method to cache expensive hash 
> calculations which the alternatives cannot do because they 
> would run into bottomless recursion.

This is a new concern.  Can you provide a minimal example that recurses 
infinitely with @lru_cache but not with @cached_method?  Offhand, I can't think 
of an example.


> Do you think, in the face of these ambiguities, that the
> stdlib should potentially just not cover this?

Perhaps this should be put on PyPI rather than in the standard library. 

The core problem is that having @cached_method in the standard library tells 
users that this is the recommended and preferred way to cache methods.  However 
in most cases they would be worse off.  And it isn't easy to know when 
@cached_method would be a win or to assess the loss of other optimizations like 
__slots__ and key-sharing dicts.

--

___
Python tracker 

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



[issue45566] dataclasses’s `test_frozen_pickle` does not use all possible `pickle` protocols

2021-10-24 Thread Eric V. Smith


Change by Eric V. Smith :


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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-24 Thread Marten Lienen


Marten Lienen  added the comment:

Central control over the cache and its parameters is definitely a big plus. In 
my use case, the objects hold references to large blocks of GPU memory that 
should be freed as soon as possible. Additionally, I use cached_method to cache 
expensive hash calculations which the alternatives cannot do because they would 
run into bottomless recursion.

Caching methods looks to be significantly more complex than caching functions 
because there are multiple possible priorities, e.g. fast gc, performance, 
cross-instance cache hits, caching __hash__. Do you think, in the face of these 
ambiguities, that the stdlib should potentially just not cover this? Though 
there is already the shared, global cache alternative in applying @lru_cache to 
a method.

--

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

For comparison, here is a recipe that I was originally going to include in the 
FAQ entry but later decided against it.

It only had an advantage over @lru_cache with instances so large that we can't 
wait for them to age out of the cache.  It shouldn't be used if new, equivalent 
instances to be created; otherwise, the hit rate would fall.  The class needs 
to be weak-referenceable, so __weakref__ needs to be a listed field when 
__slots__ are defined.  Also, @weak_lru is slower than @lru_cache.  

Compared to @cached_method in the current PR, @weak_lru creates a single 
unified cache rather than many separate caches.  This gives lower space 
overhead, allows a collective maxsize to be specified, and gives central 
control over cache statistics and clearing.  If the instances support hashing 
and equality tests, the @weak_lru recipe increases the hit rate across 
instances that are equivalent but not identical.

That said, @cached_method is much faster than @weak_lru because it doesn't need 
to create a new ref() on every call and it doesn't need a pure python wrapper.

-

import functools
import weakref

def weak_lru(maxsize=128, typed=False):
'LRU Cache decorator that keeps a weak reference to "self"'

proxy = weakref.proxy

def decorator(func):

_func = functools.lru_cache(maxsize, typed)(func)

@functools.wraps(func)
def wrapper(self, /, *args, **kwargs):
return _func(proxy(self), *args, **kwargs)

return wrapper

return decorator

--

___
Python tracker 

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



[issue45600] First sentence in docs for os.environ

2021-10-24 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj

___
Python tracker 

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



[issue45600] First sentence in docs for os.environ

2021-10-24 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Eryk: sounds much better and clearer I think, I've put up a PR (that also does 
the same update to os.environb).

--

___
Python tracker 

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



[issue45600] First sentence in docs for os.environ

2021-10-24 Thread Andrei Kulakov


Change by Andrei Kulakov :


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

___
Python tracker 

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



[issue45429] [Windows] time.sleep() should use CREATE_WAITABLE_TIMER_HIGH_RESOLUTION

2021-10-24 Thread Dong-hee Na


Dong-hee Na  added the comment:

AS-IS:
average:  0.015609736680984497

TO-BE:
average:  2.7387380599975585e-05

Impressive result :)

--
Added file: https://bugs.python.org/file50392/bpo-45429.py

___
Python tracker 

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



[issue45429] [Windows] time.sleep() should use CREATE_WAITABLE_TIMER_HIGH_RESOLUTION

2021-10-24 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue37658] In some cases asyncio.wait_for can lead to socket leak.

2021-10-24 Thread Sam Bull


Change by Sam Bull :


--
nosy: +dreamsorcerer
nosy_count: 10.0 -> 11.0
pull_requests: +27471
pull_request: https://github.com/python/cpython/pull/29202

___
Python tracker 

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



[issue45600] First sentence in docs for os.environ

2021-10-24 Thread Eryk Sun


Eryk Sun  added the comment:

The os.environ description appears to be worded as the "string environment" in 
contrast to the os.environb "environment as byte strings". I like the emphasis 
on the "process environment". How about "A mapping object of key and value 
strings that represent the process environment"?

--
nosy: +eryksun

___
Python tracker 

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



[issue45600] First sentence in docs for os.environ

2021-10-24 Thread Andrei Kulakov


New submission from Andrei Kulakov :

In os.eviron docs:

https://docs.python.org/3.11/library/os.html#os.environ

A mapping object representing the string environment.

Should that be "... the process environment." ?

--
assignee: docs@python
components: Documentation
messages: 404934
nosy: andrei.avk, docs@python
priority: low
severity: normal
status: open
title: First sentence in docs for os.environ
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



[issue45599] Please official support %G, %V and %u directives in time library

2021-10-24 Thread Raphael


New submission from Raphael :

In the time library documentation (https://docs.python.org/3/library/time.html) 
the directives %G, %V and %u for strftime() are missing, although they work (at 
least for me in Linux Mint):

$ python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from time import strftime
>>> strftime("%G-W%V-%u")
'2021-W42-7'

This seems to be officially supported by the datetime library since 
https://bugs.python.org/issue12006 or at least there is a section for the ISO 
8601 week directives in the datetime documentation:
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes

I would like to see the same for the time library.

--
components: Library (Lib)
messages: 404933
nosy: Raphael
priority: normal
severity: normal
status: open
title: Please official support %G, %V and %u directives in time library
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



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

2021-10-24 Thread Hai Shi


Hai Shi  added the comment:

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

--
nosy: +shihai1991

___
Python tracker 

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



[issue45566] dataclasses’s `test_frozen_pickle` does not use all possible `pickle` protocols

2021-10-24 Thread miss-islington


miss-islington  added the comment:


New changeset 36971fd1f490664fb62b1fab869c5637669f0967 by Miss Islington (bot) 
in branch '3.10':
bpo-45566: `test_frozen_pickle` checks all `pickle` protocols (GH-29150)
https://github.com/python/cpython/commit/36971fd1f490664fb62b1fab869c5637669f0967


--

___
Python tracker 

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



[issue33439] python-config.py should be part of the stdlib

2021-10-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

Yes, this was also proposed here: https://bugs.python.org/issue11602

--

___
Python tracker 

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



[issue44787] Missing valid directive %D in datetime.strftime() documentation

2021-10-24 Thread Raphael


Raphael  added the comment:

Perhaps it could be mentioned more clearly in the datetime documentation that 
apart from the directives of the C89 standard, you can also use those that the 
underlying libc strftime() supports.

The following sentence from 
https://docs.python.org/3/library/time.html#time.strftime describes it well in 
my opinion:
"Additional directives may be supported on certain platforms, but only the ones 
listed here have a meaning standardized by ANSI C."

Perhaps a reference to "man strftime" would also be helpful.

--
nosy: +Raphael

___
Python tracker 

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



[issue45566] dataclasses’s `test_frozen_pickle` does not use all possible `pickle` protocols

2021-10-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27470
pull_request: https://github.com/python/cpython/pull/29201

___
Python tracker 

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



[issue45566] dataclasses’s `test_frozen_pickle` does not use all possible `pickle` protocols

2021-10-24 Thread miss-islington


miss-islington  added the comment:


New changeset 07236d562e59c6650227be18fa6ffc66b18d4741 by Nikita Sobolev in 
branch 'main':
bpo-45566: `test_frozen_pickle` checks all `pickle` protocols (GH-29150)
https://github.com/python/cpython/commit/07236d562e59c6650227be18fa6ffc66b18d4741


--
nosy: +miss-islington

___
Python tracker 

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



[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-24 Thread Ian Fisher


Change by Ian Fisher :


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

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-24 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27468
pull_request: https://github.com/python/cpython/pull/29199

___
Python tracker 

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



[issue45598] setup.py grep_headers_for() is broken by design

2021-10-24 Thread Christian Heimes


Christian Heimes  added the comment:

If we remove grep_headers_for(), then we can also close bpo-42325

--

___
Python tracker 

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



[issue45598] setup.py grep_headers_for() is broken by design

2021-10-24 Thread Christian Heimes


New submission from Christian Heimes :

The setup.py helper function grep_headers_for() is used by ctypes build step to 
search header files for functions. The function kinda works on most platforms, 
but only by accident. On my system it opens all header files that match 
/usr/include/*.h and returns true if any (!) header file contains the string 
(!) "ffi_prep_cif_var". The check would also match "ffi_prep_cif_var" in a 
comment of an unrelated header file.

We cannot limit the search to "ffi.h" only, because that would break multiarch 
builds with a header file like this:

#if defined(__i386__)
#include "ffi-i386.h"
#elif defined(__powerpc64__)
#include "ffi-ppc64.h"
...

Solutions:

1) Use "AC_EGREP_HEADER" autoconf macro. It runs a header file through the C 
preprocessor
2) Use AC_LINK_IFELSE autoconf macro. This macro compiles and links code to 
detect if a library exports a function.
3) Re-implement any of the macros in pure Python (ugh!)
4) Just assume that libffi supports ffi_prep_cif_var, ffi_prep_closure_loc, and 
ffi_closure_alloc on our target platforms. According to [1] the functions have 
been around for over a decade.

I favor (4).

Ned, what about USING_APPLE_OS_LIBFFI? Is it still relevant?

[1] 
https://github.com/libffi/libffi/blame/48bdb02867edb7e9f3785ccb4bdff1087fb44246/include/ffi.h.in#L309

--
components: Build, ctypes
messages: 404926
nosy: amaury.forgeotdarc, belopolsky, christian.heimes, meador.inge, ned.deily
priority: normal
severity: normal
status: open
title: setup.py grep_headers_for() is broken by design
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue45597] os.path.realpath returns invalid path for junction pointing to letter-less volume

2021-10-24 Thread Eryk Sun


Eryk Sun  added the comment:

This is from checking whether the \\?\ prefix can be stripped. The 
_getfinalpathname() call that it makes fails with the initial winerror 
(ERROR_PATH_NOT_FOUND), since nt._getfinalpathname() still lacks support for 
volume GUID paths. In this case, it assumes the path doesn't exist and removes 
the prefix. 

This check should be skipped for all prefixed paths if they aren't drives or 
UNC shares. For example, if colon_sep (i.e. ":\\") is defined:

# The path returned by _getfinalpathname will always start with \\?\ -
# strip off that prefix unless it was already provided on the original
# path.
if not had_prefix and path.startswith(prefix):
# For UNC paths, the prefix will be \\?\UNC\
if path.startswith(unc_prefix):
spath = new_unc_prefix + path[len(unc_prefix):]
# For drive paths, the root is of the form \\?\X:\
elif path.startswith(colon_sep, len(prefix) + 1):
spath = path[len(prefix):]
# For all others, the prefix must be retained.
else:
spath = None
if spath is not None:
# Ensure that the non-prefixed path resolves to the same path
try:
if _getfinalpathname(spath) == path:
path = spath
except OSError as ex:
# If the path does not exist and originally did not exist, 
then
# strip the prefix anyway.
if ex.winerror == initial_winerror:
path = spath
return path

--
nosy: +eryksun

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-24 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 23.10.2021 21:30, Christian Heimes wrote:
> 
> The trick would move the math function back into the core. Mark moved the 
> math functions out of the core on purpose, see bpo-7518.

I don't follow you. With the _math.o target in Makefile.pre.in,
_math.c was always compiled into the main Python interpreter,
even with math and cmath built as shared libs.

And yes, it does export a symbol, but _Py_log1p is not going to
conflict with anything else out there :-)

The trick is essentially not changing the 3.10 status quo. It
only makes sure that _math.o is compiled in the same way as all
other Setup managed modules and moves the target from Makefile.pre.in
to the makesetup section of the final Makefile.

And it removes the warning of having multiple _math.o targets
ending up in the Makefile, which isn't problematic, since make
will always use the last definition (from the makesetup section),
but doesn't look nice either.

OTOH, _math.h and .c are really small, so perhaps it's better
to merge both into a single _math.h file and include that directly
into the modules. I believe that's what Brett's patch does, right ?

Today, only the _Py_log1p() code is actually used and then only
to address a very special case in a platform independent way
(log1p(-0.0) == -0.0), so the whole code boils down to some 10
lines of C being incorporated.

--

___
Python tracker 

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



[issue45597] os.path.realpath returns invalid path for junction pointing to letter-less volume

2021-10-24 Thread Basil Peace


New submission from Basil Peace :

If a path contains a junction pointing to a dir on a letter-less drive then 
`os.path.realpath` returns `Volume{}\dir`, without `\\?\` prefix. 

This path, of course, doesn't work correctly. Actually, it looks relative.

Original issue: https://github.com/pypa/pip/issues/10597

--
components: Windows
messages: 404923
nosy: grv87, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.path.realpath returns invalid path for junction pointing to 
letter-less volume
versions: Python 3.10, 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



[issue45596] Python opens the ./ file on exception while using -c

2021-10-24 Thread Julien Palard


New submission from Julien Palard :

When running `python -c 'raise ValueError'` Python tries to open the '' 
file, so:

$ echo Coucou > ''
$ python -c 'raise ValueError'
Traceback (most recent call last):
  File "", line 1, in 
Coucou
ValueError

--
messages: 404922
nosy: mdk
priority: normal
severity: normal
status: open
title: Python opens the ./ file on exception while using -c

___
Python tracker 

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



[issue45595] [Build] Make extensions depend on header files

2021-10-24 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue45595] [Build] Make extensions depend on header files

2021-10-24 Thread Christian Heimes


New submission from Christian Heimes :

Any change to a Python header file triggers a rebuild of Python core objects. 
The extension modules are not automatically rebuild in several cases. This is 
slightly annoying for core development because it forces me to do ``make 
clean`` too often.

* setup.py adds dependencies on Includes/*.h but not on header files in 
"internal" and "cpython" subdirectory
* Modules/Setup and makesetup do not add a dependency on PYTHON_HEADERS
* Modules/Setup is also missing dependencies on module-specific headers, e.g. 
_sre.o should depend on sre.h.

--
assignee: christian.heimes
components: Build
messages: 404921
nosy: brett.cannon, christian.heimes
priority: normal
severity: normal
status: open
title: [Build] Make extensions depend on header files
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



[issue2628] ftplib Persistent data connection

2021-10-24 Thread mike mcleod


mike mcleod  added the comment:

Hi,

I would like to help on this issue.

--
nosy: +mikecmcleod

___
Python tracker 

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



[issue45594] Feature Request: add EHOSTUNREACH subclass to ConnectionError

2021-10-24 Thread Nathan Collins


Nathan Collins  added the comment:

Apparently the existing ConnectionError and its subclasses were added as part 
of PEP 3151, tracked here: https://bugs.python.org/issue12555 .

--

___
Python tracker 

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



[issue45524] Cross-module dataclass inheritance breaks get_type_hints

2021-10-24 Thread Nikita Sobolev

Nikita Sobolev  added the comment:

In my opinion, it is never a bad thing to create a new issue :)

сб, 23 окт. 2021 г. в 22:46, Sergei Lebedev :

>
> Sergei Lebedev  added the comment:
>
> Is it worth filing a separate issue for locals()?
>
> In my experience local classes are less common than cross-module
> inheritance, so I suspect that the chances of someone accidentally hitting
> lack of locals() forwarding are quite low. However, given how confusing the
> error message is, it might be worth having an issue for that. Wdyt?
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue45594] Feature Request: add EHOSTUNREACH subclass to ConnectionError

2021-10-24 Thread Nathan Collins


New submission from Nathan Collins :

WHAT

It would be nice if there was a special-case subclass of the standard library 
OSError/ConnectionError class for C EHOSTUNREACH (a.k.a. "no route to host") 
errors. Currently there are special-case subclasses of ConnectionError for 
several other types of connection errors, namely BrokenPipeError, 
ConnectionAbortedError, ConnectionRefusedError and ConnectionResetError. I'm 
asking that a new, similar subclass called HostUnreachableError be added, 
corresponding to C errno EHOSTUNREACH.

HOW

I believe this is as simple as adding four lines to CPython's exceptions.c, 
e.g. following ECONNABORTED's special treatment via the ConnectionAbortedError 
subclass there.

WHY

These special case OSError/ConnectionError exceptions are useful for several 
reasons. First, they give human friendly names to an otherwise less helpful 
OSError exceptions. Second, they make it easier to write portable code, because 
different OSes use different C errno numbers for the corresponding C error. For 
example, EHOSTUNREACH is errno 113 on Linux [1] and 110 on Windows [2].

[1] 
https://github.com/torvalds/linux/blob/9c0c4d24ac000e52d55348961d3a3ba42065e0cf/include/uapi/asm-generic/errno.h#L96
[2] 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/errno-constants?view=msvc-160

--
components: Library (Lib)
messages: 404917
nosy: ntc2
priority: normal
severity: normal
status: open
title: Feature Request: add EHOSTUNREACH subclass to ConnectionError
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



[issue44805] asyncio.StreamReader.read hangs for reused socket file descriptors when asyncio.StreamWriter.close() is not called

2021-10-24 Thread Nathan Collins


Nathan Collins  added the comment:

Just wanted to clarify: my previous "where everything works" comment is not 
saying this bug doesn't exist, I just mean I missed one case in my analysis of 
the bug. The bug is very much there, and easy to reproduce using the example 
programs I attached.

Bump!

--

___
Python tracker 

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