[issue45545] chdir __exit__ is not safe

2021-10-25 Thread Eryk Sun


Eryk Sun  added the comment:

> Alternatively, can't we just os.chdir(self._old_cwd) in __enter__ and 
> preemptively fail? 

If the context manager isn't going to address the long-path case reliably using 
either a file-descriptor approach or repeated relative chdir() calls, then I 
think failing early like this is the next best choice.

The previous directory getting deleted is a random environment error, which can 
be left up to the caller. In POSIX, it might be avoidable using a 
file-descriptor approach, but POSIX doesn't actually guarantee that fchdir() 
will succeed if the file descriptor refers to a deleted directory.

--

___
Python tracker 

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



[issue45466] Simple curl/wget-like download functionality in urllib (like http offers server)

2021-10-25 Thread Tom Pohl


Tom Pohl  added the comment:

Thanks, Terry, for the hint.

The idea got some support on python-ideas, so I thought it is worthwhile to do 
a PR. As a first-time contributor, I now have to wait for approval for the 
pipeline to run...

--

___
Python tracker 

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



[issue22789] Compress the marshalled data in PYC files

2021-10-25 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue45545] chdir __exit__ is not safe

2021-10-25 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

> A LBYL won't always raise errors early as you point out. It will give earlier 
> warnings for a lot of cases, but makes contextlib.chdir usable in less places 
> than os.chdir.
> Some return paths will always be errors, and some will be technically 
> recoverable but too difficult to detect and or fragile. That's why I think 
> any solution should incorporate the `ignore_errors` flag. Its pretty ugly to 
> wrap a context manager in a try: except: just because you were trying to 
> clean up after whatever you were doing but the cwd changed in unexpected 
> ways, maybe out of your control.

How common do you expect such errors to be though?  Do you expect them to be 
more or less common than with os.chdir()?  Do you expect the mitigations to be 
any different than with a failing os.chdir()?

I’ve certainly written a chdir context manager several times and for the use 
cases I care about, I’ve never had such a failure, at least not one that wasn’t 
caused by some other underlying bug, which I was glad wasn’t silenced.

--

___
Python tracker 

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



[issue36675] Doctest directives and comments missing from code samples

2021-10-25 Thread Ming Hua


Change by Ming Hua :


--
nosy: +minghua

___
Python tracker 

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



[issue45545] chdir __exit__ is not safe

2021-10-25 Thread Jeremy


Jeremy  added the comment:

A LBYL won't always raise errors early as you point out. It will give earlier 
warnings for a lot of cases, but makes contextlib.chdir usable in less places 
than os.chdir.
Some return paths will always be errors, and some will be technically 
recoverable but too difficult to detect and or fragile. That's why I think any 
solution should incorporate the `ignore_errors` flag. Its pretty ugly to wrap a 
context manager in a try: except: just because you were trying to clean up 
after whatever you were doing but the cwd changed in unexpected ways, maybe out 
of your control.

--

___
Python tracker 

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



[issue45610] Cookies with longer paths are listed before cookies with shorter paths.

2021-10-25 Thread IYism


New submission from IYism :

E.g:
Set-Cookie: a=1; Domain=test.com;  Path=/
Set-Cookie: a=2; Domain=demo.test.com; Path=/

Browser send Cookie: a=2; a=1


According to the agreed specification, a=2 should be read first, not a=1

But the wrong behavior of python is that the cookie reads a=1 by default

--
components: Library (Lib)
messages: 405020
nosy: FFY00, IYism
priority: normal
pull_requests: 27486
severity: normal
status: open
title: Cookies with longer paths are listed before cookies with shorter paths.
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue45545] chdir __exit__ is not safe

2021-10-25 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

Does a LBYL strategy actually fix the problem?  E.g. what if the directory gets 
rm'd between __enter__ and __exit__?  Maybe we shouldn't try to be clever at 
all and just leave it to the user to decide what to do, and how to handle any 
chdir-back failures?  Keep it simple?

--

___
Python tracker 

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



[issue45350] configure incorrectly ignores pkg-config information for libffi and Tcl/Tk in 3.10

2021-10-25 Thread Ned Deily


Ned Deily  added the comment:

Note that we have since discovered that the fix for this problem inadvertently 
did not make it into the 3.10.0 release. It is in the current 3.10 branch and 
will be in 3.10.1, the first bugfix release for 3.10.

--

___
Python tracker 

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



[issue45096] Update Tools/freeze to make use of Tools/scripts/freeze_modules.py?

2021-10-25 Thread Eric Snow


Change by Eric Snow :


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

___
Python tracker 

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



[issue11477] Incorrect operand precedence when implementing sequences in C

2021-10-25 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Given that a lot of code is presumably relying on this (see the notes from 
2015)... I wouldn't be surprised if this turns into a wart we document but not 
actually fix. :/

Or a conditional behavior we control via a `from __future__ import 
correct_extension_operator_precedence` on a per file / per Notebook basis.

Ever actually flipping the default sounds difficult without disruption.  We'd 
need input from the community where extensions that rely on it have been 
produced and widely deployed.

--

___
Python tracker 

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



[issue45607] Make it possible to enrich an exception's error message

2021-10-25 Thread Zac Hatfield-Dodds


Zac Hatfield-Dodds  added the comment:

This code shows my current best workaround based on a wrapper exception, with 
the traceback below annotating the additional details that I'd prefer to omit 
for clarity:


$ python example.py
Traceback (most recent call last):
  File "example.py", line 8, in 
raise AssertionError(why)
AssertionError: Failed!
# These 
lines are
The above exception was the direct cause of the following exception:# 
confusing for new 
# 
users, and they
Traceback (most recent call last):  # only 
exist due 
  File "example.py", line 10, in# to 
implementation
raise Explanation(msg) from e   # via 
the Explanation
Explanation:# 
wrapper type :-(
You can reproduce this error by ...
...


The motivation for this is that we'd like to use ExceptionGroup to indicate 
that `MultipleFailures` is a group of exceptions, and replace our current 
print()-based method of reporting the details of the inner exceptions.

--

___
Python tracker 

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



[issue45609] Specialize STORE_SUBSCR

2021-10-25 Thread Dennis Sweeney


Change by Dennis Sweeney :


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

___
Python tracker 

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



[issue45609] Specialize STORE_SUBSCR

2021-10-25 Thread Dennis Sweeney


New submission from Dennis Sweeney :

See the issue here for lots of data from before specializing: 
https://github.com/faster-cpython/ideas/issues/105

See https://gist.github.com/sweeneyde/91855e50feb9992b604ddda2d4f1511e for 
specialization data, pyperformance benchmarks, and microbenchmarks.

Right now the PR draft specializes list[int], dict[str], and bytearray[int], 
although I don't if the bytearray opcode should be kept. I considered 
specializing dict[object], but I figured the overhead of PyDict_SetItem isn't 
that much less than PyObject_SetItem.

--
components: Interpreter Core
messages: 405015
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Specialize STORE_SUBSCR
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



[issue2628] ftplib Persistent data connection

2021-10-25 Thread Ethan Furman


Ethan Furman  added the comment:

We don't have a CLA from jbell.  I've sent an email asking him to do so... 
we'll see what happens.

--
nosy: +ethan.furman

___
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-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> The lru_cache can trigger infinite recursion if it is used 
> to cache a hash computation because the cache look-up itself 
> requires the hash.

Yes, I see the problem.  Am not sure whether I should add a note to the docs 
for this.


> The dataclass thing also makes close() awkward because
> then I would have an outwardly resource-ful dataclass 
> which is against the spirit of a dataclass.

If you think of a dataclass as just a data holder like a mutable named tuple, I 
can see where the notion of the "spirit of dataclass" comes from.

However, if you think of it as a code generator for handling the boilerplate 
code in a more complex class, the only "spirit" is to do anything that any 
other class does.

For objects that hold resources, an explicit close() method is common and well 
supported (i.e. contextlib.closing and generator.close()).  It is a perfectly 
reasonable thing to do.

That said, it's a matter of taste.  Just do what works best for you.


> I will think about putting this on pypi instead.

If you do post it, let me know.  I'll add a link to it from the FAQ entry.

--

___
Python tracker 

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



[issue45607] Make it possible to enrich an exception's error message

2021-10-25 Thread Andre Roberge


Change by Andre Roberge :


--
nosy: +aroberge

___
Python tracker 

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



[issue45545] chdir __exit__ is not safe

2021-10-25 Thread Filipe Laíns

Change by Filipe Laíns :


--
pull_requests: +27483
pull_request: https://github.com/python/cpython/pull/29220

___
Python tracker 

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



[issue45545] chdir __exit__ is not safe

2021-10-25 Thread Filipe Laíns

Filipe Laíns  added the comment:

s/if we can chdir/if we can't chdir/

--

___
Python tracker 

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



[issue45545] chdir __exit__ is not safe

2021-10-25 Thread Filipe Laíns

Filipe Laíns  added the comment:

Alternatively, can't we just os.chdir(self._old_cwd) in __enter__ and 
preemptively fail? IMO it's probably better to just straight up fail if we can 
chdir back to the original directory than to have relatively fragile recovery 
logic.

--

___
Python tracker 

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



[issue45504] [argparse] Entering a partial config_parser flag works with subparsers

2021-10-25 Thread Steven W


Steven W  added the comment:

Thanks. This can be closed.

https://docs.python.org/3/library/argparse.html

--

___
Python tracker 

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



[issue41592] Make _SubParsersAction public

2021-10-25 Thread paul j3


paul j3  added the comment:

A _SubParsersAction is private to the extent that users should not attempt to 
create it directly, and thus don't need to know the details - beyond what's 
documented:

"The add_subparsers() method is normally called with no arguments and returns a 
special action object. This object has a single method, add_parser(), which 
takes a command name and any ArgumentParser constructor arguments, and returns 
an ArgumentParser object that can be modified as usual."

All action objects have methods like __call__ and format_usage. The subparsers 
Action has other methods, but add_parser is the only new "public" method.

There's a tension in writing documentation between getting all details just 
right, and providing just enough for most users.  As it is, many new users are 
over whelmed by the documentation.

My understanding is that the "private/public" designation is a convenience for 
users, and not enforced by Python developers.  

I gather though that some corporate users have policies that prohibit 
modification of "private" objects, supposedly due to a fear that Python could 
modify or eliminate those objects without proper notification.  Somehow the 
"public" documentation sets that part of the code in stone.  My experience here 
is that it's easier modify the documentation to fit the code than the other way 
around :)

--

___
Python tracker 

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



[issue39846] Register .whl as a unpack format in shutil unpack

2021-10-25 Thread John Andersen


John Andersen  added the comment:

I ran into this today. Using a wrapper function around _make_zipfile due to 
https://github.com/python/cpython/blob/d5650a1738fe34f6e1db4af5f4c4edb7cae90a36/Lib/shutil.py#L817-L819
 where there is a check for if the format is zip then don't pass owner and 
group.

```
def make_whlfile(*args, owner=None, group=None, **kwargs):
return shutil._make_zipfile(*args, **kwargs)


shutil.register_archive_format("whl", make_whlfile, description="Wheel file")
shutil.register_unpack_format(
"whl", [".whl"], shutil._unpack_zipfile, description="Wheel file"
)
```

--
nosy: +pdxjohnny

___
Python tracker 

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



[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-25 Thread paul j3


paul j3  added the comment:

parser = argparse.ArgumentParser()
sub = parser.add_subparsers()
example_subparser = sub.add_parser("example")
example_subparser.add_argument("--flag", default=10)
print(parser.parse_args(["example","--flag=15"], 
argparse.Namespace(flag=20)))

still returns flag=20

User input should override values set by the provided Namespace.

--

___
Python tracker 

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



[issue45607] Make it possible to enrich an exception's error message

2021-10-25 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +Zac Hatfield-Dodds

___
Python tracker 

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



[issue45607] Make it possible to enrich an exception's error message

2021-10-25 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue2771] Test issue

2021-10-25 Thread Ezio Melotti


Change by Ezio Melotti :


--
assignee: python-dev -> ezio.melotti

___
Python tracker 

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



[issue2771] Test issue

2021-10-25 Thread Ezio Melotti


Change by Ezio Melotti :


--
assignee: python-dev -> 

___
Python tracker 

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



[issue2771] Test issue

2021-10-25 Thread Ezio Melotti


Change by Ezio Melotti :


--
assignee:  -> python-dev

___
Python tracker 

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



[issue2771] Test issue

2021-10-25 Thread Ezio Melotti


Change by Ezio Melotti :


--
assignee: ezio.melotti -> python-dev
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



[issue45591] PathFinder does not find namespace packages children

2021-10-25 Thread Filipe Laíns

Filipe Laíns  added the comment:

Ah, this was not obvious to me! I did not specify a path, but as it defaults to 
`sys.path` and `namespace.a` is available there, I was expecting it to find it.
One of the things that threw me off was the first arguments being called 
`fullname`, which I assumed implied that `PathFinder` was able to do a 
recursive search.


This indeed works:
```
$ ./python
Python 3.11.0a1+ (heads/main:9e05da6224, Oct 23 2021, 20:36:14) [GCC 11.1.0] on 
linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.machinery import PathFinder
>>> spec = PathFinder.find_spec('namespace')
>>> PathFinder.find_spec('a', path=spec.submodule_search_locations)
ModuleSpec(name='a', loader=<_frozen_importlib_external.SourceFileLoader object 
at 0x7f245d0d3e80>, origin='/home/anubis/git/cpython/namespace/a.py')
```

I should have validated if normal packages also had the same behavior, which 
they do, before opening this -.-

I am curious, what is `fullname` supposed to mean then? "full" in what sense?

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



[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2021-10-25 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +vstinner

___
Python tracker 

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



[issue17569] urllib2 urlopen truncates https pages after 32768 characters

2021-10-25 Thread Irit Katriel


Irit Katriel  added the comment:

Python 2.7 is no longer maintained. Please create a new issue if you are seeing 
this problem on 3.9+.

--
nosy: +iritkatriel
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue33552] f-strings and string annotations

2021-10-25 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -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



[issue45608] [sqlite3] some DB-API attributes are undocumented

2021-10-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue45608] [sqlite3] some DB-API attributes are undocumented

2021-10-25 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Some DB-API 2.0 attributes are undocumented:

- apilevel
- threadsafety
- paramstyle

These attributes should be documented.


See also:
- bpo-8196
- 
https://discuss.python.org/t/is-sqlite3-threadsafety-the-same-thing-as-sqlite3-threadsafe-from-the-c-library/11463

--
assignee: docs@python
components: Documentation
messages: 405004
nosy: docs@python, erlendaasland, lemburg
priority: normal
severity: normal
status: open
title: [sqlite3] some DB-API attributes are undocumented
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



[issue35174] Calling for super().__str__ seems to call self.__repr__ in list subclass

2021-10-25 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue31594] Make bytes and bytearray maketrans accept dictionaries as first argument as it's done in str

2021-10-25 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
type: behavior -> enhancement

___
Python tracker 

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



[issue11477] Incorrect operand precedence when implementing sequences in C

2021-10-25 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.6

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-10-25 Thread Eric Snow


Eric Snow  added the comment:


New changeset 6afb285ff0790471a6858e44f85d143f07fda70c by Eric Snow in branch 
'main':
bpo-45020: Add tests for the -X "frozen_modules" option. (gh-28997)
https://github.com/python/cpython/commit/6afb285ff0790471a6858e44f85d143f07fda70c


--

___
Python tracker 

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



[issue13298] Result type depends on order of operands for bytes and bytearray

2021-10-25 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.3

___
Python tracker 

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



[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2021-10-25 Thread Irit Katriel


Irit Katriel  added the comment:

Martin's patch needs to be converted to a GitHub PR and then reviewed.

--
keywords: +easy -patch
nosy: +iritkatriel
title: Scope for raise without argument is different in Python 2 and 3 -> [doc] 
Scope for raise without argument is different in Python 2 and 3
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5, Python 3.6

___
Python tracker 

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



[issue45545] chdir __exit__ is not safe

2021-10-25 Thread Jeremy


Change by Jeremy :


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

___
Python tracker 

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



[issue45607] Make it possible to enrich an exception's error message

2021-10-25 Thread Irit Katriel


New submission from Irit Katriel :

The requirement comes from Hypothesis, see
https://github.com/python/cpython/pull/28569#discussion_r730338369

It is necessary there to add a note to an exception describing which test case 
it comes from. The note should be printed by __str__ of this exception. 


class Explanation(Exception):
__module__ = "builtins"
def __str__(self) -> str:
return f"\n{self.args[0]}"

try:
why = "Failed!"
raise AssertionError(why)
except Exception as e:
msg = "You can reproduce this error by ...\n..."
raise Explanation(msg) from e

# Ideally something more like:
e.__note__ = msg
raise

--
components: Interpreter Core
messages: 404999
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Make it possible to enrich an exception's error message
type: enhancement

___
Python tracker 

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



[issue15795] Zipfile.extractall does not preserve file permissions

2021-10-25 Thread Selim Belhaouane


Change by Selim Belhaouane :


--
nosy: +selimb

___
Python tracker 

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



[issue45466] Simple curl/wget-like download functionality in urllib (like http offers server)

2021-10-25 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy:  -terry.reedy

___
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-25 Thread Sam Bull

Sam Bull  added the comment:

Can I get a review? 
https://github.com/python/cpython/pull/29202

Seems like a simple mistake given the original description of this issue:

> 1. the inner task is completed and the outer task will receive the result – 
> transport and protocol in this case
> 2. The inner task is cancelled and no connection was established

The try/except blocks clearly add a 3rd condition, where the inner task is 
completed and a TimeoutError is raised without returning the result.

--

___
Python tracker 

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



[issue45466] Simple curl/wget-like download functionality in urllib (like http offers server)

2021-10-25 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 2.0 -> 3.0
pull_requests: +27479
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/29217

___
Python tracker 

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



[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-10-25 Thread Rasmus Bondesson


New submission from Rasmus Bondesson :

Create a symlink that points to file that doesn't exist:

ln -s /nonexisting_file my_symlink

Then try to glob for that symlink from Python using pathlib:

python3
>>> import pathlib
>>> list(pathlib.Path(".").glob("my_symlink"))
[]
>>> list(pathlib.Path(".").glob("my_symlink*"))
[PosixPath('my_symlink')]

I'm a bit surprised that these two globs do not return the same results. 
Personally I would expect both to find the symlink.

Is this behaviour a bug or is it intentional?

--
components: Library (Lib)
messages: 404996
nosy: raek
priority: normal
severity: normal
status: open
title: pathlib.Path.glob() does not list dangling symlink when pattern is the 
exact filenane
type: behavior
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



[issue45592] NamespaceLoader does not implement create_module or exec_module

2021-10-25 Thread Brett Cannon


Brett Cannon  added the comment:

create_module() being empty is on purpose: 
https://docs.python.org/3/library/importlib.html#importlib.abc.Loader.create_module
 . You only define create_module() if you need a specific type of object for 
the module instance.

--

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

> The issue is that this feature is internally inconsistent (isinstance() is 
> not consistent with issubclass()),

issubclass(x, list[int]) rejects the second argument for reasons explained in 
the PEP. I don't think from that reasoning you can infer that list[int] is not 
a type. Rather the contrary -- if it's not a type the PEP could just have said 
"it's not a type" but it doesn't, it says "it's unacceptable as second arg to 
issubclass()". In fact, the PEP uses language ("instances of parameterized 
collections") that makes me think in the PEP author's mind list[int] *is* a 
type.

> the C implementation of list[int] is not consistent with the Python 
> implementation of List[int],

Consistency with typing was not a goal of the PEP.

> and a lot of code was not tested with this feature,

What other places are there that are broken because of this?

> so we perhaps have a lot of bugs in the stdlib and in the third-party 
> libraries.

Without more evidence this sounds like speculation. *With* evidence you might 
well convince me.

> Are we going to backport changes for making code working with GenericAlias as 
> a type to 3.9 and 3.10?

I'm fine with backporting the fix in the PR, GH-29212.

> If not, we will actually add new features in 3.11 and keep 3.9 and 3.10 
> broken. If yes, these changes can have larger effect than just making 
> isinstance(list[int], type) returning False, and they can break more code.

Are there other fixes you already know about besides GH-29212? That PR seems 
100% beneficial.

> Note also that isinstance(List[int], type) was True before 3.7, and we 
> intentionally made it False in 3.7 (it was required significant rewriting of 
> the typing module and introducing __mro_entries__). Do we want to revert this 
> decision?

I don't recall why we changed that, I thought it was a side effect of making 
the implementation faster, not because of a decision that we didn't want these 
to be treated as types. I looked at inspect.py in 3.6, and it seems its 
formatannotation() has a special case for annotations that come from the typing 
module (like List[int]). I guess nobody thought to have a test for that, so the 
bug in inspect.py slipped by when it was introduced in 3.9 -- we're relying on 
Raymond's keen eye here. But if we had had such a test, and it had alerted us 
to the problem in 3.9 when types.GenericAlias was introduced, I expect that we 
would have fixed it just like martinitus does in his PR.

Anyway, I am willing to be swayed by evidence, but this bug in inspect.py isn't 
enough.

--

___
Python tracker 

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



[issue45591] PathFinder does not find namespace packages children

2021-10-25 Thread Brett Cannon


Brett Cannon  added the comment:

You didn't specify the path to search in to find `a`. 
https://docs.python.org/3/library/importlib.html#importlib.machinery.PathFinder.find_spec
 says that PathFinder only has class methods, which means find_spec() won't 
know where 'namespace' is, so the search will fail to find anything, hence 
returning None.

--

___
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-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 2b8677a3cd855eb3a579894c64588eab0e006269 by Christian Heimes in 
branch 'main':
bpo-45548: FreeBSD doesn't like auto vars in makesetup (GH-29216)
https://github.com/python/cpython/commit/2b8677a3cd855eb3a579894c64588eab0e006269


--

___
Python tracker 

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



[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-25 Thread paul j3


paul j3  added the comment:

I just downloaded this `argparse.py`.

This change makes it impossible to use a subparser argument if it is defined in 
the user provided namespace, or by the main parser.  It blocks not only 
subparser default, but also user input.

It has reverted the 9351 patch which dates to 2014.

--

___
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-25 Thread Christian Heimes


Change by Christian Heimes :


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



[issue45548] Update Modules/Setup

2021-10-25 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27478
pull_request: https://github.com/python/cpython/pull/29216

___
Python tracker 

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



[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-25 Thread paul j3


paul j3  added the comment:

I haven't studied or tested this change, but it looks like a partial retraction 
of

https://bugs.python.org/issue9351 
argparse set_defaults on subcommands should override top level set_defaults

Originally the main namespace was passed to the subparser.  Steven Bethard 
changed it so that the subparser got a fresh namespace, and all values were 
copied to the main namespace.

I and others raised the question of how it affected user provided values 

https://bugs.python.org/issue27859
argparse - subparsers does not retain namespace

Looks like this patch tries to solve some problems by moving the self._defaults 
step to the end of parser_know_args.  I view that change with some trepidation. 
 Handling defaults is tricky enough, with setting them at the start, but then 
only passing them through 'type' at the end if they still match the original 
strings.

Mostly I've been telling StackOverflow questioners that it best not to use the 
same argument 'dest' in both the main and subparsers.  Flags can be the same, 
but the 'dest' should be different to avoid conflicts over which default has 
priority.

Again, I haven't tested this change, but I have a gut feeling it could have 
backward compatibility issues.

--

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-10-25 Thread Irit Katriel


Irit Katriel  added the comment:

Martin, would you like to submit a patch with this addition to the doc?

--

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-10-25 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I've been thinking that perhaps it makes sense to special case printing of 
`self` argument in `__init__` methods. The same exact issue happens with PDB 
`args` command in `__init__` methods.

My idea is that in the __init__, you generally don't want to print `self`  arg 
and trying to do so can cause this type of unexpected errors.

The reason is that __repr__ is not designed to be used for objects with 
unfinished initialization, because even if it doesn't break, it will give you 
incomplete or even misleading representation.

In case when __init__ has some complex logic that can raise an exception, it's 
likely that other local variables will help you identify the object. If there 
is no complex logic or other arguments, and __init__ still failed, you can say 
that there wasn't yet an actual object that can be uniquely represented.

Therefore I think it makes sense to simply omit representing `self` arg (or 
first arg of the method) in both `StackSummary.extract()` and PDB `args` 
command. It may break some existing code but I think it would be a small amount 
of code affected. Because of this it can only go into 3.11 version. I feel like 
on the balance it would be a good change to make, but I'm curious to hear other 
opinions.

--

___
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-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset ece916e92ce76cfdbfd208605a6fc827db0fbd52 by Christian Heimes in 
branch 'main':
bpo-45548: Add missing extensions to Modules/Setup (GH-29199)
https://github.com/python/cpython/commit/ece916e92ce76cfdbfd208605a6fc827db0fbd52


--

___
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-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 81669d1b7bd668d1bd0fab92836e8b5e7976e362 by Christian Heimes in 
branch 'main':
bpo-45595: Make extensions depend on header files (GH-29198)
https://github.com/python/cpython/commit/81669d1b7bd668d1bd0fab92836e8b5e7976e362


--

___
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-25 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

`Misc/python-config.in` ultimately becomes a Python script that prints things 
to stdout.  It isn't written to be a module as is.  Any work to make it one is 
effectively writing entirely new code to do what it does.

To keep a single source of truth for `python-config` behavior instead of having 
two as we do today (as doko noted in bpo-16235), while still exposing the 
values it provides for use from Python I suggest:

1. Get rid of the `Misc/python-config.in` python code.
2. Use `Misc/python-config.sh.in` exclusively.
3. Enhancing _that_ to be able to generate a tiny data-only 
`sysconfig.configure` module. 
4. Invoke `python-config.sh --generate-sysconfig-bits` during build time to 
generate a `sysconfig/configure.py`.

This should reduce the maintenance burden and is kinder to cross-compiliation 
builds (which we generally are lousy at supporting despite their importance to 
the world, so our bar today is merely "not regressing").


All that said, in what contexts would having anything that python-config 
produces today be available from sysconfig be useful?

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-25 Thread paul j3


Change by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

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



[issue45504] [argparse] Entering a partial config_parser flag works with subparsers

2021-10-25 Thread paul j3


paul j3  added the comment:

As a default option flags can be abbreviated (unless there's a conflict).  
Recent version have a allow_abbrev parameter that lets you turn this off.

--
nosy: +paul.j3

___
Python tracker 

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



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

2021-10-25 Thread paul j3


paul j3  added the comment:

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

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

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

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

--
nosy: +paul.j3

___
Python tracker 

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



[issue41592] Make _SubParsersAction public

2021-10-25 Thread Eric Pederson


Eric Pederson  added the comment:

But is _SubParsersAction really private if there are methods on it that are 
required to use (add_parser())?

--

___
Python tracker 

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



[issue45580] argparse.ArgumentParser.add_mutually_exclusive_group : metavar create parenthesis undefined behavior

2021-10-25 Thread paul j3


paul j3  added the comment:

The usage formatting is fragile, with many associated bug reports.  Until 
someone does a major rewrite, it is best to avoid special characters, 
especially `()` and `[]` in the `dest` or `metavar`.

Usage uses () to encolde mutually_exclusive_groups and [] to mark non-required 
arguments.  Don't confuse your users (or argparse) with other uses of these 
characters.

--
nosy: +paul.j3

___
Python tracker 

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



[issue41592] Make _SubParsersAction public

2021-10-25 Thread paul j3


paul j3  added the comment:

`add_argument` also returns a Action subclass object.  All of those subclasses 
are "private".  While that return reference is usually ignored, sometimes it is 
useful to it, assigning it to a variable or list.  The documentation could be 
clearer about access to Action objects.

--
nosy: +paul.j3

___
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-25 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 77e3f224d6ae6d38e5fc899fb5eaadf2b7c255a1 by Christian Heimes in 
branch 'main':
bpo-45548: Remove checks for finite and gamma (GH-29206)
https://github.com/python/cpython/commit/77e3f224d6ae6d38e5fc899fb5eaadf2b7c255a1


--

___
Python tracker 

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



[issue45605] Return False from __contains__ method if object not hashable for set and dict

2021-10-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is a duplicate of issue18510. It was also discussed on the Python-Dev 
mailing list (maybe more than once). If you have some new arguments or 
something in past 8 years made the old arguments no longer valid please open a 
new discussion on the mailing list.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> dict.__contains__ and dict.keys().__contains__ raises exception 
instead of returning False

___
Python tracker 

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



[issue45587] argparse add_argument_group: distinguish title and description from **kwargs

2021-10-25 Thread paul j3


Change by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

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



[issue24739] allow argparse.FileType to accept newline argument

2021-10-25 Thread paul j3


paul j3  added the comment:

Adding `newline` to `FileType` requires modifying both the `__init__` and 
`__call__` methods.  That's nearly the whole class.  I'd copy and edit, and 
forget about subclassing.

--

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Two years is not so long for a bug. We fixed 8-year and 12-year bugs.

The issue is that this feature is internally inconsistent (isinstance() is not 
consistent with issubclass()), the C implementation of list[int] is not 
consistent with the Python implementation of List[int], and a lot of code was 
not tested with this feature, so we perhaps have a lot of bugs in the stdlib 
and in the third-party libraries. Are we going to backport changes for making 
code working with GenericAlias as a type to 3.9 and 3.10? If not, we will 
actually add new features in 3.11 and keep 3.9 and 3.10 broken. If yes, these 
changes can have larger effect than just making isinstance(list[int], type) 
returning False, and they can break more code.

Note also that isinstance(List[int], type) was True before 3.7, and we 
intentionally made it False in 3.7 (it was required significant rewriting of 
the typing module and introducing __mro_entries__). Do we want to revert this 
decision?

--

___
Python tracker 

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



[issue45605] Return False from __contains__ method if object not hashable for set and dict

2021-10-25 Thread Eric V. Smith


Eric V. Smith  added the comment:

I don't have any code that would care, but if there's one thing I've learned in 
15 years of python core development, it's that this will break someone's code.

If you want more feedback, you should probably bring this up for discussion on 
the python-ideas mailing list.

--

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

I really don't recall if we even seriously considered what 
isinstance(list[int], type) should return. PEP 585 doesn't mention it. I 
presume it falls out of the way it's being tested and the way list[int] passes 
most attribute requests on to the origin (i.e., to list).

Given that this has returned True for two releases now I'm very reluctant to 
changing this now. So our best option is pursuing Serhiy's option 1, at least 
partially. The fix for the OP should be simple enough, right?

--

___
Python tracker 

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



[issue45605] Return False from __contains__ method if object not hashable for set and dict

2021-10-25 Thread Андрей Казанцев

Андрей Казанцев  added the comment:

Can you please specify in what cases we need to get an exception instead of 
False? It just seems very strange to me to rely on this behaviour.

--

___
Python tracker 

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



[issue45605] Return False from __contains__ method if object not hashable for set and dict

2021-10-25 Thread Eric V. Smith


Eric V. Smith  added the comment:

That seems like a pretty big change that could break a lot of existing code. I 
suggest writing a wrapper around "in" if you want this behavior.

--
nosy: +eric.smith

___
Python tracker 

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



[issue40915] multiple problems with mmap.resize() in Windows

2021-10-25 Thread Tim Golden


Change by Tim Golden :


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

___
Python tracker 

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



[issue45605] Return False from __contains__ method if object not hashable for set and dict

2021-10-25 Thread Андрей Казанцев

New submission from Андрей Казанцев :

Now if do something like `[] in set()` python raise an exception, but if an 
object isn't hashable then we know for sure that it isn't in the set. Propose 
return False for these cases.

P.S. I would like to make a patch

--
components: Library (Lib)
messages: 404971
nosy: heckad
priority: normal
severity: normal
status: open
title: Return False from __contains__ method if object not hashable for set and 
dict
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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-25 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> Was it mistake to make isinstance(list[int], type) returning True?

What was the motivation for this? At first glance returning True looks wrong.

--

___
Python tracker 

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



[issue45436] test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

2021-10-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Are there changes in handling empty values for other options? If yes, we 
perhaps need to add version-dependent tests for empty values instead of just 
skipping this case.

--

___
Python tracker 

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



[issue45436] test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

2021-10-25 Thread E. Paine


E. Paine  added the comment:

> Any word on the tk Menu type parameter change?

I haven't submitted a bug report yet and want to do a little more research 
before I do so (the Tcl ticket system is quite difficult to search)

--

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are two ways to fix the larger issue.

1. Make issubclass(types.GenericAlias, type) returning True, and also make 
isinstance(typing.List[int], type) returning True and 
issubclass(typing._GenericAlias, type) returning True, and analyze every place 
in the interpreter and the stdlib which calls isinstance(..., type) or 
issubclass(..., type) and ensure that they work with types.GenericAlias and 
typing._GenericAlias and their instances as well as with ordinary types, fix 
them and add tests for them. And perhaps do the same for types.UnionType, 
typing._UnionGenericAlias, typing.TypeVar, typing.NewType, etc, etc.

2. Make isinstance(list[int], type) returning False. It would be nice to ad 
also tests for the same cases as in option 1, but it is not so urgent, and I 
expect that in most cases the current behavior which matches the status quo is 
expected.

I tried to implement option 1, but it is just too much places, so it would take 
a large amount of time which I do not have right now. First than invest my time 
in this I want to make sure which option is desirable in long term.

Guido, Ivan, Ken Jin, what would you say?

--

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-25 Thread Martin Rueckl


Martin Rueckl  added the comment:

I just created a PR and signed the contributor agreement. Waiting for it to 
update :-) Comments welcome!

--

___
Python tracker 

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



[issue45604] multiprocessing.log_to_stderr missing documentation for parameter

2021-10-25 Thread Alex Wells


New submission from Alex Wells :

The documentation for multiprocessing.log_to_stderr() specifies that the method 
takes no parameters. However, intellisense in VSCode and debugging the method 
both show that there is a single parameter, "level", whose default value is 
None. 
Documentation here:
https://docs.python.org/3.7/library/multiprocessing.html#multiprocessing.log_to_stderr

The parameter appears to be a shorthand to allow you to both get the logger and 
specify the required log level in one step, rather than two. The code that 
handles the "level" parameter appears to do what I'd expect it to do.

I think the documentation simply needs a few words written about the parameter.

Thanks.

--
assignee: docs@python
components: Documentation
messages: 404965
nosy: AlexWells, docs@python
priority: normal
severity: normal
status: open
title: multiprocessing.log_to_stderr missing documentation for parameter
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-25 Thread Martin Rueckl


Change by Martin Rueckl :


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

___
Python tracker 

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



[issue44319] setup openssl failed on linux

2021-10-25 Thread Devin Prescott


Devin Prescott  added the comment:

This docker file will get you the same environment:

## Build Command ##
#docker build --rm -t centos7/builder .
## Run Command ##
#docker run --rm -it centos7/builder
# INSIDE DOCKER:
#make -j $(nproc)

FROM centos:7

###
##   Update & Get Dependencies   ##
###

RUN yum -y update

RUN yum -y install deltarpm epel-release
RUN yum -y groups install Development\ Tools
RUN yum -y install libtemplate-perl wget make gcc perl-core pcre-devel 
zlib-devel
RUN yum -y install libffi-devel bzip2-devel pkgconfig
RUN yum install -y openssl11 openssl11-devel openssl11-libs openssl11-static
RUN mkdir -p /home/builder
WORKDIR /home/builder

###
##Enable SCL Dev Toolset8##
###
RUN yum -y install centos-release-scl
RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
RUN yum -y install devtoolset-8
RUN scl enable devtoolset-8 bash

###
##Prep Build for Python-3##
###
RUN wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
RUN tar xzf Python-3.10.0.tgz
WORKDIR Python-3.10.0

RUN /home/builder/Python-3.10.0/configure --enable-optimizations --with-lto 
--with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions 
--with-openssl=/usr/lib64/openssl11 --with-openssl-rpath=auto

--
title: setup openssl faild on linux (ubuntu 20.04) -> setup openssl failed on 
linux

___
Python tracker 

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



[issue45436] test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

2021-10-25 Thread Zachary Ware


Zachary Ware  added the comment:

Thanks for tracking that down!  Any word on the tk Menu type parameter change?

--

___
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-25 Thread Zachary Ware


Zachary Ware  added the comment:

The failure that you saw was due to a change in Tcl/Tk 8.6.11; we recently 
updated our tests to handle that change in bpo-45436; the fixes have not been 
released at any version yet, but the fixes have been applied back to 3.7.  The 
"resource not available" not is due to your `-u` flags, as noted by E. Paine.

--
nosy: +zach.ware
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
type: compile error -> behavior

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-25 Thread Martin Rueckl


Martin Rueckl  added the comment:

Can confirm for 3.9.7 as well.

--
nosy: +martinitus

___
Python tracker 

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



[issue45511] Batch-mode input() limited to 4095 characters on *NIX

2021-10-25 Thread Eryk Sun


Eryk Sun  added the comment:

> but I'm interrested in knowing more about the issue/original cause.

When the readline module is imported in interactive mode, the 
PyOS_ReadlineFunctionPointer function pointer is set to call_readline(), which 
uses GNU Readline. Otherwise PyOS_Readline() calls PyOS_StdioReadline(), which 
calls my_fgets() and thus C standard I/O fgets().

In Linux, when the terminal is in canonical mode, a low-level read() is 
buffered with a limit of 4096 bytes. If the limit is exceeded, the call returns 
just the first 4095 bytes plus a trailing newline. You can verify this with 
os.read(0, 5000). GNU Readline disables canonical mode and works with the 
terminal at a lower level. I am far from an expert with Unix terminals, but 
here's the basics of something that allows input() to read more than 4096 
characters without having to import the readline module.

import sys
import termios

LFLAG = 3
settings = termios.tcgetattr(sys.stdin.fileno())
settings[LFLAG] &= ~termios.ICANON
termios.tcsetattr(sys.stdin.fileno(), termios.TCSANOW, settings)

try:
s = input()
finally:
settings[LFLAG] |= termios.ICANON
termios.tcsetattr(sys.stdin.fileno(), termios.TCSANOW, settings)

print(len(s))

--
nosy: +eryksun

___
Python tracker 

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



[issue24739] allow argparse.FileType to accept newline argument

2021-10-25 Thread Mitar


Mitar  added the comment:

I think the issue is that it is hard to subclass it. Ideally, call to open 
would be made through a new _open method which would then call it, and one 
could easily subclass that method if/when needed.

--
nosy: +mitar

___
Python tracker 

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



[issue45292] Implement PEP 654: Exception Groups

2021-10-25 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +27475
pull_request: https://github.com/python/cpython/pull/29207

___
Python tracker 

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



[issue45511] Batch-mode input() limited to 4095 characters on *NIX

2021-10-25 Thread Grégory Starck

Grégory Starck  added the comment:

> This does not seems to be a copypaste issue.

well. it's either not a prob in my_fgets()/fgets IMO. what the process reads on 
its stdin is already corrupted/broken.

but I'm interrested in knowing more about the issue/original cause.

--

___
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-25 Thread Marten Lienen


Marten Lienen  added the comment:

The lru_cache can trigger infinite recursion if it is used to cache a hash 
computation because the cache look-up itself requires the hash.

from functools import lru_cache

class CachedHash:
@lru_cache
def __hash__(self):
# Expensive calculation because we are caching a big matrix for example.
return 0

hashed = CachedHash()
hash(hashed) # => RecursionError: maximum recursion depth exceeded while 
calling a Python object

Even though this looks contrived, it is actually my use case. cached_property 
is not directly applicable because __hash__ needs to be a method and I wanted 
to avoid caching as an instance attribute because my class is a frozen 
dataclass. The dataclass thing also makes close() awkward because then I would 
have an outwardly resource-ful dataclass which is against the spirit of a 
dataclass.

I will think about putting this on pypi instead.

--

___
Python tracker 

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



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

2021-10-25 Thread Raphael


Change by Raphael :


--
title: Please official support %G, %V and %u directives in time library -> 
Please officially support %G, %V and %u directives in time library

___
Python tracker 

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



[issue45511] Batch-mode input() limited to 4095 characters on *NIX

2021-10-25 Thread Romuald Brunet


Romuald Brunet  added the comment:

This does not seems to be a copypaste issue.

I've re-tested using xdotool to "manually" type 5000 characters in to a X 
terminal (gnome-terminal and xterm, to be sure) and got the same result.

I also have 4 read(0, "...") with the last one ending with a "\n", that's a 
very strange behavior


I tried to test the same thing on a macOS version, but the input() / terminal 
would not let me insert more than 1024 characters

--

___
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-25 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27474
pull_request: https://github.com/python/cpython/pull/29206

___
Python tracker 

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



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

2021-10-25 Thread Eryk Sun


Eryk Sun  added the comment:

The pip package installer is not part of Python's standard library. Issues with 
pip should be reported at the following site:

https://github.com/pypa/pip/issues

Note that pip 20.0+ automatically switches to a --user installation if the user 
lacks the required access for a system installation.

--
nosy: +eryksun
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue45586] Use starred expressions in subscripts

2021-10-25 Thread Peter Tillema


Peter Tillema  added the comment:

Right, I should have clarified it a bit more. I'm using NumPy arrays because 
they allow indexing like this, where the input arguments are converted to a 
tuple. So
   a[1, 2, *[3, 4]]
is different than
   a[[1, 2, *[3, 4]]]

This indeed only works on NumPy arrays, although I would like to see such 
feature implemented for real lists!

--

___
Python tracker 

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



  1   2   >